Spellcaster Studios

Make it happen…

Alien planet polish

Started the polishing of the alien planet…

This is the initial state:

screen513

Very barren, looks artificial,etc…

Started by the usual places: getting the water flow/rivers working, improving the terrain generation… My focus was really off today, so this went way slower than it should…

Then I added crystals to the landscape, which helps with the barrenness:

screen514

I’m not too sure I’m keeping the alpha-blending on them or not, and I still want to add alien grass, but it’s looking better…

Now listening to “Hellfire Club” by “Edguy”

Now playing: “Trine”… When it came out I didn’t have a computer capable of playing it decently, and I forgot about it, but the other day I saw the trailer for “Trine 3”, so I decided to pick it up and play it… It’s fun so far, although a bit “always the same”… Let’s see how it goes… Just gave up on “Thief”, which really sucked… Loved the originals, but this one had so much issues (balancing, level design, the art direction) that I couldn’t play it anymore…

No much time…

Not much time for work today (just wrote one sentence in the game!), so here’s something to keep you busy: a GIF with all the screenshots I took of the game so far! Smile

Now listening to “The Varangian Way” by “Turisas”

More bugs down!

Today was mostly a bug-hunting day, but I had time to do other stuff… First things first, I removed one of the big bugs in the game: a raycast issue that would sometimes cause the game to freeze… This was very hard to detect, but after I found a way to replicate it consistently, it was fairly easy to fix!

Fixed also some bugs with the AI (the enemies were trying to get too close), atmospheric effects (ashes, rain) no longer show up while inside facilities, fixed some stuff with aiming (was very subtle but sometimes it would cause really hard target situations)…

Also worked on some optimization of the decal system, and managed to get some polish in…

Now when the player shoots water or lava, it won’t leave a scorch mark, but do a splash instead!

screen511

screen512

It looks pretty cool, to be honest… It’s one of those very small details that liven up a scene… Smile

While waiting on compilations, also worked on trying to get the Spellcaster Studios logo music into 8-bits… The idea was to start the music as usual and crossfade to an 8-bit version…

The results are interesting enough that I want to pursue it, but it currently sounds terrible:

For reference, the original logo music:

Need to see if I can either get the original MIDI files made by the excellent João Camacho, or find someone that can hear the music and do a MIDI version of it…

Now listening to “Carved In Stone” by “Rage”

That was quick…

Finished the polish of the swamp level… Quite impressive, to be honest, since I was expecting it to take more or less the same time as the previous ones…

Added a rain effect, which worked great!

screen509

And then, for good measure, added some droplets in the water, to simulate the splash, using some decals:

screen510

The effect is subtle, but in movement you can definitely see it… This one is a bit too performance intensive, going to see if I can optimize it by playing around with the scene graph…

So, optimization and debug task next… Let me see the list… Oh, stupid raycast bug and the scene graph… *rolls sleeves*

Now listening to “Lust Stained Despair” by “Poisonblack”

Polishing the swamp…

Today I started polishing the swamp… First, I added the water with the flow… This was way more work than it should, but since I don’t have rivers, I don’t have a notion of flow, so I had to invent one…

Basically, what happens here is that the water will try to move in one direction (very slowly), while keeping away from the shoreline:

screen507

It looks good in motion! Smile

Then I decided to change the algorithm to generate the swamp terrain…

The previous algorithm was using the same basis as the rest of the terrain types, but taking the average height and making everything below that water. This worked more or less fine, but it tended to create terrains that would be all “ground” on an end of the map, and all “water” on the other end…

I decided to adapt the cavern algorithm to generate more clustered terrain, using a cellular automata. The results were much better!

screen508

This is a terrain with about 55% water, I can control that to make it less watery… Smile

Next step, to add visual effects to the swamp to increase the interest of the area in general…

Now listening to “The Wall” by “Pink Floyd”

I hate precision issues…

So, better camp sites (more seamless with the surroundings):

screen504

And then I decided to tackle a bug that was plaguing me for some time: the world generation on Direct3D and OpenGL were yielding different results:

screen505screen506

OpenGL on the left, D3D9 on the right… Way different…

After a load of time and logging, I finally found the problem… Apparently, one of them (not sure which one, to be honest), changes something on the precision of the floating point unit, which meant that on one case a particular calculation (number of terrain splits) was yielding 25.9999999 (so, since I was truncating, it was 25 splits) and the other was yielding 26.000000 (so 26 splits)…

The offending piece of code was:

unsigned long splits=(unsigned long)((1.0f-roughness)*80.0f+10.0f);

I replaced this with:

#define RoundUL(X) ((unsigned long)(floorf((float)X+0.5f)))

unsigned long    splits=RoundUL((1.0f-roughness)*80.0f+10.0f);

And the results are the same on both renderers!

This took me way longer than it should considering the end result, but it’s good to have coherent results on both systems!

Now listening to “Rosenrot” by “Rammstein”

Link of the Day: Found some interesting thoughts on multithreaded gameplay code (which is HARD)… I’m not sure if gameplay should be multithreaded (think maybe the multithreaded part might be better exploited and better controlled by putting the rendering/physics/path-finding in it, instead of gameplay), but it’s an interesting read nevertheless: http://bitsquid.blogspot.pt/2015/03/multithreaded-gameplay.html

More bug fixing

Not much time to work on the game today, so I mostly took care of some outstanding bugs related to the placement of enemies.

This sort of case would happen pretty often:

screen502

Note that spawner would overlap the lava… The issue was that when considering places to position enemies, I’d only search for a single voxel, and not account for the vicinity.

After a bit of a struggle (because I was screwing up two lines of code), I managed to improve the placement… The above spawner would now be positioned here:

screen503

Much better! Smile

I’ve detected another bug, but I can’t replicate it, which makes it very hard for me to fix it… Sometimes the raycasting system will enter an endless loop, but I have no idea what exactly provokes that situation, so I need to try to figure a way to make it more consistent….

Anyway, tomorrow I’ll probably finish the polish of the lava world and move towards some more bug fixing and optimization!

Now listening to “Plagues of Babylon” by “Iced Earth”

Link of the Day: I never payed much attention to Trine, except for the fact that it was an absolutely beautiful platformer, but the trailer of the third one got me in the mood to fetch the other 2 (and I got them at a low, low price on Steam, so that’s win!):

Navigation and bugs

Today I tackled a difficult subsystem: the “make sure you can walk everywhere” system.

I have a system that makes sure the player can walk on all the game area, and usually it would raise/lower terrain to achieve that… That work relatively well, but with the rivers, etc, lowering and raising terrain would sometimes screw up the rivers big time!

So I decided to build a new system… What it does is mark all the areas, find points of interest (boundaries) and then find the closest points between boundaries and join them together with a “bridge” (not necessarily a bridge, but some sort of ramp). The GIF below illustrates this (you can see the green area in the left/middle of the map disappearing in the first frames).

area00

This worked fine, but it created sometimes this problem:

screen500

You can hardly reach the place where the bridge was built (the water tiles)… To avoid this, I had to change the algorithm so that it uses a better heuristic to find the “points of interest”, namely they there has to be a certain number of tiles around it with the same area id:

area01

The selection then became much better, and the bridges are looking great, but it added another issue: the map used the heightmap to display… But the bridges don’t affect the heightmap, which means they aren’t shown… So I had to build another subsystem to take care of that, wasting more RAM and it was tricky to debug (I had a silly error on it).

screen501

Now I found lots of small bugs in the game, which I need to fix before moving towards the next task…

Now listening to “Time of the Oath” by “Helloween”

Link of the Day: Very interesting art style for a game:

Atmospheric effects

Just added atmospheric effects to the lava world, to simulate burning ash in the atmosphere…

screen499

I feel it adds a bit of life to the scene, and I can reuse the same concept for the snow and rain on other levels…

I’m using a particle system that spawns on the camera… When the camera moves, the particles get spawned at a new location… If the camera moves too much (like a cut transition on a cutscene), it will spawn a lot of new particles at different stages in life…

There were other options to do the effect, using full screen rects for example (which would kill the fill rate), and I could probably do something smarter with the particles (only generate them in front of the camera instead of all around), but the performance is good enough this way…

Snow is easy to make with this system, although not so sure about the rain, though…

Now listening to “Sin” by “Moonspell”

Link of the Day: So this is what 75 million of development money buys you… Nice!

Facilities and water…

Today I didn’t have much time available, so I focused on something I believed to be simple.

In the previous system, facilities like temples, pirate lairs, etc, would be generated after the terrain (and the water bodies) are generated, which meant that sometimes they would overlap… So, if we had the water bodies like so:

screen496

A facility to the north would be terrible:

screen497

Now, the system registers places where the rivers/water bodies can’t flow to (including the start area):

screen498

Had to change some variables, etc, but it was mostly dumb work… Smile

Also fixed a bug with the map display, and did some more research into the atmospheric effects… Currently particle systems is winning, although it has a series of small problems underlying it…

Now listening to “The Clouds of Northland Thunder” by “Amberian Dawn”