Spellcaster Studios

Make it happen…

Water flow

Before I waste more time with generating the geometry for the rivers (to make it flow), I decided to try something different: use the already generated voxels, but with a shader that uses a “flow map” to generate the illusion of movement…

So today I spent my time creating the infrastructure for that:

screen473

If this looks like previous screenshots, that’s a good sign! The water here is already using the new shader, and now I’m creating the flow map so that the shader will displace the UVs properly… I’m not sure if the results will be anything decent, but this test is way simpler than spending the next few days battling with all the special cases in generating river/lake geometry (and even in that case I’d have to build a shader to do the flow, with most of the same problems I’m likely to run into here).

Now listening to “Jaded” by “To Die For”

Link of the Day: This game looks so good, it’s just a shame it’s a MMO… But it really looks great: http://www.colonies-online.com/

River geometry

Finally finished with the terrain/river/lake generation!

Yesterday’s problem was easier to address than I expected, everything worked perfectly quite soon… So, we had this yesterday:

screen470

And today we have this in the same place:

screen471

The screenshot doesn’t do it justice, but it’s much nicer and more “correct”.

So now I’ve started the generation of the “river mesh”, that will allow me to do animation of the water…

First try:

screen472

Yep, terrible, but it moves nicely! Smile

Problem number one: I have a list of positions in a grid, so how do I convert that to a kind of “triangular strip”? Now as easy as it sounds! This was the first try, took me a while to actually get something rendering (a lot of silly mistakes), so I haven’t delved into what went wrong, but one thing that’s clear is that I need a way to make the “curves”… On the current algorithm, I only consider the current and the next position, but I think I have to consider one more to build the “turn”.

Problem number two: The texture… This one was the hyperspace texture, so nothing has been done to get it right, and I probably want to make some alpha out of it so that it adds some noise… The movement speed is also wrong, and I think the shader has to be modified so that it does a kind of fade of the movement on the edges of the polygons…

Problem number three: not visible above, but I think waterfalls will be a big problem as well, for the same reason that the curves are a problem here, but on a different plane…

Now listening to “The Enigma of Life” by Sirenia

How original: lakes and rivers!

Yep, this week has been very original…

I’m closer and closer, and the latest addition to the algorithms has really made a difference…

After all the process is done, I now do a linear interpolation between the height of the river/lake and the surroundings, making it rise smoothly enough so that the water doesn’t escape!

screen469

Currently, there’s only one remaining problem with the rivers/lakes, which is the rivers that merge… Most of the times, they merge correctly, but on some cases, this happens:

screen470

Basically this happens because after the rivers are generated, I guarantee that they go down, by going through them and making sure the heights are always lower… But this river where I’m standing ends there, because it merges with the other one, so it’s current height is not considered for the rest of the algorithm!

So now I need to handle the mergers better…

Next step is to actually finish the river, by sharing the nodes with the “main” river… Then I have to figure out what’s the lowest height at the end of it, and work my way backwards, by going upstream until I reach the origin, guaranteeing that I always take the lowest height from all the influencing rivers!

It’s a bit of a hack, but combined with the “water valley” algorithm, the result will probably be ok…

Now listening to “War of Will” by “Battlecross”

Link of the Day: Skynet is coming: http://kotaku.com/google-ai-taught-itself-how-to-to-be-a-pro-at-classic-v-1688105409

More progress on rivers/lakes…

I’ve studied a bit more on A* optimization, and I finally found what the major problem is… The fact that I’m really putting an extremely large penalty on any “rising” terrain means that the system has to search the whole map to find a valid path…

Playing around with the factors, I massively reduced the generation time, while keeping the rivers good looking…

screen466

This took the generation time from 30-40 seconds to 5…

Next step is to flatten the lakes and see what’s the result, so I can move on to the (hardest) task of generating the geometry for this…

Now listening to “Recreation Day” by “Evergrey”

Terrible work day…

Most of what I’ve done today got thrown away… That’s a sad thing that sometimes happens in development… I did a lot of experiments with the lake generation code, and I finally found something that I think actually works, by playing around with the parameterization of the algorithm…

screen465

Since this whole process is taking about 50 seconds, I started optimizing the code… One of those tasks (the lengthiest) was to convert the current pathfinding code I have using a STL vector to a STL list (so I could use an insertion sort, instead of searching the whole vector for the best candidate – this made the algorithm take longer because of the nature of STL), and then convert it to use my own list, which was a lot of work, to end up with something that took roughly the same time (while the code complexity increased significantly)…

So I went back to the old code and I’m investigating other optimization possibilities (since taking almost 1.5 minutes to land on a planet seems excessive for me), although I don’t have many ideas on this…

Now listening to “The Classical Conspiracy” by “Epica”

Still lakes…

This is taking much longer than I wanted… Although I’m closer (and just found out I’m doing a lake every 4 cells), it’s still not good enough, the water doesn’t follow enough:

water

The brightest points are the lake spawn points, but the water dies down too fast… I could do more iterations, but this takes too long (although it can be optimized a bit), and I’m not sure if the results would be much more impressive…

Note that altough you can see the whole river filled up above, the actual lake is much smaller, because of the threshold…

screen462

So in this screen above, we have 50 iterations, at strength 50…

Below, you can see 50 iterations at strength 250:

screen463

And with 250 iterations:

screen464

So, minimal differences…

Another thing I tried was to boost the strength of the water on propagation, trying to reduce the attenuation… The results weren’t very good, but the propagation was very cool in GIF form:

river04

I feel I’m close to a solution, but I’m not exactly sure what to mess with next… A good night’s sleep will maybe give me some ideas… Smile

Now listening to “Impressions in Blood” by “Vader”

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…