Streamlining events!

Chat about anything not covered in these forums, but keep it civil!

Post » Wed Mar 29, 2017 12:05 am

Hello!

Sometimes it is good to streamline your events. Yeah. We know that.

I got inspired and over the last 1-2 weeks I have streamlined my game and shrunk down the events with 145 events! Yes, 145 events deleted!

If not for the optimization (which is not always true) it is mainly for the typo and overview thing. Having "basically repeated" code everywhere just with minor adjustments (for example to treat 4 or 8 directions, patterns etc) = higher risk to typos/accidents and worser overview. I also combined enemies behavior and object behavior and used more functions.


It required some thinking to solve some logic, and using math, also using loops in one place. But it feels good when I solved. :)
It feels good.
B
58
S
18
G
13
Posts: 447
Reputation: 10,740

Post » Wed Mar 29, 2017 12:35 am

Yeah, it definitely is nice to figure out ways to reduce the number of events. The more I put effort into doing that, the more I come to enjoy organizing my events and in extension the whole game development process improves.
I'm also resorting to using more functions too, and then minimizing them so their events don't take up space.
Also, one thing that I always try to do is put my behaviors onto Families. I rarely put them on single objects. I also try to put instance variables on families too instead of directly on the objects. That way I can compare two object instances by referencing one from the family.
B
47
S
22
G
65
Posts: 1,127
Reputation: 38,395

Post » Wed Mar 29, 2017 1:01 am

I have yet to use families because I use one single sprite for all my stuff with exception for the player! ;D So I separate them by animation name.
B
58
S
18
G
13
Posts: 447
Reputation: 10,740

Post » Wed Mar 29, 2017 3:51 am

hm, interesting.. I can't imagine doing that for everything. I guess it would depend on the type of game it is.
But even so, a family could still be useful; example:
+pick sprite by evaluating sprite.familyVariable = "red"
+pick family by evaluating family.familyVariable = "blue"
--+sprite is overlapping family
----+sprite.familyVariable = "purple"
----+family.familyVariable = "purple"
B
47
S
22
G
65
Posts: 1,127
Reputation: 38,395

Post » Wed Mar 29, 2017 8:46 am

True enough. I am making a Boulder Dash-inspired game.

Also you know, you can make similar thing in different ways too. :)
B
58
S
18
G
13
Posts: 447
Reputation: 10,740


Return to Open Topic

Who is online

Users browsing this forum: No registered users and 11 guests