Provinces from PNG-file

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
Nordbjerg
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 8
Joined: Sun May 27, 2012 5:00 am

Provinces from PNG-file

Post by Nordbjerg »

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. ;)
User avatar
k1net1k
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 563
Joined: Sun Nov 07, 2010 2:58 pm
Contact:

Re: Provinces from PNG-file

Post by k1net1k »

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
Nordbjerg
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 8
Joined: Sun May 27, 2012 5:00 am

Re: Provinces from PNG-file

Post by Nordbjerg »

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?
User avatar
k1net1k
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 563
Joined: Sun Nov 07, 2010 2:58 pm
Contact:

Re: Provinces from PNG-file

Post by k1net1k »

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')
Post Reply