🤑 Indie game store🙌 Free games😂 Fun games😨 Horror games
👷 Game development🎨 Assets📚 Comics
🎉 Sales🎁 Bundles

Orc Colony

Take command of your first colony as an orc prince. Dig, Build and expand your colony deeper underground. · By Luzon Game Dev

Porter's run like crazy

A topic by LiraLeo created 5 days ago Views: 46 Replies: 2
Viewing posts 1 to 3
(Edited 1 time)

Very nice game so far, good luck with updates.
I noticed that orcs would skip eating at their own floor if the room was (directly) across an elevator shaft, and would instead take the elevator to another floors dining room. Which was further away, and also caused them to occupy an elevator car.
Also the Porters are running all over the place, some might be running empty through several elevator rides all the way down, while another empty one comes up from that location all the way up to do something there.

Developer

Right now, the Eating/Sleeping/Porter's Tasks priorities are based on tiles closest to them, even if its on a different level, very simple but its fast. It should be the closest in terms of how many tiles the orc/goblin walks to get there. So an orc will choose a dining room seat directly two floors up instead of a dining seat three tiles to his left. Currently working on optimizing a good path-finding AI that will not lag the system when a hundred or more units are looking for their closest possible destination.  

Sometimes the orcs will miss a dining room seat / bed close to them because another orc already claimed it and is in the process of getting there. 

Thanks for playing and the feedback!

For what "path-finding AI" goes, then look up "Dijkstra's algorithm".

Dijkstra's algorithm is the #1 in games for path-finding!

Dijkstra's algorithm may seem to a bit overkill at the moment, but... On the other hand... Further add-ons to the game can quickly increase the complexity of path-finding!

Already now: There are differences in horizontal and vertical movement speeds, goblins run faster than orcs, but when they are in elevators they move at the same speed.
That is enough for that the fastest route for an orc can be different from the fastest route for a goblin!

---

Even Dijkstra's algorithm have its limitations: It is not designed to find the fastest route to a moving target.

That is difficult, as it require to know where the target is when arriving, but to calculate that, it is needed to know at what time the arrival occur.
So: The destination location depend at arrival time - and - arrival time depend at destination location!

It have been proven that such a problem have no mathematical solution!
But... for computers "numerical algorithms" can do it.

Already now there are such moving targets: The elevators.
Fastest route can change depending at where vacant elevators are!

And it can become even more complicated yet: When do the elevator start moving to get to the floor where the goblin will board it?
When the goblin reaches the elevator shaft? Then the goblin have to wait for the elevator, slowing down the goblin.
Or
When the goblin start its journey? Then the elevator have to wait for the goblin, slowing down other users of the elevator (Who could have used it in the mean time).
Or
At the proper moment, so none of them have to wait for each other!

The question arises: What is it we are trying optimize? Elevator movement? Or Goblin movement?
It turns out to be none of them!
It is the goods they carry we wish to get moved around as fast as possible!

So instead of using those algorithms at goblins and elevators, it make more sense to use them at the goods, as it is the goods that need to get around as fast as possible!
Goods waiting for a goblin, is of same computation complexity as a goblin waiting for an elevator!

I had a situation where an armorsmith and a weaponsmith was adjacent to each other, where the result was armor got produced, but no weapons!
The armorsmith could keep up with the speed at which ingots was produced, so no goblins did ever go the extra distance to get to the weaponsmith.

Perhaps it is not about moving things around as fast as possible, but as efficient as possible?
It is an interesting situation: Do we wish to develop algorithms so efficient that they can alleviate dumb decisions made by the player?