Sign in to follow this  
AoS

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

Recommended Posts

AoS    935
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.

Share this post


Link to post
Share on other sites
Stormynature    5198
Dijkstra's algorithm
[url="http://en.wikipedia.org/wiki/Dijkstra"]http://en.wikipedia....#39;s_algorithm[/url]

Shortest path problem
[url="http://en.wikipedia.org/wiki/Shortest_path_problem"]http://en.wikipedia....st_path_problem[/url]

Pathfinding
[url="http://en.wikipedia.org/wiki/Pathfinding"]http://en.wikipedia....iki/Pathfinding[/url]


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 :) Edited by Stormynature

Share this post


Link to post
Share on other sites
AoS    935
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.

Share this post


Link to post
Share on other sites
Acharis    5979
[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.[/quote]A*. It allows to take into account terrain cost.

Share this post


Link to post
Share on other sites
AoS    935
[quote name='Acharis' timestamp='1341170922' post='4954617']
[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.[/quote]A*. It allows to take into account terrain cost.
[/quote]

The engine uses A*, not sure how it interacts with the tilesets though.

Share this post


Link to post
Share on other sites
6677    1054
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this