Tuesday, May 27, 2014

Chugging Along

Still working on the terrain model. I managed to root out a few sneaky and terrible bugs. Aside from that there's not much else to report; progress is slow, but steady.

Tuesday, May 20, 2014

Two Steps Forward, One Step Back

I went back to working on my other project this week. I've made some good progress. I changed my erosion model and things were looking up, but they weren't quite right. So naturally I continued working and mucked everything up. Things went

From this:


To this:


Okay I'm kidding. The second picture isn't actually fire and brimstone; it's just color coded. The red shows how much sediment is in the water and the green shows how fast the water's flowing. That said, things are still off. The sediment should dissipate smoothly through the ocean and slowly build up coastlines. Instead, it seems to gather in pockets, which leads to strange looking pits everywhere.

There three things, at minimum, that I definitely want working reliably before I use this data to generate actual in-game terrain.

First is natural valleys and coastlines. Otherwise the player will spend all their time on 45° inclines. This is something I've had a lot of trouble with. Some of my recent models have almost produced good coastlines, but not quite. This is because I'm now modeling sedimentation better. I think the results will be really good, if I can improve the current model. They aren't too smooth or too jagged and are really starting to look like actual mountains.

Second is stable rivers that are a least a meter deep. The blocks in-game are a meter wide on each side. My plan is for any surface water less than a meter to result in swampland. However, rivers aren't swampy so they need to be at least a meter deep to avoid this. River sources, on the other hand, tend to be either underground or swampy. Ideally, rivers will begin in swampy areas and transition smoothly to proper rivers.

Third is good mountains. It'd be boring if everything was grassland. There are a few things that go into this. They can't be too steep or too shallow. The amount of vegetation should be lower near the top. There should be some rocky outcrops. I'm really pleased with shapes of the mountains in the recent models. They aren't too smooth.

Those are the minimum that I want before using the algorithm in game, however, there are plenty of other things I want to include eventually.

Temperature and humidity. I would love to model these things. They would be super useful for creating natural biomes. However, I imagine they'd also be really finicky and hard to get right.

Snow and ice. While it would be really easy to simply make things freeze above a certain altitude, it'd be nicer to have a little natural variation. These things would also affect river formation, so it might take a lot of work.

Implied features. One thing I did with the new model was remove a lot of complexity. I decided that instead of trying to get everything to form naturally, I would dumb things down and use the results to generate extra features. For example, beaches should form wherever soil meets the ocean. Deserts would form in areas of low humidity. Waterfalls could be created anywhere rivers go over a steep drop.

That's it for today, folks!





Tuesday, May 13, 2014

Parser Finished

I finally finished the parser! It can now parse a text file and produce the appropriate syntax tree. The next step will be to produce actual machine code from that tree. I think, however, I will leave this task for the future. Right now, I'm itching to get back to my other project. Not much else to report, hopefully I'll have new screenshots next week.

Tuesday, May 6, 2014

Parse All the Things


Packrat Parsers are interesting things. They basically try every possibility everywhere. Surprisingly, this turns out to be fast because they only do it once. They get away with this because they record every single thing they do. In recent years, computers started having enough memory that this idea is no longer completely ridiculous.

Been continuing work on the parser I started. The first stage is more or less complete. That is to say, I can give the parser a file, ask it if that file is valid, and get a yes-or-no answer. However, it's going to need to do a little more than that before it's useful. Ultimately, I will need a syntax tree representing the file. There are still a few more grammar rules that I need to add, but I'm going to cross those bridges when I come to them.

I've also been playing Skyrim in my spare time and getting a lot of ideas for things I could add to my other project. I got an idea for how to better organize possible features so I don't get inundated with all the possibilities. If I get burnt out on the parser, you might actually see some progress being made on that project someday.