Spellcaster Studios

Make it happen…

Still working on lakes

The results still aren’t looking good…

screen461

The current algorithm is to fill a cell with a large value and then apply a kind of blur filter on the map, being selective on the heights (so we don’t use the value from low terrain to change higher cells).

The problem is that there seems to be only two results from this… The above one, which spreads too far and with not much control over the lakes overall shapes, or a clamped version, which just doesn’t do any lakes at all…

This still might be an implementation error somewhere, since playing around with values on pen and paper seems to work fine, but testing this is very complicated (too many cells to debug individually)…

Now listening to “My Name is Skrillex” by “Skrillex”

Link of the day: Here’s an amazing link explaining the basis behind physically-based rendering (PBR), very good for non-technical people to understand the terminology and reasoning behind it: http://www.marmoset.co/toolbag/learn/pbr-theory

Lakes

Working on a lake system, and results are less than optimal… Disappointed smile

Currently, I’m looking for a suitable place for a lake in the river, and then using a flood-fill algorithm, but something is going terribly wrong on it:

screen459

So, the lava here shows the places where a “lake” tile is being placed, and the height shows how far away from the initial position we are (which will make the rivers be too “round”, but this is just a first approach). In this shot you can see the problem better:

screen460

For some reason, to the south of the starting position, stuff seems to be correctly computed to the north of the initial position…

Probably an implementation error somewhere, but I’ve not been able to detect it…

What I really wanted was to use something like I did for the rivers before the pathfinding algorithm, it did a great job of creating lakes (less for rivers…), but the two algorithms don’t exactly work well with each other…

I’ll need to keep studying a good algorithm for this… It’s worth wasting the time, since I’ll use this for the frozen lakes and lava pools in the remaining game…

Now listening to “The Glorious Burden” by “Iced Earth”

Link of the Day: Another amazing 4K achievement of the demo scene:

Playtesting

I had a small kitchen accident and I cut one of my fingers, so I’m having a lot of difficulty coding and writing…

So I decided to try something way different: actually playing the game and tweaking weapon parameters…

screen436

This is actually something I should be doing more often, since it’s such an important part of the game, but I keep postponing it to when this is done, or that is done…

I actually have fun while playing the game, which is a good sign considering I’ve been working on this for over one year!

Now listening to “Gateway OST” Smile

Just finished playing: “Beyond: Two Souls”… It’s a David Cage game, the man I don’t understand why he’s doing games instead of movies… As a movie, “BTS” is quite good, the story is nice, the storytelling is quite interesting… As a game, it’s terrible… You just press the stick once in a while to feed the illusion you’re actually playing, when what you’re actually doing is watching a movie…

Flatten rivers

This took a bit longer than expected, mainly because I spent a lot of time tweaking the A* parameters to get more natural rivers, but the rivers now are “flat”, they only go down…

screen457

The way the river akeis created also enables me to do some additional stuff, like making the flow geometry in the future, clear the area of trees (or replace them with shrubbery, probably makes more sense).

By playing with the cost weights of the A* that creates the river I get some more natural results:

screen458

Rivers tend to flow downwards now, even if they have to go a long way around…

Now I need to figure a way to create lakes… I have some ideas, (random placement, A* analysis or moisture maps) but nothing really pops out at the moment, so I’ll have to run some experiments.

Now listening to “Amaranthe” by “Amaranthe”

Now playing: “Beyond: Two Souls”… This one seems to be less of a game than “Heavy Rain”, to be honest, but I’ll reserve my judgment for now…

And now for something completely different…

In my research into rivers, I’ve found another option that’s yielding interesting results: use pathfinding…

Basically, I just identify a source for the river and then try to leave the map area, weighing the results like in pathfinding (for example, better cost for downhill)…

The results are much better than the previous system:

screen455

Then I took a long time to add some code to merge the rivers that cross and increase the width:

screen456

I haven’t flattened the river yet, that’s the next step… I also want to add a poligonal object on top to create something like water flow, but that’s the last thing…

One of the challenges with this approach though is to create actual lakes, but I’ll get to that after I flatten the river…

Now listening to “Shatter Me” by “Lindsey Stirling”

More water experiments

Today I did a lot more water experiments, trying out different ways to make the rivers…

The results weren’t very good… Either I have very short rivers (because the water doesn’t have anywhere to go) or I have flooding (the most common result):

I’ve even tried approaching it based on sedimentation and erosion, but the results seems very unpredictable and not too fun…

Of course, I can go back to the initial approach, which is to draw a line through the map, using some better rules for it than I currently do to fix the existing problems, but it also seems like an ugly hack…

Think I have to go back to the drawing board and study how everyone else is doing rivers…

Now listening to “Black Sails at Midnight” by “Alestorm”

Water courses tests

I’m trying out using a cellular automata in creating the river courses…

The results work great to make lakes, but not rivers:

screen454

Here you can see the iterations of the automata:

river01

The problem it seems to be that the current algorithm checks for each grid element if a neighbor has water in it, and if it is higher, and it fills the current one with water if that’s the case, but in most cases, that creates the effect you’re seeing, instead of a river, since it’s likely that a lot of grid blocks have the same height around a water element, instead of creating a sort of “river bed”.

I can see two ways to fix this: one is not to use the cellular automata, and use a more direct approach: for each water block, check the lowest neighbor and walk that way, and repeat the process.

Another way is to actually dig a trench. So when I place a water element, I dig it down a bit so that it’s the lowest element in the direct vicinity, and move forward with that…

Going to try these tomorrow!

Now listening to “Pristine in Bondage” by “Amaran”

New rivers

Started work on the new river system…

The current rivers are just a line lowering the terrain and replacing the voxel material:

screen453

It has a lot of bugs (floating rivers, but that could be sorted), but it’s impossible to animate (especially because it doesn’t have an actual direction) and it doesn’t actually look like a river (too regular).

screen452

So now I’m working on a new system for this.

My idea is to work a bit more like nature: find a high spot and make water flow down… When the water can’t flow down more, create a lake, and start making new rivers from there… That will probably create more natural looking planets (hopefully). The problem is making the lake not take over the whole map (which would be possible in some circumstances).

Today I started with the code for this, hopefully tomorrow I’ll be able to start the first tests…

Now listening to “The Metal Opera” by “Avantasia”

Link of the Day: For me, the best graphical adventures in the last few years were the ones from Wadjet Eye Games, excellent retro style and great writing… The new one is shaping up to be another amazing one:

Bug-fixing

Today it was bug-fixing time…

First bug was an old one that was annoying me, even if it was simple to solve: the screen would turn purple on transition between areas…

The second bug was the normals on the objects… For imported objects, I’m using the 3ds format (because it was simple and I already had a function to load them), but the 3ds format doesn’t store normals, so they have to be computed after importing…

What I was doing so far was building smooth normals: assume all points that share a (X,Y,Z) are the exact same point and as such they should share the normal and should be smooth along the surface…

This would lead to weird results in stuff that should be more “straight” in nature, by smoothing stuff that should be flat:

screen450

You can see that on the console and especially in the “power generators”…

Now I’ve added a tolerance factor, which basically makes all adjacent triangles that differ by less than the tolerance angle to be treated as continuous…

Below you can see the effect with the new normal generation:

screen451

Much more accurate and in line with what I actually want from the system in visual terms…

Now listening to “Red Shift” by “Asgaroth”

Link of the Day: The game doesn’t seem much like my thing, but the graphical style is amazing!

Raycasting

Today I worked on some bug fixing and optimization, namely on the voxel raycasting… I already suspected that my raycasting function was a bit iffy and missed some intersections, but today I got to confirm that and to fix it, while optimizing it a lot…

screen449

So yesterday, while in debug mode, the game would drop to 20-30 FPS while raycasting two or three shots, today it doesn’t even change the frame rate…

I’m counting this one as an optimization, so next step is to fix a bug so I can move to another polish item!

Now listening to “Valley of the Damned” by “Dragonforce”