Sub's coding pool party

Super elite
✔️ HL Verified
Joined
Jul 16, 2010
Messages
516
Best answers
0
Location
Canada, ontario
Those pictures looks like the Earth's background Sub.



---Edit----

OH it is!!! are you trying to make the birds eyeview?
 
Last edited:
NOT IN THE MANGA™
★ Black Lounger ★
✔️ HL Verified
🚂 Steam Linked
💻 Oldtimer
Joined
Jan 5, 2008
Messages
3,276
Best answers
0
Location
Lithuania
Those pictures looks like the Earth's background Sub.



---Edit----

OH it is!!! are you trying to make the birds eyeview?
 
Active Member
✔️ HL Verified
💻 Oldtimer
Joined
Mar 14, 2005
Messages
3,880
Best answers
0
It's coming along quite fine! Can't wait to see the final outcome of this.
 

sub

Active Member
💻 Oldtimer
Joined
Jun 18, 2003
Messages
5,961
Best answers
0
Location
New York
Those pictures looks like the Earth's background Sub.



---Edit----

OH it is!!! are you trying to make the birds eyeview?
I'm trying to make a game that can best be compared to the civilization games. Basically, it's a turn based strategy game where you start out as a very small tribe of people in the year 4000 b.c. You then create a city, and with that city create military units, research technologies, build more cities, explore the map, war with / ally with other nations, and generally just progress through history trying to build an empire.

The problem is that I'm about as far from an artist as one can probably get, and I'd like for the game to have a bit of a unique look. I actually would love to ditch the isometric perspective and instead go with very very small squares. Squares would gradually change color as you go into different terrain types and you could have large swaths of grassland seamlessly integrate into like plains or whatever. This would give it a bit of a more unique look and feel, but I don't know how well rendering thousands of tiny 5x5 rects would go performance wise.

Maybe tiles of roughly this size http://tinyurl.com/a9duag5
edit: screen size is 800 x 600 at the moment, so that would be like 96,000 open gl calls for drawing a rectangle. Anyone have any idea if there's a way to draw them all in one call like you can with lines segments?

edit: Maybe make a bitmap in memory and transfer the rects to that? I really have no idea.
 
Last edited:

sub

Active Member
💻 Oldtimer
Joined
Jun 18, 2003
Messages
5,961
Best answers
0
Location
New York
I'm still trying to generate good and interesting looking worlds. Right now trying to get some different tile types in such as ice and shallow water, this is the first pass at that. Still needs a lot of work really. In terms of landmass shape, I need to work on that a little, it doesn't produce great continents anymore with the smaller sized and larger number of tiles. Also, ignore the 18 FPS.

http://i.imgur.com/5DENl.png

 
Last edited:
Death from Above
✔️ HL Verified
🚂 Steam Linked
💻 Oldtimer
Joined
Nov 25, 2001
Messages
4,943
Best answers
0
Location
Get off my couch
I think it looks pretty good

But like you said maybe try and work on getting some larger more grouped together land masses

Also, what happened to your space project?
 

sub

Active Member
💻 Oldtimer
Joined
Jun 18, 2003
Messages
5,961
Best answers
0
Location
New York
Also, what happened to your space project?
I still think it would be the greatest game ever, but I'd like to get a better at programming before trying that one. Turn based strategy games don't really need any fancy shaders, collision detection, particle effects, or anything along those lines. The only thing that I'm not sure how well I can do for the current project is the AI, and learning how to do that actually seems kind of fun to me. I'd also like to have one biggish project behind me before starting it, because I want to do it right. Maybe the space one will be next.
 
Death from Above
✔️ HL Verified
🚂 Steam Linked
💻 Oldtimer
Joined
Nov 25, 2001
Messages
4,943
Best answers
0
Location
Get off my couch
Ahh so the space one is your baby and you want to practice on an adopted baby first
 

sub

Active Member
💻 Oldtimer
Joined
Jun 18, 2003
Messages
5,961
Best answers
0
Location
New York
Yeah, something like that. Plus, this is a little bit more defined in my mind. I've probably played about every game in the 4X genre, I think I have a good idea on the underlying rules and mechanics. I've been playing Civilization II for more than 10 years now, as well as played a bit of Civilization III / IV / V, Alpha Centauri, Galactic Civilizations II, Call To Power I / II, Masters of Orion II, Endless Space, Space Empires IV, Rome/MedievalII/ShogunII Total War, Sins of a Solar Empire, Europa Universalis III (although this one was a little too intense I think), etc.

Also comes out of me feeling that the newer games in the Civ series are good, but I think they lack the huge empires you could get in Civ II. In Civilization V, you can have 6 cities and that might be considered a big empire, where as that would be really small in Civ II. I want to try to recreate Civilization II, but add in well defined national borders that the AI respects. I also want to make it less mathematical -- there shouldn't be one formula for placing cities in optimal positions for any given map, the nature of civilizations should be a bit more dynamic, there should be more Civilizations on the map, civilizations should collapse and revolt and not be static empires for 6,000 years. We'll see how that goes...
 
Last edited:

sub

Active Member
💻 Oldtimer
Joined
Jun 18, 2003
Messages
5,961
Best answers
0
Location
New York
I actually want to finish this in a reasonable amount of time, which means that I'm going to bring it back to being more traditional. Back to the isometric tiles and heights, back to figuring out how to assign heights on the map and have it look reasonable. I've been spending some time looking at Alpha Centauri maps, and it looks like tiles in that game have no height, the corners of tiles have the height, so I switched it to work like that which honestly makes the code a lot cleaner.

It probably goes without saying but any point of a water tile must be the default height of 0.
The height of each point probably has to either the same or +/- 1 of each of its neighbors, although it looks like alpha centauri might be +/- 2?

Because of that, you can't just pick a tile at random and assign it a height value as you please. I'm thinking you have to pick a land tile at random, pick a corner of that tile at random, ensure that it's not also the point of a water tile, and then that will be the tile to start modifying. Make a counter, then look at each tile that connects to this point. If those points are also not water tiles (or edge of the map, I guess), then add 1 to the counter and look at the neighbors for each of the tiles that you just checked out. Repeat this until you hit water, and then assign the starting point to this height, as that's the highest it can possibly be according to the previous 2 rules. Then decrease this value by 1 and assign each of the neighboring points that value, etc. until you hit the water.

That will give you a square mountain with a top (I guess you could - 1 from the starting point to make it a flat top), but this isn't really good for making interesting maps. I'm really not sure what to do to be honest.

Spent a minute trying to visualize what that would do. The point in the middle would be assigned a 2, the 1's would be a 1, and the 2's would be 0's.


so this is a screen of some raised land in alpha centauri just to have a reference
 
New Member
Joined
Nov 24, 2001
Messages
692
Best answers
0
Perhaps start with all corners at height 0, and keep a list of corners that are locked and will no longer be heightened. Start with locking all water corners. Then iterate over all unlocked corners and randomly either heighten a corner if allowed (i.e. this will not make it 2 higher than any of its neighbors) / do nothing if not allowed, or lock the corner. Repeat until all corners are locked. You can optimize this a bit by also locking the corner if raising it is no longer possible (i.e. raising will make it 2 higher than a locked neighbor). Not sure if that will result in anything interesting though.
 

sub

Active Member
💻 Oldtimer
Joined
Jun 18, 2003
Messages
5,961
Best answers
0
Location
New York
Thank you Harsens, greatly appreciate the help. I finally had a chance to code it and test it out and it seems to produce some reasonable results that are in line with what I was going for. I feel rather stupid for not thinking of it.
 
Last edited:
New Member
Joined
Nov 24, 2001
Messages
692
Best answers
0
No problem, it's an interesting problem to look at. The key is to start from the locked corners (and the very concept of corners being locked), rather than toy around with the 'free corners'. Flipping around problems like that is a trick you can very often use :) Also, you probably already got this, but you can use the random factor as a hilliness control knob.

Any pics?
 

sub

Active Member
💻 Oldtimer
Joined
Jun 18, 2003
Messages
5,961
Best answers
0
Location
New York
Yeah, locking certain corners when a condition is met is definitely key, but I didn't even think to iterate over every point. I didn't have a list of points, I had a list of tiles which each contained four points.

In my mind I was trying to think of a way to pick a random corner, make it a random height (although the max possible value of that height would be determined by how close it was to the water) and then have it spread sort of like a virus or chain to the surrounding points, decrementing at random. Much better and easier your way.

The reason I didn't post a screen is because it still needs a lot of work, but I guess posting a picture can't hurt.



Instead of the height being +/- 1 of its neighbor, in that screenshot it's +/- 3. To make that not look ridiculous I reduced the yoffset for each height number, the yvalue of a point was being raised by 10 for each height value it had, now it's only being raised by 3. I also capped it off at 4 being the max height possible to assign. It might look better being +/- 1, though, I think it needs to be smoother.

I'm not sure if I should make the tiles sprites or have some sort of lighting like I was originally going to do. After I get this working a bit better that's what I have to decide.
 
Last edited:

sub

Active Member
💻 Oldtimer
Joined
Jun 18, 2003
Messages
5,961
Best answers
0
Location
New York
Here it is a bit smoother. I took off the height cap, I don't think it was needed.

In these screens the chance to lock a tile is at like 5%, and it's allowed to have a 3 or 4 height difference between neighboring points. Surprisingly this results in smooth terrain, which makes me think I either am misinterpreting what should happen, or I somehow messed up implementing it. Either way, here are some more screens





The height is pretty evenly distributed across the map. It might be better to have a higher chance to randomly lock for a patch of some tiles, and a lower chance to randomly lock for a group of others.
 
Last edited:
Active Member
✔️ HL Verified
💻 Oldtimer
Joined
Mar 14, 2005
Messages
3,880
Best answers
0
Looking good looking good! Did you ever figure what you were going to use for the pixel sizes and such?

And the FPS supposed to be that low?
 

sub

Active Member
💻 Oldtimer
Joined
Jun 18, 2003
Messages
5,961
Best answers
0
Location
New York
FPS is low because I am on a rather terrible laptop, and I haven't even attempted to optimize it. Not that I know anything about optimizing, but you can check if a tile is on the screen before drawing the geometry / lines, and you can also draw things in batches, neither of which I'm doing. What that means is that instead of a few draw calls to the gpu, it currently has one for each tile, and there are 2750 tiles. When it was going to be top down I had it in, because there were like 400,000 tiles at that point, but I have to copy/paste that back in since I reverted back to an older version when I made the change back to isometric; when I get around to that I think it will be fine. It also is a debug version, I think if you compile on release mode it is faster, although I have no idea how much that would effect things here, probably not much at all.

The small tile size thing was because I was going to make the thing top down rather than isometric, but I'm not doing that anymore. :p
 
Last edited:
Active Member
✔️ HL Verified
💻 Oldtimer
Joined
Mar 14, 2005
Messages
3,880
Best answers
0
Ahhh Alright. Can't wait til you get a playable version up and running. Wanna see how this turns out for your first game. :p
 

Users who are viewing this thread

Top Bottom