Jump to content
GameDev.net Posting Guidelines (please read before posting)
For Beginners Forum FAQs (please read before posting)
Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 14 November 2012 - 01:23 PM
Posted 05 December 2012 - 04:14 PM
Want to get to know my work and I better? See my website: Au 79 Games
Posted 05 December 2012 - 04:55 PM
Posted 06 December 2012 - 01:36 AM
Below is the screenshot of zoomed in map from EU3 game. This filter is political so it shows you countries. There are dozen filters that paint the map differently depending on what you want to see. For example Terrain map, Rebel risk map, Holy roman empire map, Economy map etc.
I'm not sure if I understand your question. If you can, post the "huge map". That will make it a lot easier to see what you are wondering about.
Posted 06 December 2012 - 02:11 AM
Edited by Cdrandin, 06 December 2012 - 02:11 AM.
Posted 06 December 2012 - 02:29 AM
Well, in this game the problem is not in checking collisions because there are not too many objects moving around. When enemy armies are in the same province the battle commence and that is all. Much of it is just abstracted, there are no bullets flying, just my attributes vs your attributes + - some other modifiers and die roll.
Aren't pixels essentially very tiny "tiles". Looks to me those irregular lines are just tiled in probably, but could be yet very inefficient. My guess, check collision in between these countries, at the point of collision place a tile and I guess do it for all edges then have it anti-aliased to make it look smoother and there is your outline i guess. I wouldn't know, but would be interested as to how to get that feature working.
Posted 12 December 2012 - 03:02 AM
Posted 12 December 2012 - 08:38 AM
Posted 12 December 2012 - 01:45 PM
Why not define provinces in terms of polygons? Sort the polygons spatially in some way and then a point-in-polygon test to determine exact polygon that's been selected.
This has some advantages:
- Your artist could create any kind of map with any kinds of colors and details on it. An editor could be used to draw out the borders of the provinces. No requirements would be placed on the map, so your artist could add trees and other fine details without issue. This also means you could release the editor to your players and have them create their own maps easily if they wanted.
- You could easily determine which provinces are attackable from a given province based on which edges are shared. This would additionally make it easy to draw those attacker arrows, since you would have well-defined edges and could select the most visually appropriate one pretty easily
Boost has a really nifty Polygon library for C++ that would make this a snap. I'm sure Python has something similar you could use.
- Territories can be any shape (as long as the polygon isn't complex) and border any number of provinces (or none--say, an island)
- Those overlays based on territory, economy or what have you would be really easy to implement. Just overlay a translucent filled polygon on each territory. You could also use the province's polygon to clip drawing on that province -- say, if you wanted to draw a texture on it.
Posted 12 December 2012 - 02:04 PM
Posted 12 December 2012 - 03:31 PM
It's a matter of performance. You don't want to try to draw every province, army, arrow, etc every frame. Instead, you want to draw what the user can see. You're already on the right track: calculate axis-aligned bounding boxes and then sort them with some simple algorithm. Then, you can query your sorted bounding boxes to see which polygons lie in an area. You'll end up using this for a lot of things: for instance, in addition to rendering you could also use it to narrow down possibilities for which province was clicked, or have the AI use it to determine how many hostile armies are within range of a given province, and so on.
Uh, I am note sure what you mean with "Sort the polygons spatially in some way"? You mean drawing polygons one by one? This might be what they do cause there is a file that represents rectangles that define extreme borders of the province in question (left, top, bottom, right). In this way they know where to draw the province although I have not seen single province images. They might acquire them from the big map or somehow?
You use your editor* (that you'll write to work with the game) to place provinces wherever you want. You would have two files: 1 is the map, which could be just a simple BMP. The second would define vertices that make up the provinces and possibly contain any particular details (for instance, starting points or region wealth or city locations, whatever features your game has) that can be changed via the editor.
I cant imagine an editor with indenpendetly drawn provinces? How do you control their precise position on map?
That works. You could have the editor define that for you, or have the game engine figure it out while loading the map to make things a little more automatic. Either way.
All adjacent provinces are kept in a file similar to the one I described for hit testing. There is a province Id, followed by ids of adjacent provinces so its easy to know where you can go.
You could probably come up with your own solution pretty easily. I was getting ahead of myself and thinking about the editor automatically filing in oceans and unused areas, or randomly generating a set of provinces on any given map. A way to define polygons and a function to check if a point is inside any given polygon is really all you need or want at this point.
I am not sure if Python has such library, I am even not sure can it be done in Python? But I need some more info about substance of working with maps like this one.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.