Groups: Let's All Get Together Now

0 favourites
  • 4 posts
From the Asset Store
Who wants to be a Millionaire Clone. An educational coding source
  • As I'm working towards the completion of my first game - a very simple infinite runner that I might polish up REALLY nice later on - I've come to an epiphany: I have under-appreciated the use of Groups.

    This got me to thinking...

    What are some of your BEST tips for the use of Groups? What are some "hidden gems" that you've learned about their function? How do you organize your Groups? Is there an "unconventional" way that you use them?

  • As I'm working towards the completion of my first game - a very simple infinite runner that I might polish up REALLY nice later on - I've come to an epiphany: I have under-appreciated the use of Groups.

    This got me to thinking...

    What are some of your BEST tips for the use of Groups? What are some "hidden gems" that you've learned about their function? How do you organize your Groups? Is there an "unconventional" way that you use them?

    Groups can be activated and deactivated on demand, this is a really nice thing performance wise (I think deactivated groups are completely skipped when deactivated, except if you are runing the debugger). Try to see where you really need them to be active.

    And also for organisation, groups are great, and as I always say : a clean code is easy to maintain, to debug, to optimise.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • And also for organisation, groups are great, and as I always say : a clean code is easy to maintain, to debug, to optimise.

    THAT, right there, is one of my next goals to perfect. With my current project, while it start off "simple" enough, working through the final steps to completion is proving to be a bug tester's near-nightmare. Who knew an infinite runner could be so bothersome?

    The ironic thing is that I am actually using Groups to isolate activities, but am finding it a tad confusing because - as is often the case, I'm sure - so many objects/events are related in different categories/Groups. WHERE do I put them? LOL How does this help me keep things CLEAN and tidy?

    Organization is not my friend. LOL

  • > And also for organisation, groups are great, and as I always say : a clean code is easy to maintain, to debug, to optimise.

    >

    THAT, right there, is one of my next goals to perfect. With my current project, while it start off "simple" enough, working through the final steps to completion is proving to be a bug tester's near-nightmare. Who knew an infinite runner could be so bothersome?

    The ironic thing is that I am actually using Groups to isolate activities, but am finding it a tad confusing because - as is often the case, I'm sure - so many objects/events are related in different categories/Groups. WHERE do I put them? LOL How does this help me keep things CLEAN and tidy?

    Organization is not my friend. LOL

    Groups aren't the only one thing about organisation, I've written something about organisation in C2 (in french sadly), but the big lines are:

    • Don't be affraid to divide your work into multiple event sheets, for the levels themselves I have myself:
      • Functions, This is the one I prefer, the functions are great for organisation, because:
        • If you have to do complex maths operations, just do a function to isolate it, then use the Function.Call(functionName, Parameters) to have the return value, seeing Function.Call("Strenght_Stat_value_at_level", Self.Level) is something you know what it does more easily than sqrt(Exp(Player.Level))*1.33
        • you can also have repetitive actions that can be wrapper into a simple Action: "Call function "initiate ennemy" with parameter 0 = Ennemy.UID" for exemple is clearer than "Set angle to .. then set speed to.. then set animation to... then if something is true do ..."
      • Ennemi AI
        • Each ennemies have their AI written inside a group, I deactivate it when the last ennemy of this kind is destroyed, and reactivate it when It is deactivated and I create this kind of ennemy
        • If an object can spawn ennemies, I follow the same rule as if it was an ennemy
        • I also sometimes apply that to ennemies' shot
      • Variables, contains global variables and constant with commentaries, don't bother to include this sheet anywhere, it just works, you should not have too many of them, since local and instance variables are enough for the ennemy AI and for a lots of things.
      • Initialisation, to initiate the level, if you have a lot of math to do, remember the functions? yeah, there are useful
      • Inputs, not my favorite, but using groups here to detect the kind of input is good, so you don't check for other sort of inputs
      • Level, it contains the other ones (except variables)

    But the main point is..

    Just make your program easier to read for yourself, nothing cryptic, use constants and functions and variables to have actual understandable english (or whatever language you prefer) words that helps you understanding the concept you are trying to achieve, do not be affraid to isolate something complex, use commentaries wisely (you should not need 1 comment per line I think), use families to keep things easier sometimes, subfolders to know where each thing is.

    Also do not try to become organised in 1 day straight, just keep improving towards that, you'll learn beter ways to do so, and it'll become natural for you at the end.

    EDIT: I'll add that the point is at the end, you will know that the problem can only come from a limited number of things, and you''l only have to edit it once and it'll apply everywhere, since you don't repeat lines of code, but call them

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)