How to get the most out of 40 events

Post » Wed Apr 05, 2017 12:12 am

I'm a bit obsessive about refactoring (which is not always a good thing). In this case though, there are certain obvious tangible benefits to compacting your event sheet. So I thought I'd like to share some tips that may or may not already be common knowledge regarding this matter. Note that some of these go against traditional refactoring objectives in terms of losing readability and making things more complicated, but the goal here is to minimize event usage.

1. Verify your e-mail address on your profile. You now have 10 more events! Easiest way to get a 25% event limit increase.

2. Avoid using global/local variables to store and manipulate data. Use instance variables instead. Or data objects like arrays and dictionaries. Or instance variables in array and dictionary objects. Bonus (in C2 at least) - you get boolean variables for toggling! It may take an action to reset a variable after using it if you're using it in place of a local variable, but actions are free anyways.

3. Focus on minimizing and grouping your conditions rather than actions. Conditions are the real limit, as you can have as many actions per event as you please. Avoid functions - again, actions are free, so just copy and paste them where needed rather than have multiple events call one function. Unless your functions have a lot of sub-events going on. In that case, utilize functions!

4. Use conditional operators. Instead of having a set of If/Then events, you can often condense them into one action/expression. Note that you can use conditional operators in conditional operators. I would normally never recommend this due to the readability being crap, but it can save a ton of events in certain situations! Common use case - looping/repeating counters (cooldowns, ammo, score...).

5. Alternative compact toggles - Use inverse math to swap any two numbers. Simple - Set x to 1-x will swap between 0 and 1. Advanced - Set x to 15-x where X is anything between 0 and 15 will swap between that number and its inverse. Can be used for animation frame shenanigans.

6. Loops and loopindexes are your friend, especially for positioning objects dynamically. Note uneccessary use of sub events.

7. Don't position objects dynamically if you can avoid it, as that takes events. Do as much as you can in the layout editor.

I'm sure there are more but that's about it off the top of my head for now. I'm sure others can add to this list :)
Last edited by oosyrag on Wed Apr 05, 2017 7:40 am, edited 3 times in total.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Wed Apr 05, 2017 5:24 am

Fun list. I haven't spent a whole lot of time with C3 yet, but I like your ideas to push the limits. I especially like the conditionals idea, it makes me wonder how deluxe a game could be made with one event. Anyways in the spirit of the topic here are a few more ideas:

8. Utilize behavior's as much as possible instead of events. A behavior won't always fit with what you want to do but it sure is nice when it does or even is just close enough.

9. Make a simple scripting language to control your game. Admittedly it may be pretty tricky to cram that in 25 or 40 events but if successful you'd be able to have a lot more logic. Being able to type multi line text for text properties in c3 is useful for this.


I'm drawing a blank for any other general ideas, no doubt there others.
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Wed Apr 05, 2017 6:28 am

10, Simplify your game idea. Even if you want to do as much as possible in 40 events don't try to squeeze in so much that your code/events will be overly complex and hard to maintain, or introduces a lot of bugs. From a performance perspective I tend to follow this rule. "The most performant code is no code at all", or Less is More.
Follow my progress on Twitter
or in this thread Archer Devlog
B
37
S
15
G
17
Posts: 949
Reputation: 12,295

Post » Wed Apr 05, 2017 8:02 am

11. A lesser known trick I first learned of in an example template (it isn't mentioned in the manual, or I missed it) - Image

If you have the same number of instances with two objects, expressions automatically pick the relevant instance from an object when acting on another object. This can save a lot of picking through conditions and events when used creatively.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Wed Apr 05, 2017 8:11 am

Some handy tips, but part of the reason I've gone over is having a few layers.

I'm using layers for a lightning system, so one layer is dark, one is not and a sprite object cuts away at the dark (acts like a torch). Based on their simple lighting example. I'm wondering if there's a better way to do it.
B
4
S
2
G
5
Posts: 346
Reputation: 2,417

Post » Wed Apr 05, 2017 8:26 am

Layers are definitely a hard limitation, luckily they are usually not essential to the core of a game.

In your case it does seem like it is though. I can only suggest blending modes as an alternative. It won't be as pretty, but should be able to represent lighting in terms of game mechanics.

Also with two layers you should still be able to utilize the techniques in the lighting example. At least the free version isn't limited to just one layer ;)

On the topic of layers, good ways to utilize additional layers are parallax layers, hud layers, and lighting layers. The first two can be simulated with events and viewport expressions. I haven't experimented much with lighting myself, sorry.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Wed Apr 05, 2017 9:23 am

12. Verify your account. I'm pretty sure I read somewhere that you get additional 10 events when your email is verified, but this hasn't been activated yet.
Follow my progress on Twitter
or in this thread Archer Devlog
B
37
S
15
G
17
Posts: 949
Reputation: 12,295


Return to General Discussion

Who is online

Users browsing this forum: wiverson and 0 guests