Monthly Archives: December 2017

Jetboard Joust Devlog #70 – Shred-ache

At last – a weapon where I can write about something else other than endless tweaking of shader and particle effects (though there was still plenty of that involved)!

The Shredder is another weapon inspired by many wasted hours playing Turok 2 on the N64 back in the day. In Turok it’s a weapon that fires a laser that bounces off anything it hits, you can it in action here.

I knew that to get this mechanic to work I was going to need a method of collision detection that was more robust than the current system I’m using due to the speed the shredder’s ‘beam’ would be travelling. My current system relies on objects actually colliding at the point at which the collision checking is done, this is fine for the most part but will fail when very fast objects more ‘through’ smaller objects (the so-called ‘bullet through paper’ syndrome).

So I started looking at how to implement a basic raycasting algorithm to check for collisions instead. I am not great at Math(s) so was slightly dreading this, but thankfully I found a YouTube video that was able to explain to explain the calculations involved in simple raycasting here. There’s some very clear code linked to from that same video.

I was able to implement a decent enough raycasting algorithm fairly painlessly, so the next step was to work on the visuals. I didn’t really like a plain ‘laser beam’ type effect as is used in Turok, so began working with smaller particles instead. I felt a weapon called the ‘shredder’ should look at least vaguely like it’s tearing things to pieces!

After several hours of tweaking particle parameters (a process I am now getting a bit tired of) I managed to settle on an effect I was pretty happy with and seemed to fit with the name ‘shredder’. There’s two sets of particles here, one which stays aligned with the ‘beam’ and one which drifts away from it. Also particles are added when the ‘beam’ reflects off a surface.

I uploaded this to Twitter thinking I was done, but after coming back to it felt the trail of the ‘beam’ was too dispersed. It needed some kind of central ‘pulse’ or something. I also had some feedback, again via Twitter, to this effect so I wrote a simple shader that allowed me to taper a beam out to a point and used this. I also focussed the distribution of the particles a bit more.

Now I think I am done!

Dev Time: 2 days
Total Dev Time: approx 138.5 days

previous

mockup_3x
First Steps Testing The Raycasting Algorithm

mockup_3x
Adding Reflection And Testing A rough ‘Laser Beam’ Effect

mockup_3x
The Point At Which I Thought I Was Done

mockup_3x
The Final Weapon In Action
Advertisements

Jetboard Joust Devlog #69 – Boom Boom, Shake The Room!

This latest weapon is called the ‘Sonic Boom’ and I had a fairly good idea of what I wanted it to look like visually before I started. Something akin to radiating circles but not so regular in feel.

I remember seeing something as a kid in a book about optical illusions (we had no Internet then, kids) that always stuck with me – it was an image comprised of two sets of concentric circles, the centres of which were slightly offset. It made your eyes go funny and that was a good thing.

So I started on that basis, by updating the geometry shaders I discuss here to include multiple sets of shapes that are offset by a certain amount. It took quite a while to get this working in a way I was happy with (and to structure the HLSL in a way that was sensible and would allow me to add other shape types easily), but the result was pretty satisfying if nothing like the effect I set out trying to achieve!

I realised there was just too much being drawn in the shader so I set about adding some different paint modes to vary the effect created. As well as the original ‘OR’ logic (if a pixel contains a shape it’s drawn) I added AND, XOR and NOT modes that react differently, particularly where shapes overlap. For the AND and NOT modes I allow a number of overlaps to be specified, with AND any pixel that contains >= the number of overlaps is drawn, with NOT and pixel that contains < the number of overlaps is drawn.

By combining these modes and a lot (and I mean a lot) of tweaking I was finally able to achieve the type of effect I'd set out to create. The final version consists of two overlapping geometry shaders for the bulk of the effect, particles around the barrel of the weapon, and a smaller 'negative' geometry shader also around the barrel of the weapon.

As with most of these weapons, the actual mechanics of it were pretty straightforward to program. It acts really like a kind of RPG that must be 'charged' before being released, if anything it's even simpler than the RPG because I'm allowing this one to travel through buildings (I'm not sure if I'll keep it like that or not, it does seem a little weird).

I did also have to update the enemy AI to allow them to cope with a 'charge and hold' type weapon but that was pretty easy. The audio design for this one's gonna be fun!

Dev Time: 2 days
Total Dev Time: approx 136.5 days

previous | next

mockup_3x
First Stab At Updated Geometry Shader

mockup_3x
Adding Different Paint Modes To The Geometry Shader

mockup_3x
The Final Sonic Boom Effect

mockup_3x
Adjusting Enemy AI For ‘Charge And Hold’