Game
The Cardinal Crusade
7 years ago

Technical Devlog: Custom Timelines


Hey, welcome to a technical devlog for all you people out there who like to read about code! Wait, most player’s don’t like reading about code? Too bad because I like writing about code!

What you talkin’ ‘bout?!

Today I’m talking about a sweet new framework I made for dealing with more complex enemies and systems that revolve around state machines in an easier to manage way.

Please keep in mind this game is made in Game Maker. So I’ll be using Game Maker terminology.

What’s a state machine?

A state machine is as it sounds. A machine that runs based on states. Typically these machines run in one state at a time. They do a thing while they are in a state, then they change states and do a different thing. It’s a pretty common way of programming and works well.

K, so what’s this framework thing?

Well to answer that I first have to describe the issue I sought out to solve; and to do that I have to talk about Game Maker’s “Timelines”.

In Game Maker, a timeline is a resource type that allows you to set up timed code. You add a time to the timeline, then you give it some code to run at that time. The timeline automatically and continuously counts up until it reaches the latest time you’ve added. It’s a good way of creating sequential actions. They are also really useful for making state machines because you can repeat a single time by changing the time index of the timeline. This effectively allows you to treat each “time” or step, as a state. This is something we do in most of the enemies in The Cardinal Crusade. So that’s a basic summary of normal timelines.

The problem is that you can only run one timeline at a time within any one object. So if we wanted two sequential actions to happen at the same time. Aka, run two states at once. We can’t do that or at least not neatly. At first this was fine and I found a work around every time. I simply didn’t use timelines for the more basic tasks. This new boss however required a fair bit of sequential steps to be happening at once and the code was getting really messy, really fast.

The solution (The Framework)

The solution to our problem was to build a framework which effectively emulated the standard Timeline system in Game Maker; but without actually using timelines. See if it’s not technically a Timeline I can make the code do whatever the hell I want. So that’s what I did.

I made a framework which allows me to set up a virtual Timeline, and add scripts to certain time steps within those virtual Timelines. They can do everything a standard Timeline can do but I can run as many as I want.

For this boss we have a timeline for each cannon, timing the cannon shots, getting hurt, and more. I can turn these on and off in a single line of code at any time. The code for the boss is now WAY neater, easier to follow, easier to debug and simply better all around.

Best of all, as this is a framework I can use this at any point in this project. For example future bosses. I can also import it into a different project and use it there too! It’s very cool.

That is all.

So that’s about it for this devlog. I dev’ed a cool thing which allows me to dev more cool things; and I think that’s cool :)

Thanks for reading!
Let me know if you like technical devlogs by choosing a pole option below. If it’s mostly yes I’ll write them more often. I like them :)

  3 votes Voting finished



1 comment

Loading...

Next up

Hi all!

A huge thanks to everyone who has played and left feedback for Eldritchvania so far!

This first update is all bug fixes and you can see exactly whats been fixed in the article below.

The Control update!

We've update the controls in Eldritchvania to make it more enjoyable.

Check the article for details!

Joining the 10Y club

The Cardinal Crusade Demo release!

We took @Benallen 's suggestion and improved the map view even more by changing the colour of rooms you've entered, further clarifying where you've been so far; and thus where you might want to go next.

#Eldritchvania

A transformation Hello, in this devlog we’re showcasing an animation where the player character transforms into a smaller, flesh monster. Why is this in the game? What purpose does it serve? Perhaps more will be revealed soon…

Post demo update!

Development Streams!

Devlog: Behind the scene look at: The Brain Blaster enemy