amiga-news DEUTSCHE VERSION
.
Links| Forums| Comments| Report news
.
Chat| Polls| Newsticker| Archive
.

[Login] [Register] [Forgot your password?]

< Next messagePrior message >
27.Apr.2023
TheoTheoderich


Developer diary: "Settle the World" 04/23
Christian 'TheoTheoderich' Wiegel continues to work on his turn-based building and trading game "Settle the World" (amiga-news.de reported). His latest developer diary entry is about the implementation of the wish expressed by players to be able to send units directly to a specific city:

However, the integration of this function turned out to be much more difficult than expected!

If you want to send a unit to a certain city, this means that there must be a list of the cities that can be reached. But how is this list created? Pathfinding to all of your own cities is impossible, as it would take far too long on the Amiga. I then asked myself how this function works in the games "Colonization" and "Civilization"?

I found out that the different land areas on the map are marked as "continents" (screenshot 1). All contiguous land areas are one continent each. Since land units cannot easily move over water, only cities that are on the same continent as the selected unit can be targets.

Unfortunately, I could not find out how the continents were determined in these old games. Therefore I found my own solution. In AmiBlitz 3 there is a function called "Flood-Fill". This function colours all contiguous areas of one colour. When creating the map in "Settle the World", each land square now gets a continent start value. Then all the squares on the map are scanned. If the square still has the continent start value, the function "Flood-Fill" is applied to this square and colours all squares on this continent in a one random colour. The colour number is then the new continent value. This is done until no square has the start continent value and every land square is assigned to a continent (screenshot 2). This process is repeated again for ocean fields (screenshot 3).


In order to obtain a list of the cities that can be reached in the game, all the player's cities must be scanned in a loop and it must be checked whether these cities are on the same continent as the selected unit. In addition, the distance to the cities is determined by a simple distance check ("as the crow flies"). Cities that are outside the pathfinding range are not listed (screenshot 4).

If the player now selects one of the listed cities as a target, the pathfinding of the unit starts in order to determine a way to this city. If the selected unit is inside a city, it is automatically moved out of the city. This new functionality is very usefull in mid- and late-game to reduce micromanagement.


(dr)

[News message: 27. Apr. 2023, 05:53] [Comments: 0]
[Send via e-mail]  [Print version]  [ASCII version]
< Next messagePrior message >

.
Masthead | Privacy policy | Netiquette | Advertising | Contact
Copyright © 1998-2024 by amiga-news.de - all rights reserved.
.