Discussion About How To Design Walker/Transport Units In City Building Game

Started by
4 comments, last by 6677 11 years, 9 months ago
Since my new game has quite a bit of city builder/sim economic systems in it, I was wondering about the best way to set up the way the unit deals with moving from storage to production building automatically and back.

Currently here is the way I have it set. The units that transport materials are not constructed directly at the production facility. Each construction facility can create the unit to do the producing, up to however large the employee cap is. But a separate facility creates the unit to move resources to and from the storage structure.

I was thinking that the basic house could be used to assign the transport unit. You would just construct a general laborer unit. Currently you can assign a unit a storage structure and production structure. Then you hit the transport command and set the unit on its way. You can assign the same transport unit to a new storage or production structure at any time. This is part of the way you manage resource production, you can change how you assign the resource carriers to increase and decrease production of specific resources.

Originally you just have a person carrying materials, later you can research and produce various vehicles to be pulled by a person, or you can breed animals to increase the movement speed. You can also build roads.

I am still working on how to get units to go on a road if it is faster. Since units are not confined to roads and roads actually have to be constructed and can be improved, units won't always take the road.

I was thinking I could program some sort of check using the distance by road and the units move speed vs a straight beeline across open ground.

Anyone have any thoughts? How would you design the road/walker system.
Advertisement
Dijkstra's algorithm
http://en.wikipedia....#39;s_algorithm

Shortest path problem
http://en.wikipedia....st_path_problem

Pathfinding
http://en.wikipedia....iki/Pathfinding


Issues you can run into.

No path available - The transport unit cannot reach the goal as there is no route possible
Broken path -- you built something right smack in the middle of a route being taken
Character collision -- your transport units cannot phase through each other and bounce against each other creating traffic jams
Vertiexes and nodes are poorly implemented/mapped resulting in unusually annoying routing -- Why for the love of god is my npc walking through an enemy camp!!!!!!!!!!!!!

Needless to say: simply defining values on speed/time/available paths can be implemented -- but I would love to see a routing system that also reflects "Danger Will Robinson! Danger!" as a value associated in routing as well other issues -- for example -- rich folks not walking through slums i.e. using social values as well or in the case of transportation -- trucks not being able to cross over a bridge that can't take the weight of the transport unit. Hope this helps :)
The pathfinding is mostly already done and works fine. It just doesn't account for roads yet because they haven't been implemented in the engine. Most games in the city building genre with roads only allow units to move on roads, unless they are a special type, so my problem is hard to solve compared to that.

Also I was more concerned with what management system would be most appealing.
I am still working on how to get units to go on a road if it is faster.
A*. It allows to take into account terrain cost.

Stellar Monarch (4X, turn based, released): GDN forum topic - Twitter - Facebook - YouTube


[quote name='AltarofScience' timestamp='1341125337' post='4954446']I am still working on how to get units to go on a road if it is faster.
A*. It allows to take into account terrain cost.
[/quote]

The engine uses A*, not sure how it interacts with the tilesets though.
Every tile you add a movement penalty, this penalty you take into account on the shortest route calculation, a road might have a penalty of 1 and grass a penalty of 15. the movement should then hopefully stick to roads.
You don't necessarily have to actually use the penalty to slow the unit but it might help your path finding.

This topic is closed to new replies.

Advertisement