Hello Chaos Rift!
I am thinking about creating a small grand strategy game where the map is seperated into provinces, much like in Paradox Interactives titles. I would like to get the shape and the color of my provinces from a PNG-file. The color will then be linked to a province ID which is used internally in the game. Do you have any suggestions on how to do this?
Also, I am going to use SDL for this project.
Thank you in advance.
Provinces from PNG-file
Moderator: Coders of Rage
Re: Provinces from PNG-file
you could make terrain based off perlin noise or heightmaps etc, or you can manually draw them out where different color pixels generate different terrain
Re: Provinces from PNG-file
I'm sorry if I was not clear enough. I am not looking for a terrain generation method, rather a way to load in my terrain from a PNG-file, like in Victoria 2 or Hearts of Iron 2. The provinces are represented in the PNG-file by their shape (e.g. the shape of Denmark) with a unique color. The engine then loads in the color and the shape of the province from the image, which it can use later for referencing what the name of the province is, it's population and so forth.
How would I go about loading the provinces from the PNG-file (shape AND color) into my game, for later use, like in my example above?
How would I go about loading the provinces from the PNG-file (shape AND color) into my game, for later use, like in my example above?
Re: Provinces from PNG-file
well do you want then scaled up or down from the source pngs, if not jsut use a 1:1 grid per pixel and make it from that.
either way that you do it, you might need to look at some 'nearest-neighbor' type of thing to get smooth transitions from coastline to ocean (if its tile based you might be able to get away with a single tile sized 'transition-tile')
either way that you do it, you might need to look at some 'nearest-neighbor' type of thing to get smooth transitions from coastline to ocean (if its tile based you might be able to get away with a single tile sized 'transition-tile')