Spellcaster Studios

Make it happen…

Fire jets

Just added fire jets to the lava environment… This is just an environmental effect, doesn’t affect gameplay, but it helps keep the world a bit more “alive”.

screen495

Took me way longer than I wanted, but it works fine and adds a certain charm to the location…

The next step is a whole class of atmospheric effects: rain, snow, ash, etc… I have lots of ideas for this, so I need to choose the most promising one and implement it, see how it goes…

Now listening to “The Unforgiving” by “Within Temptation”

Link of the Day: I uploaded this video of the game the other day, but I forgot to link it here, so… Tadam!

Fiery waterfalls

Added the flow shader to the lava, looks great!

screen492

Maybe it’s a bit too orange/yellow, maybe red/yellow would be better, but I suck at textures! :\

Also added the fiery waterfalls, but can’t decide which of the variations I like the most…

screen493screen494

I change opinions every 10 minutes… Disappointed smile Will have to ask the artist about it… For example, now I’m more into the second one… Smile

Tomorrow I’ll keep working on the lava world, adding fire jets, streams of fire that burst out from some lava in the area randomly, just to keep the environment more interesting… I’m also researching on how I can make a sort of ash atmospheric effect (which I can reuse for rain and snow).

Now listening to “Am Universum” by “Amorphis”

Lava rivers

I’ve started another polish stage, now dedicated to the lava worlds…

Old generation would generate something like this:

screen488

screen489

Not natural at all, and quite ugly most of the time, especially when you see it on the map… There was also a lot of glitches and bugs, like the one below (in case it’s not too apparent, there’s a pillar of lava):

screen490

So the first step was to get the new river algorithm working on the lava world, which required several tweaks to the parameterization… For example, rivers on the lava world don’t necessary go to the edge of the map, their width is smaller, there is a larger quantity of rivers, etc…

screen491

The results look much more natural, even if they’re not perfect (I kind of dislike the extra wide rivers, but they make sense for the algorithm, since there are more rivers, they tend to converge a lot more)…

Next step is to get the flow stuff working on this, and the lava waterfalls…

Now listening to “Dinasty” by “Two Steps From Hell”

Link of the Day: My friend David Amador got interviewed by #GamesMatter, it was quite interesting. You can hear it at http://www.twitch.tv/gamesmatter/c/6268286.

Optimization: failed!

Today I spent my evening trying to optimize the map generation (when the player lands on a planet) and the area generation (when the player changes areas).

The map generation takes about 15 seconds on a normal map (this can be a bit more or less, but this is a good average), which is very long. The problem is that most of this time is unavoidable…

Doing some profiling on it yielded the following results:

T(setup)=5 ms
T(base_generation)=373 ms
T(blurring)=1566 ms
T(normalize_heights)=18 ms
T(rock_spawns_normal)=3 ms
T(caves)=0 ms
T(water)=11224 ms
T(trees)=8 ms
T(process_heightmap)=921 ms
T(special_process)=0 ms
T(pirate_lairs)=0 ms
T(temples)=0 ms
T(camps)=0 ms
Total(build_heightmap)=14121 ms

As you can see, most of the time is generating the water courses, and that part is already quite optimized… It’s something that takes time to do well… Reducing that time would have a significant impact on the rivers and lakes… I might be able to do something more on the pathfinder I use to create the river, but I don’t believe I’ll be able to get that time down much…

Then we have the area generation… This one takes currently about 600 ms on average, 95% of it in generating the navigation mesh, and I already squeezed that one as much as I can (most of the code belongs to Recast, the library I use for navigation mesh generation).

So I have about 200 ms shaved on the map generation to show for my efforts tonight, which is kind of sucky…

I think I’ll be able to multithread the map generation, so the player won’t be waiting 15 seconds do be able to land on a planet… I’ve already separated the code with that in mind, so except for some sync points where I create the flow map texture, I should be able to run it in a separate thread that gets launched as soon as the player goes into hyperspace to a new planet… Between the hyperspace travel, and running to the lander, that’s at least 10 seconds of time I can hide, and the rest I can hide on a “in the atmosphere” cutscene.

Next step in the polish is to grab the lava worlds and see what can be done there with the water algorithm, glows and maybe some fire jets on the lava pools… A “fire snow” like effect to simulate ash in the atmosphere might be also interesting.

I’m also guessing I’ll find some bugs (I always do when I revisit planets), and this is one of the planets where a new camera algorithm/occlusion handling would be useful, so I expect about a week of fun… Disappointed smile

Now listening to “Viva Hades” by “Mono Inc.”

Covenant: The Bug-Crusher!

Today I dedicated the evening in working on bugs… Squashed a lot of those, most of it stuff I broken on previous refactorings and others that I knew about forever but didn’t want to fix because that sucks!

List includes (but is not limited to):

  • Skybox is now unaffected by the fog
  • Scorch marks now spawn at the correct height
  • Enemies that are hit no longer turn transparent
  • Jetpack doesn’t work anymore without fuel
  • Map displays the rocks with less contrast
  • Exploding drones now are correctly destroyed
  • Shields now display
  • No longer possible (again) to walk outside the game area
  • 3d->2d projection now working properly for UI elements

 

It was very productive as a whole… I can only do 2 or 3 bugs in an evening normally…

screen487

Next, an optimization task before getting back to “fun” polish!

Now listening to “Ravenhead” by “Orden Ogan”

Water is finally done!

Finally finished the water courses and lakes (with reusable code for lava, etc)!

Added waterfalls to water drops:

screen484

screen485

Gives the scene a bit more life, I think…

Also ported the water shader to HLSL (screenshots below were taken with D3D renderer), and fixed some issues with the tree placement… All in all, a great day!

screen486

It looks pretty, I think!

Next, I’m going to go kill some bugs and maybe optimize something (need to decide what)…

Now listening to “The Perfect Element” by “Pain of Salvation”

Link of the Day: Oh yeah…

Lake flow

Today I managed to make the flow of water work on the lakes… in the process I also found some bugs with the terrain generation code that I had to fix…

First, without any change to the flow system, this is what I got:

screen481

It was a quite neat effect, to be honest… but the rest of the water was just too static, which looked weird…

Then I added code to make the flow map on the rivers flow towards the nearest exit… but it wasn’t working properly, so I had to run this in debug, and since debug mode is so slow (mostly because of the pathfinding algorithm I use to create the rivers), I reduced the number of rivers to one, and that made a bug appear, but it looked cool!

screen482

Quite interesting, but completely unplayable… Smile

Anyway, I fixed that bug and the one with the lake flow and this is the final result:

screen483

The water clearly goes to the exit… It still has some circumstances in which it doesn’t work too well, for example when the exit doesn’t have LOS to the place I’m computing the flow… This could be solved with pathfinding, but I think it’s overkill for something merely cosmetic…

So rivers and lakes are almost done… Still need to port the shader to HLSL, add a waterfall effect and make sure that trees don’t spawn near the water on jungle levels…

Now listening to “Antichrist” by “Akercocke”

Text review

I’m in Belgium for work, and I hate programming on the laptop (keyboard layout is not confortable), so this is a good time to do a scan of the text of the game, searching for errors and tweaking pieces of text…

Boring work, though…

Now listening to “The Singularity” by “Scar Symmetry”

Link of the Day: Such pretty pixel art, and the scope of this platformer seems amazing, even if platformers aren’t my thing!

More shadery flow!

Quite happy today with my shader work…

The shader I had worked fine, but it looked terrible adjacent squares that had slightly different vectors:

screen479

It gave the scene some charm, but it wasn’t very pretty looking…

Then I had an idea! Basically, the problem was that the new UV that I used on the animation was computed with something like “uv_new=uv_base+uv_disp*t”. As “t” grew, the more different the vicinity would look, so I decided to clamp t so it didn’t drift too much, like “uv_new=uv_base+uv_disp*fract( t)”. The more attentive amongst you would notice this would create a stuttering (since t is time in seconds, we’d see a pop every second)… Here’s where my idea came alive! By computing two UVs, offset by half a second or so and interpolating between them, I’d hide the popping… It’s there, but you just don’t see it because when it’s time for it to happen, I will be showing the effect of the other displacement, and so on…

This limits the speed of the current, and you can see the error a bit if you pay attention, but it’s almost invisible unless you’re looking for it…

Then I had to play around with the texture until I got a good result, but this is the result:

screen480

And in GIF form:

water_flow

I still need to cleanup the shader and add the code to handle the vertical walls of the voxels and the lakes, but we’re going the right way now!

Going to Brussels tomorrow, so I’ll probably take a “writing day” instead of working on code… Smile

Now listening to “Ultra” by “Depeche Mode”

Water flow shader

Still working on the water flow shader…

After I generated the flow map, this was the result:

screen474

A lot of noise in most of it… The rest flowed correctly, which was good, though! Smile

Drawing the displacement, everything seemed to be ok:

screen475

And the base UVs:

screen476

And the displaced UVs:

screen477

So the problem seemed to be the displaced UVs… After some head-scratching, finally arrived to the conclusion that the problem was the linear sampling: pixels in vicinity of each other had slightly different flow values, but when you add time to the equation, the small changes become huge, hence the noise…

Switching the filtering mode, I got a good result: the water now flowed the way it was supposed to, but the results were frankly disappointing, nothing like I envisioned…

Partly the reason is that the source texture (which I’m offsetting) is so varied in term of hues, so the grid based nature shows too much with the shader (because the displacement changes from cell to cell), which looks awful…

My solution for now is to do two layers of texturing: a base texture and a (simpler) flow texture on top:

screen478

The texture is temporary… The results are way better, but the flow now is all wrong… Quite hard to explain, but the fact is that the UVs that get displaced are aligned to the screen and they probably have to be aligned with the flow…

I also think that it might be interesting to add a kind of “shore” to the water: use one channel of the flow map to describe how far the water is to the edge and use that to select a color for the water (so mid of the river is darker than the edge of the river, for example).

So, I still have a lot of stuff to experiment with, which is rather fun (albeit time consuming!).

Now listening to “Follow Me Into Madness” by “Tarot”