Many sheets and folders in a project

Get help using Construct 2

Post » Wed Feb 26, 2014 7:33 am

Now I am making my second game in C2 and I want to do the code a bit more confortable and work in the best way to do it. I have a question: I want to do folders and subfolders for layouts and event sheets... so, I am goint to work more with functions in separate sheet, global variables in separate sheet and so... can this make the game more slow?

Thanks in advance :)
B
17
S
5
G
2
Posts: 173
Reputation: 2,085

Post » Wed Feb 26, 2014 7:43 am

It all depends how you do it. As long as the event sheets you include don't have unnecessary evaluations every tick, it shouldn't be a problem. As onFunction events are real triggers, this will not influence the performances.
For more intensive group of events that act only on one object, you could put them in a group and toggle activation of this group on creation/destruction of the corresponding object.

To sum up, what you want to do is CPU friendly as long as you include only what you need where you need it.
B
17
S
8
G
4
Posts: 473
Reputation: 6,191

Post » Wed Feb 26, 2014 7:46 am

I do this and haven't seen a problem. Remember that when you export, it compiles it together. The folders etc are just for our benifit, and for us to group, segment, whatever we want.

I like a main eventsheet with groups and includes to other event sheets. This way i can turn on/off sections of game. I build everything in groups/sections (self sustainable groups if I can)
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,718

Post » Wed Feb 26, 2014 8:15 am

@DUTOIT @Guizmus Thanks!

I want to work with the best practices I can... I get more relaxed with your advices. I want to works as you say DUTOIT, with groups and sections... As say Guizmus, I suppose is a very bad practice do not destroy what you are not using... and I think for do this you have to organize the project in the correct way... Ithink isn't easy do this for me at moment, but I will try... any advice about nice practices?
B
17
S
5
G
2
Posts: 173
Reputation: 2,085

Post » Wed Feb 26, 2014 9:26 am

Tarkion wrote:@DUTOIT @Guizmus Thanks!

I want to work with the best practices I can... I get more relaxed with your advices. I want to works as you say DUTOIT, with groups and sections... As say Guizmus, I suppose is a very bad practice do not destroy what you are not using... and I think for do this you have to organize the project in the correct way... Ithink isn't easy do this for me at moment, but I will try... any advice about nice practices?


I come from php programming and C# so I like OOP.

Adivice? None, really because each has his own way of doing something - but one thing is universal - COMMENT EVERYTHING - lol. Spend more time commenting and be as detailed as you can.
shortcut is "q" Every event hit q and write what it does and needs to work.

Other than that. Able/Disable groups is a lifesaver
and nothing wrong with toggle able/disable events. Don't delete until you are happy new event is better than old.
And Bookmarks are cool too.
Learn them and there shortcuts.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,718

Post » Wed Feb 26, 2014 11:22 am

@DUTOIT thanks!!!

Ok then:

*To be careful with certain events as "every tic".
*Organize with folders and subfolders.
*Organize and use the groups in order to enable/disable itself, saving resources and reusing in other sheets
*Comment everything with a lot of details.
*Use bookmarks and shortcuts.

Nice, thanks again!! :D

Pd: Sorry for my poor english
B
17
S
5
G
2
Posts: 173
Reputation: 2,085

Post » Wed Feb 26, 2014 11:26 am

Folders and subfolders have exactly zero impact on performance.
Scirra Founder
B
398
S
236
G
88
Posts: 24,428
Reputation: 194,600

Post » Wed Feb 26, 2014 11:44 am

Ashley wrote:Folders and subfolders have exactly zero impact on performance.


@Ashley thanks!!
B
17
S
5
G
2
Posts: 173
Reputation: 2,085

Post » Wed Feb 26, 2014 1:06 pm

Here are some advise that might be useful.

1. Clean up
Objects that you don't need to be there from the start, by this I mean sprite objects that would be "Units", "Bullets" etc. you should destroy at the beginning of the game. This is simply to make sure that you don't have rogue objects in your program.

2. Precise functions
Make as small and precise functions as possible. Even though some of these functions might seem to simple for it to make much sense.

And example of why this is a good idea. Imagine you have a "Car" and in you code you might change the speed, so you simply as you make the game, set the speed to what ever you think would be good. This would be fine until the moment you decide that it could be fun to add, if the speed gets above a certain amount that the car should start loose control. If you add it in your code you would have to change/test for it everywhere you might change speed, if you have a function you can simply add it here and update it for the whole program.

3. Global constants
This can be very useful for reducing spelling errors, and to quickly change things in your game. Imagine as the above example, that you have several car objects which are categorized by a type, "Cheap car", "Normal car" and "Expensive car"
If you in your code manually add checks if ( Car.type = "Cheap car" ) and then do something, at some point you might figure out that this weren't that good, and it should instead have been something else, then instead of having to go through you whole code, you can just update 3 global variables.

4. Use several event sheets
Don't be afraid of using event sheets even though you might not add a lot to them. It will really help you maintain an overview of your game.

5. Split events and functions
Unless you are 100% sure that an event sheet should only be used one place, its always a good idea to split events and functions, even though they work on the same object. So an event sheet called "Car events" and "Car functions" would be a good idea. You can always move functions later on, but think it good practice to just get used to splitting them.

6. Requirements and returns
When making functions I find it very useful to add comments above them with requirements, and potential return values. This will make it very easy later on as you move along and might forget what a function actual does when you return to it.

An example could be like this:
Image

7. Bug sheet
Make an empty event sheet, that you just use for comments. You don't include it in your program. But the purpose is as you test your game and might be testing something, suddenly notice that something else is not working as intended. Then instead of fixing it straight away, you just in you "Bug event sheet" add a comment explaining what you noticed. And if possible the cause for it. Then you can always fix it later and you wont forget about it.

8. Quick reference function sheet.
This can be a bit time consuming but very useful. The idea is again to add an event sheet that you don't include in your program. But you simply add function calls to it, with the required amount of parameters.

Image

This can speed things up quite a bit as you can just copy/paste function calls from this sheet to wherever you need them, and just update the parameters, and you don't have to remember the name or how you spelled the function name etc.

Other than that I think the other advise are good as well.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Thu Feb 27, 2014 8:11 am

NIce!!!! @nimos100 a lot of material for great performance here!!

I like the bug sheet and Quick reference sheet. I am working too with many sheets and I am doing functions of the most simple of instructions lol and the requirements and potential return values is a nice idea!

now I Know than folders and subfolders haven´t impact in performance, but what happen with sheets?... example now I am working in a game will have 30 scenes/levels. I am working with: Functions sheet, Variables sheet, Controls sheet, Bug sheet, quick reference function sheet and a lot of more...plus 30 SCENES sheet!!!! thats a lot of sheets... or I can use only one sheet for all scenes???

I know Guizmus said that if you works fine you include only what you need where you need (CPU friendly) but I am a n00b already... so I don't know if I must works with decens of sheets lol

Thanks!!! ;)
B
17
S
5
G
2
Posts: 173
Reputation: 2,085

Next

Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], brunopalermo, FabianB, Wartexnik and 44 guests