Post new topic    
Page «  1, 2
Metal King Slime
Send private message
 
 PostWed Nov 14, 2012 3:35 pm
Send private message Reply with quote
Now with rivers and erosion! I'm using a sort of A* type pathfinding, with a point randomly chosen on one of the edges and a target on the opposite edge. The cost is determined by the height of the terrain, so in theory the river should move across the path of least resistance. It doesn't work perfectly though, as you can see in the screenshots.

As the river flow, it'll try to erode the surrounding area, though again, this isn't perfect yet.

Anywho, screenies!





Next I'll have to figure out a good algorithm to turn the map into an island by lowering all the edges in a nice random way. I could use the one I did for the previous maps (the colored ones) but that was a bit kludgy, all it did was run a random line down and across the edges while roughening them. It could work I suppose, though I'll try to find a more realistic way of doing it to take into account erosion and water flow.

Another thing I can't quite figure out is how to run estuaries tributaries. If anyone has any ideas as to how I could do such, I'd be very thankful.

Anywho, cheers for now!
Being from the third world, I reserve the right to speak in the third person.

Using Editor version wip 20170527 gfx_sdl+fb music_sdl
Slime Knight
Send private message
 
 PostWed Nov 14, 2012 3:56 pm
Send private message Reply with quote
Looks like i'm seeing a B&W membrane scan, full of capilar vases and the "contents" behind the membrane. Looks neat! very good work BMR.
"I can't buy food with glory"
Metal King Slime
Send private message
 
 PostThu Nov 15, 2012 7:19 am
Send private message Reply with quote
I was asking about DF-style z layers because I think you're better off using an angled perspective and putting everything on one map. You would want to use quite a high angle, and no cliffs, so that elevations can never obscure the terrain behind them. Of course that's an annoying limit. And that demo is neat though.

Quote:
Using the method TMC provided, I'll run this same generation again over 16 different maps.


There is an alternative: use the "save map state" command to create 16 different copies of one map. (You can even load a saved map state from a different map.) I imagine that would be much faster by allowing you to avoid lots of duplicate computation.

Also, using a hidden tile layer rather than zones is a more efficient way to store the height value. (The read and write commands are several times faster, though they probably wouldn't be the bottleneck anyway.)

Quote:
I originally intended to use this code in Legacy for certain areas, but it's a bit too resource-intensive and clunky to use it multiple times. The generating takes long enough (around 12 seconds for a 128 × 128 map) that Game warns me I might be in an infinite loop.


To avoid messages about a frozen script, you should call "wait" regularly (at least once a second). Also, note that you can save map state to avoid regenerating the map every time you visit. You could even hide the generation delay in the middle of something else like a cutscene.

BMR wrote:
Was actually trying to do Perlin at first, and while I can wrap my head around the theory behind it, I haven't quite figured out how to actually implement it yet :v:


Floating point math is not necessary for implementing Perlin noise. As I've stated many times, in the early days of computing floating point was considered just a convenience, and is actually inferior to fixed point in some ways (from a scientific computing point of view, floating point has horrifying mathematical properties).

I found a fixed point implementation of 3D Perlin noise by Ken Perlin himself which is relatively short and makes no use of math functions, so could be ported to Hamsterspeak. But it's still far far more complicated than diamond-square, so I'd stick with that

The usual method of generating an island is to add a noise map to a radial function that is zero near the center and increasingly negative near the boundary of the map. A realistic looking coast line is one that is a "random fractal" of some typical dimension, and AFAIK that is what the above should get you.

The rivers are quite hard to see in those images so it's not clear what's going on. The pathfinding technique sounds like a good way of placing rivers, assuming that you change the surrounding elevation so that it becomes the actual path that water would take.

But hang on. If you want an island, then pathfinding rivers from one side of the map to the other wouldn't make sense anymore. I would just flow rivers downwards from random high elevation points. When they collide, they get wider. For additional realism, they could start out at 0 width (ie. invisible) but you'd have to place far more.
Metal King Slime
Send private message
 
 PostSat Nov 17, 2012 2:48 pm
Send private message Reply with quote
Gah! The z-level thing is killing me, I give up on it. I've gotten it to work, but it doesn't play smoothly or well enough to be viable.

TMC wrote:
There is an alternative: use the "save map state" command to create 16 different copies of one map. (You can even load a saved map state from a different map.) I imagine that would be much faster by allowing you to avoid lots of duplicate computation.


I played around with this and got it to work like the other tech-demo I made, but currently the map is just too jagged and the movements are too abrupt for it to be a viable playstyle. I might revisit z-levels later on though, as the code is currently able to generate a height-map, I might be able to get it working properly in the future despite how frustrated I am right now with it, hehe.

Still, doesn't mean I'm giving up though. I've gotten terrain generation working somewhat, here are a few screenies of generated maps:



They're currently cut off at the top and the bottom, as the minimap in Game can't show the map (256 × 256) in its entirety.

For some reason, my rivers don't seem to be working out properly. I'd fixed them previously so that they were more visible, but they don't seem to be working now. I'll prolly fix it later on.

TMC wrote:
But hang on. If you want an island, then pathfinding rivers from one side of the map to the other wouldn't make sense anymore. I would just flow rivers downwards from random high elevation points. When they collide, they get wider. For additional realism, they could start out at 0 width (ie. invisible) but you'd have to place far more.


Aye, I thought about having rivers get wider by eroding more and more land as they got closer to the coast, but I can't get the code working the way I want it to. I'll prolly revisit this one as well alter on.

The type of terrain placed on the map currently depends on the height of that point. I'm planning on fixing it so that it takes into account the general type of area (i.e. how smooth or jagged the area is) as I'd originally planned.

Currently, trees, bushes, flowers, and rocks randomly generate on the map depending on the height and the type of tile at that point. Here are a few up-close screenies:




I'll eventually soften the edges of the water to make it flow more naturally. Same with the dark patches of dirt.

Anywho, that's all for now, cheers!


EDIT: I'm actually getting rather tempted to go ahead and write this in FreeBasic and scrapping the graphics in favor of ASCII...
Being from the third world, I reserve the right to speak in the third person.

Using Editor version wip 20170527 gfx_sdl+fb music_sdl
Red Slime
Send private message
 
 PostSat Nov 17, 2012 8:42 pm
Send private message Reply with quote
Don't know if you have experience with this, but here's an article on autotiling that you may find useful:

http://www.codeproject.com/Articles/106884/Implementing-Auto-tiling-Functionality-in-a-Tile-M

It'd be a good second pass over the map in order to make it visually appealing.


As for the A* algorithm, how much of a penalty does higher ground place upon the river vs the manhattan distance heuristic? (I assume you're using manhattan, anyway.) Try adjusting the height cost to be a little higher and see if it helps generate more natural looking rivers. Otherwise, TMC's idea will definitely work. (I especially like the 0-width rivers idea.)

Loving what you're doing here, I'm excited for more updates.
I... I still exist... somewhere.

Come join us on irc.esper.net in channel #slimesalad for help, chat, and general fun! We love company.
Metal King Slime
Send private message
 
 PostSun Nov 18, 2012 4:45 am
Send private message Reply with quote
Huh, that autotilling article looks to be exactly what I need to make smooth terrains, thanks for the heads-up on that.

Right now, the distance weighs more than the height in the A* algorithm. I tried having height weigh more, but for some reason it didn't work out the way I'd planned. Still, it was probably some silly mistake that I overlooked while coding (curse these late night/early morning brainstorms!) and could potentially be a really simple fix.

Updates coming soon!
Being from the third world, I reserve the right to speak in the third person.

Using Editor version wip 20170527 gfx_sdl+fb music_sdl
Display posts from previous:
Page «  1, 2