Code Organization Issue

Discuss game development design and post your game ideas

Post » Tue Aug 30, 2016 3:05 pm

Hey everyone !

I'm having an organization problem with my more complex projects on C2. As they start to get more complex and bigger I start having trouble to maintain my code/events.

I always feel like i have to create more event sheets to code simple object rotation/positioning/effects/game mechanics, etc... , and when I later need to review them again, I get lost.

For example, and I don't mean to compare Unity and C2, but when i use Unity for my projects I feel like I can easily find and understand what I'm reading. I thinks it's because each object has script components, and that makes code much easier to find and maintain. If I get back to a script file I haven't touched for a while I can easily continue with it. I don't understand why, but this is harder to do in C2, at least for me.

Do you guys have any tips on organization ? Cuz it forces me to switch projects, and split them into simpler modular projects that i can use later.
B
5
Posts: 23
Reputation: 271

Post » Tue Sep 06, 2016 7:41 am

Hey Baionera, C2 has a group function that enables you to group pieces of code into several components which you can label yourself.

Or you could make a code that's super messy but still play well. For example, check out the game in my siggy. Being my first game when I barely knew how to use C2, the code is an absolute mess however I'd say it still plays well; well maybe not well but it plays the way it's supposed to.
Image Image Image
B
29
S
11
G
27
Posts: 730
Reputation: 17,002

Post » Tue Sep 06, 2016 11:20 pm

I use a 'branching tree' Structure for the most part.

Example:

If gameMode="action"
- Controls code
- Enemy AI
- Etc
If gameMode="cinema"
- If scene="intro"
If gameMode="menu"

Coding this way makes it easy to find what I'm looking for, as the base events are like categories and each subevent becomes more specific.
Moderator
B
94
S
33
G
33
Posts: 3,006
Reputation: 27,749

Post » Wed Sep 07, 2016 4:21 am

One approach to also take is to split off different components into their own event sheets. Such as one for enemy AI, one for HUD functions, etc. Then make a "Main" event sheet that includes the rest and only includes vital/startup functions.
Zelda Gamekit (my project)



Example capxs:

Zelda-Style Inventory

Zelda Health

3-saveslot system

[url=https://www.dropbox.com/s/d4396pwak0oh7q6/ZeldaDialogueSystem.capx?dl=0]Zelda-like Dialogue[
B
51
S
24
G
30
Posts: 523
Reputation: 19,598

Post » Wed Sep 07, 2016 2:41 pm

There's always bookmarks you can use, also groups (groups within groups), and comments. I find different too many event sheets per layout hard to work with, So I mainly use one per layout then open or close groups instead depending on what layout.

Usually i have all controls related stuff in one group, UI stuff in one group, Other logic/game events and stuff in other groups, And then using subgroups for specific things. By deactivating unused groups you can save a lot of processing power as well. The less events the engine has to go through each tick the better.

Another good way I find really useful for organizing is using functions. Instead of having a HUGE list of sub- events, conditions and actions and I call functions instead. Functions you can name properly, and find more easily for specific things.

For example:
On mousebutton down:
---> Call function: CharShoot
---> Call function: CharSound
---> Call function: UpdateBullets
---> Call function: CharAnimation
Follow my progress on Twitter
or in this thread Archer Devlog
B
38
S
15
G
17
Posts: 949
Reputation: 12,320


Return to Game Development, Design & Ideas

Who is online

Users browsing this forum: No registered users and 1 guest