Ways to represent/store different regions in a non tiled map

I am developing a game where agent tribes fight each other for land.The map is a 2D map.Each agent has an instance of group object that represents their family.And each group object contains information about the tribe.

Now the issue is how to store and represent the area each tribe owns.I was thinking of something along the lines of having the land split into own-able tiles of land and then having an ArrayList of Dimensions representing the region (width,height) and also storing positions alongside in order to know where the region starts from..Now the way tribes gather the land owned is as follows:

1. If the current square that agent is on is free then take the land
2. If not then if the current square is occupied try to fight it off from the other agent group

Now please note that actual agent movement is not based on tiles therefore I am not sure if my idea of representing the own able land as tiles is good for this.

So I am seeking on advice from anybody who has had a similar problem to deal with or have good ideas that they can share.

Also I am attaching an image to better explain my situation.

NOTE: The rectangles of different colours represent the areas owned by the agents whereas the circles in different colours are the agents themselves.

-
It sounds like your method could work. If the agents move onto multiple "tiles", then you could just trigger each of these tiles for the take/fight action. Though, instead of having an arraylist of dimensions, you could just have each "tile" contain an owner ID that starts as NONE and is assigned to whichever agent walks over it. – Gigggas Feb 4 '13 at 3:49
Hey, seems as though no one is trying to help you I will... Ok so how are you retrieving the tile that is being walked on? Are you drawing your map with a 2d array of tiles? If you were then you could store the xTile and yTile that the agent is standing on into a landOwner array and then cycle through that array placing 30% transparent coloured tiles on top of the tiles to represent the owned tiles... It's a bit hard for us to try and help you because there is no code for us to look at... And this site is bad because if you post lots of code everyone -1's you... – Savlon Feb 4 '13 at 4:00
Thanks for help guys, um the map is not tile based and agents can move in any direction which is denoted by its velocity vector. However for the land owned I was thinking of making it tile based where initially I would store a whole array of empty tiles where then agents occupy them as they step on them but again agents may not step on a new tile each time they move as the movement is not tile based :/ – Tohmas Feb 4 '13 at 12:10

Could you please tell why you need to `store and represent the area each tribe owns`? Because I don't think it's necessary.

Simply put, you can just have a regular TileMap (some sort of 2D array), with each tile having an attribute 'ownedBy'. I think you don't actually need to have a datastructure which would represent all tiles owned by a certain group, because the 'ownedBy' attribute of a tile solves many issues:

• Rendering is simple, just iterate through all the tiles and check what color they should be. You can add fancy borders (like in your image) by checking the neighbours of each tile.
• Fighting over land is simple, since you're only interested in that one tile that the combatants are standing on (or maybe also it's neighbours).
• Score calculation is also simple, just iterate over the whole map and sum up how much every team owns.

So I think the simplest solution has you covered :) Unless I'm missing something.

Now, the other issue - `actual agent movement is not based on tiles therefore I am not sure if my idea of representing the own able land as tiles is good for this` - this is not really a question about code organisation, but a question of visualisation. The same underlying data - that is, the tiles - can be displayed in different ways:

• With sharp borders and sharp corners, like in your example
• With sharp borders, but curvy corners - you try simple rounded corners (like the paint rectangle tool can do), or you can try getting fancy with Bezier curves.
• With fuzzy borders, but sharp corners - just put an alpha-map on the edges. You'll get something akin to tile transition techniques like this one.
• With fuzzy borders and curvy corners - some combination of the former two techniques. Get creative :)

If you find that it still looks like you're using tiles, maybe smaller tiles would help. Although you might need to implement fighting for many tiles at once if you make the tiles too small.

-
I like how you made it look simple , I guess I was over-complicating things a bit. I may actually make the tiles the same size as the agents so each time they step on a tile they trigger fighting or just take the land if its free. – Tohmas Feb 4 '13 at 12:18