ECS Quest: Part 3

Three days in a row! How about that! But tomorrow’s the dreaded Monday, so… anyway, I’m actually gonna keep this brief because… yeah, tomorrow’s Monday, so…

Today I realized that I didn’t have proper runtime debugging set up; that’s a pretty big no-no. I poked around with FlashDevelop some but ended up being able to at least get things running by selecting my built .swf and opening it with the Debug Flash Player. I have a feeling FlashDevelop has a more elegant way of doing it but for now the process is only slightly more painful with just a few clicks. It’ll do.

On a more positive note, I made another interesting realization about something you can do with an ECS: just how useful “delayed” system functionality is. In an ECS, systems typically run in a linear fashion, ordered by the priority they have. Makes sense: you wouldn’t update the sprite positioning system before updating the physics system first, right?

Sometimes you may know you want to do something based on the conditionals you just checked but you haven’t yet derived all the data necessary to do it. In object-oriented programming, this could cause you grief. Calling a member function that immediately calculates things won’t do if the data isn’t ready. You could set flags or something, and that definitely can work, but…

When you work with systems under the right circumstances, so long as the proper components are initialized (they exist but don’t necessarily have filled data fields,) you can forward them to the systems anyway; just make sure their fields get filled before that system gets reached in the execution order. It something so simple, yet so profoundly incredible (to me, at least!) And its a near seamless perk that comes with working with the ECS. Just queue it up and keep firing through code.

So there’s a nugget of information for you. Well, Monday is approaching (and Ludum Dare is on the horizon too,) so time to jet. Later.

Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: