Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3 4

Author Topic: Yet another programming/game project  (Read 5075 times)

cerapa

  • Bay Watcher
  • It wont bite....unless you are the sun.
    • View Profile
Yet another programming/game project
« on: February 05, 2013, 04:14:13 pm »


I have embarked on a quest to create a 4x space game(with more emphasis on the first 2 x-es). Currently I only have a rudimentary terrain generator, which creates the terrain from simplex noise and then spreads humidity from the water areas, but I plan to add a lot more in the future, such as temperature. I will first do planet generation and only then worry about space.

Right now I dont have much else to show off, except for some bugs.
Spoiler: Bugs (click to show/hide)

It is programmed in C++ with SDL for display and input. Currently it takes around 3 seconds to generate terrain, but multithreading should speed it up considerably, as the main computational drain is blurring the humidity, which is just an absolute fuckton of individual calculations on every pixel, 282 million in total actually, if I did the math right. But I think the result is worth it.

And just to note, the map wraps left-right.
Logged

Tick, tick, tick the time goes by,
tick, tick, tick the clock blows up.

HavingPhun

  • Bay Watcher
    • View Profile
Re: Yet another programming/game project
« Reply #1 on: February 05, 2013, 05:17:52 pm »

PTW. The terrain looks very nice. How did you go about shading the terrain? Did you have each tile have its own color then blend it with surrounding ones? 
Logged

cerapa

  • Bay Watcher
  • It wont bite....unless you are the sun.
    • View Profile
Re: Yet another programming/game project
« Reply #2 on: February 06, 2013, 09:45:03 am »

There is no blending at making the picture. It simply converts the local height and humidity levels into a colour. Every pixel of the map is a:
Code: [Select]
struct map_point {
Uint8 height;
Uint8 humidity;
};
The shading is simply a result of the way the height is generated and the humidity is dispersed.

The tiles you see there dont actually exist yet, and are simply a superimposed grid. Its just for seeing what it will look like when I get to the point of actual gameplay.
Logged

Tick, tick, tick the time goes by,
tick, tick, tick the clock blows up.

GalenEvil

  • Bay Watcher
    • View Profile
    • Mac-Man Games
Re: Yet another programming/game project
« Reply #3 on: February 06, 2013, 11:08:20 am »

Spherical planets are a bit tricky but you should be able to get a rudimentary one displayable with some small tweaks to your current system. I would suggest using a Lat/Lon. map system for them and mapping that to coordinates on either a cube-sphere or onto a tessellated icosahedron. The cube-sphere is easier to get working but the LOD functions for it tend to cause odd bugs for me. A tessellated icosahedron has its own problems though, primarily LOD related: requires high tessellation to show 1m^2 area quads (depends a lot on your planet size), to the point that the LOD checks can become very processor intensive. There are a lot of LOD algorithms though, and several of them map well to spherical surfaces.

One of the interesting bits of information that I found when doing research for my own planet generator was that the Earth is actually less bumpy (on average) than a billiard ball once you account for scale. You can probably use the Cube-Sphere to great effect if you make the assumption that from far enough out the surface will look pretty much flat and just map your terrain's colors onto the surface and not worry about the elevation until the player is inside of the atmosphere and then use a chunked LOD approach to generate high detail areas only as needed.

Are you planning to have planets as player accessible areas to land/walk on? If not then you can forget about most of the LOD stuff I just listed off since it won't be as necessary. Also, is this going to be a 3D game? If not then definitely forget what I said since sprites and 2D object texturing does not require LOD for the most part aside from world/universe scale and local area transitions.

TL;DR: most of the above is unnecessary if you're planning for this to be a fully 2D game and only is really applicable for 3D :P
Logged
Fun is Fun......Done is Done... or is that Done is !!FUN!!?
Quote from: Mr Frog
Digging's a lot like surgery, see -- you grab the sharp thing and then drive the sharp end of the sharp thing in as hard as you can and then stuff goes flying and then stuff falls out and then there's a big hole and you're done. I kinda wish there was more screaming, but rocks don't hurt so I guess it can't be helped.

cerapa

  • Bay Watcher
  • It wont bite....unless you are the sun.
    • View Profile
Re: Yet another programming/game project
« Reply #4 on: February 06, 2013, 11:55:36 am »

Fully 2d for now.

The original idea was to have a tessalated icosahedron, but that flew out the moment I took a look at some opengl code and realized I have no business doing anything in 3d at the moment.
Logged

Tick, tick, tick the time goes by,
tick, tick, tick the clock blows up.

GalenEvil

  • Bay Watcher
    • View Profile
    • Mac-Man Games
Re: Yet another programming/game project
« Reply #5 on: February 06, 2013, 12:10:02 pm »

Okay :D thanks for the fast response on that. Have you ever played a game called Transcendence? It is a procedurally generated 2D universe and is pretty fun to play.
Logged
Fun is Fun......Done is Done... or is that Done is !!FUN!!?
Quote from: Mr Frog
Digging's a lot like surgery, see -- you grab the sharp thing and then drive the sharp end of the sharp thing in as hard as you can and then stuff goes flying and then stuff falls out and then there's a big hole and you're done. I kinda wish there was more screaming, but rocks don't hurt so I guess it can't be helped.

miauw62

  • Bay Watcher
  • Every time you get ahead / it's just another hit
    • View Profile
Re: Yet another programming/game project
« Reply #6 on: February 06, 2013, 02:16:15 pm »

I think there is some documentation on how KSP did 3d planets, from waay back. You could look into that. Not sure if it would help, but I'm just throwing it in here anyway.
Logged

Quote from: NW_Kohaku
they wouldn't be able to tell the difference between the raving confessions of a mass murdering cannibal from a recipe to bake a pie.
Knowing Belgium, everyone will vote for themselves out of mistrust for anyone else, and some kind of weird direct democracy coalition will need to be formed from 11 million or so individuals.

Mephansteras

  • Bay Watcher
  • Forger of Civilizations
    • View Profile
Re: Yet another programming/game project
« Reply #7 on: February 06, 2013, 02:18:04 pm »

Looks neat. Interested to see where this goes.
Logged
Civilization Forge Mod v2.80: Adding in new races, equipment, animals, plants, metals, etc. Now with Alchemy and Libraries! Variety to spice up DF! (For DF 0.34.10)
Come play Mafia with us!
"Let us maintain our chill composure." - Toady One

cerapa

  • Bay Watcher
  • It wont bite....unless you are the sun.
    • View Profile
Re: Yet another programming/game project
« Reply #8 on: February 06, 2013, 02:56:29 pm »

I now have temperature.
Spoiler: Winter is Coming (click to show/hide)
I dont have it quite how I would like it, mainly the fact that there arent any tundra areas yet. But I am very fond of the ice bridges that formed when I put the planets temperature way down.

The temperature system itself is fairly straightforward. Gets colder towards the poles and in higher areas. Will hook it up to humidity later, so planets without any water don't suddenly get snow.

Next up is plant growth, again a fairly straightforward system. Plants will grow up to a cap determined by both temperature and humidity. This is mainly for terraforming planets and to make it so you dont get plant growth on mars because there happens to be some water there. Plus the possibility of seeding the galaxy with barren planets that because of good natural conditions just need a single seed to grow into jungle worlds sounds cool.
Logged

Tick, tick, tick the time goes by,
tick, tick, tick the clock blows up.

Mephansteras

  • Bay Watcher
  • Forger of Civilizations
    • View Profile
Re: Yet another programming/game project
« Reply #9 on: February 06, 2013, 02:59:00 pm »

You should probably also put in some sort of atmospheric conditions, at least for earth-like plants. Trying to grow plants on a planet with a Methane atmosphere isn't going to work too well, even if the temperature and humidity is otherwise fine.
Logged
Civilization Forge Mod v2.80: Adding in new races, equipment, animals, plants, metals, etc. Now with Alchemy and Libraries! Variety to spice up DF! (For DF 0.34.10)
Come play Mafia with us!
"Let us maintain our chill composure." - Toady One

cerapa

  • Bay Watcher
  • It wont bite....unless you are the sun.
    • View Profile
Re: Yet another programming/game project
« Reply #10 on: February 06, 2013, 03:16:35 pm »

True. Except if they're alien plants that breathe methane.

But atmospheric conditions are definately in. Especially since it is a simple addition to the planet class, rather than something that needs to be done for every single pixel.

Now, what would planetwide conditions be?

Temperature is already in.
WaterLevel is already in. (guess I could change it to an actual thing that flows around later)
Humidity(yep, global too, for making jungle planets without large bodies of water)
AtmosphericPressure
Nitrogen
Oxygen
CarbonDioxide
Methane
? ? ?
Logged

Tick, tick, tick the time goes by,
tick, tick, tick the clock blows up.

Keita

  • Bay Watcher
  • Easily Confused
    • View Profile
Re: Yet another programming/game project
« Reply #11 on: February 06, 2013, 03:43:50 pm »

Watching, I don't code but this looks very interesting.
Logged
Gravity is a government conspiracy to keep us down

cerapa

  • Bay Watcher
  • It wont bite....unless you are the sun.
    • View Profile
Re: Yet another programming/game project
« Reply #12 on: February 06, 2013, 03:53:37 pm »

It seems I forgot something. This is a starting iteration of the temperature system.

This was an exceptionally odd bug. As you can see, the water and ground seem to have been flipped, except for some places that seem to cross the border. I think it was an underflow error of some sort. At this point I am enjoying the bugs more than the actual results.
Logged

Tick, tick, tick the time goes by,
tick, tick, tick the clock blows up.

10ebbor10

  • Bay Watcher
  • DON'T PANIC
    • View Profile
Re: Yet another programming/game project
« Reply #13 on: February 06, 2013, 04:10:29 pm »

Planetwide conditions dump:

- Gravity
- Radiation (can actually be reduced to distance from sun+ strength of the magnetic field+ solar radiation)
- Solar Influx (Determines the actual light coming in, differing a airless hot planet from a smogged hot planet)
- Excentricity of orbit (High exentricity= Large temperature difference)
- Average distance from sun
- Angle of axis (determines the size of the polar circle, among others)
- Tectonic/vulcanic ability
- Average composition of the planet itself. (Rocky, ice, infertile dirt, diamonds stuff like that)
Logged

Techhead

  • Bay Watcher
  • Former Minister of Technological Heads
    • View Profile
Re: Yet another programming/game project
« Reply #14 on: February 06, 2013, 04:12:12 pm »

I thought up how you could do rain shadows fairly easily. If you distorted the humidity maps E/W according to latitude, and gave mountains a negative humidity rating, you would get dry areas leeward of mountains, and wetter areas leeward of oceans.
Logged
Engineering Dwarves' unfortunate demises since '08
WHAT?  WE DEMAND OUR FREE THINGS NOW DESPITE THE HARDSHIPS IT MAY CAUSE IN YOUR LIFE
It's like you're all trying to outdo each other in sheer useless pedantry.
Pages: [1] 2 3 4