Discord Discord

GitLab GitLab

Engine Updates

December Engine Updates

Tue Dec 12 2023

Darkan has always had a WorldTask class which scheduled code to run every tick. You could just append code to the world task, and it would run the next tick for the entire world.

Once the world shut down all tasks would end and would have to be re-run next restart.

You create code for future ticks on the server like so…

Here we add code to run every tick. On the 1st, 3rd and 9th tick we can run different code.

Notice how on the 9th tick we stop the task from running different code every game tick.

If we did not stop it, it would run until the world server stopped.

This is called a leak.

For many months Trent wanted to implement a better task system. One based on entities.

Finally, in the past few weeks it was implemented. We can now add tasks to entitles instead of the entire world.

Take a look…

We now have code injection into every tick of the entity, Queen Black Dragon.

This can be applied to any player, NPC or boss.

The task ends when the entity or player dies or is told to stop. Cool right?

World Persistent Data

In September Trent added persistent data for the world itself. 

It is saved here…

In the data folder you can now programmatically save data across world reboots without saving to the database.

Here is a simple example incrementing cow kills in the world.json…

Pretty cool right?

Force movement fix

For a few years now Darkan had a bug which was not addressed.

Due to a bug with forcing movement the right way, doing so was done the wrong way.

It worked and looked good for many years, yes.

But this wrong way produced strange issues which could not be adressed with much research.

Remember the Armadyl crossing issue which we struggled with for years? 

This one…

Well it was finally fully fixed.

It was some super esoteric Matrix bug which did not check the tele.type.

Here is the fix…

The reason it is worth mentioning in a blog is its widespread use in the game from agility shortcuts to just plain walking.

Many bugs are fixed by this and developers now have a consistent way to force npcs, players and bosses to move.

This section of code is used everywhere and finally after all this time it was fixed and done properly.

The engine is now more powerful…

Cheers! 🥳