Your advice about project organization

Discussion and feedback on Construct 2

Post » Sat Sep 17, 2016 12:26 am

Hi.
I've used C2 for years and I completed only one project (and that's ironically not a game).

My bad organization has something to do with it.

I usually start a project cleanly. I write comments, etc.
Then when my project begins to have some working stuff, I try to create new ones quickly and dirty just to see how it's going, then it works and I keep them this way.
After a few days or a few weeks, my project is a labyrinth of badly optimized events, with few comments and it becomes a pain when I try to add anything to it.
If I do, that breaks something else.

Lastly, I made a working prototype of a multiplayer game (a minigolf game). But, as usual, it quickly became impossible to create new content without having new issues.

So I started my project from the beginning again, but I did some things to have a better organization :

I draw diagrams :
Image
Image

Putting your ideas on paper like this allow you to have a global view and prevent some conflicts. Not all of course as you can't think about all.
For example, I drew my diagram based on the fact a player turn ended when his ball stops moving. But it was a mistake : a player turn ends when ALL balls have stopped moving : what if a player ball hits another ball? Also, what if one or more ball collides with the hole during the same turn? I didn't think about that and it was a pain to fix this because I didn't predict this situation in my events.
Still, using diagrams helps a lot.
To do this, I use https://www.draw.io which can connect to google documents, so that's quite convenient.

I extensively log my events and functions in a text area, so I know exactly at which step my project is when something bad happens while it runs :

Image
Image

That might be obvious, but… I didn't do it that much before.

On the last version of my project, I also try to complete my features in a different direction. Before, I created my features in this order :
  • Player log-in
  • Game initialization
  • Player actions
  • Next player
  • Change map if all players have completed their course

That's the order of the actions when we are actually playing. But that's not necessarily the right order to use when creating that game.
So I'm doing this :

  • Player log-in
  • Game initialization
  • Change map if all players have completed their course
  • Next player
  • Player actions

Doing so I ensure that I won't encounter an issue when I'll try to make player change map. I've kinda isolated this event ahead and I can safely create the previous events that will lead to a map change. Same logic when creating the next player events before creating the content of a player turn.

While chatting with @broknecho on the Construct 2 Discord server about this, he told me some interesting things he does :

As another project helper, I started using the Dictionary plugin to start storing variables on it as Instance Variables. I would name one dictionary Globals, mark it as GLOBAL, and then when writing code, I would be able to use Globals.CurrentGameState as an example. It helped to unpolute the Global space and refactoring was a breeze.

Another one I started using is [a dictionary called] FunctionNames and was able to have a single spot for the Function String names.
[…]
my function names would be like Player.UpdateHealth which allowed me to have complete context when using the inteli-sense
[…]
when I have to call a function, I type:
FunctionNames.PlayerUpdateHealth


So, what about you? Do you have any precious advice, tricks regarding a project organization?
B
12
S
7
G
7
Posts: 450
Reputation: 4,276

Post » Sat Sep 17, 2016 1:28 am

I create a different event sheet for each object with roughly the same structure.
I put the global variables that belong to this object at first, followed by a "startup group" whith all the stuff that has to be done with this object on start of layout or on creation
after that comes a movement group if its not static, followed by animation group etc.
I then include all the event sheets in a maingame eventsheet.

I also have a WIP (work in progress) event sheet where i can test new features and be messy with my code, once i feel the feature is complete and works how i want it to i can go ahead and transfer it all nice and clean over to the real codebase.
Also, use functions, functions, functions and if it's possible try to use local variables inside the function not globals outside.
that has not only the advantage that you dont have to reset the variables all the time,
but it also makes it easyer to copy the whole function from one place to another ...even from one c2 project to another
and you can use the same name for local variables over and over, that makes it easyer to pick names that make sense.

there's a bunch more, but thats what came to my mind right now,
cheers.
B
68
S
28
G
7
Posts: 85
Reputation: 7,496

Post » Sat Sep 17, 2016 6:40 am

Having every variables and every keys in every dictionaries listed on a excel sheet makes it very easy to see what they are used for and where it is if you are making a large game like me.
Also use include event sheet to access previous functions so you don't have to redo the same shit over and over again.
Try to use folders in Construct 2 editor to arrange everything.
When storing sprites, store them in layouts ordered by their types and functions. Make sure the name of the layout reflect what type of sprites are stored there. DO NOT simply throw every single sprite into one or two layout just because you can't be arsed to do anything else. You will regret it multiple times when you try to improve or update your game. Remember to use folders again to organize these layouts. Number of sheets nor layouts don't matter much.
Use comments in C2 editor liberally. Don't worry, every comment in C2 is removed during import. Helps a lot when you are wondering 5 months later what the hell does this part of a large function do.

Enjoy gamedev and pace yourself. Always remember to have fun!
B
36
S
18
G
11
Posts: 248
Reputation: 8,694


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 13 guests