Friday, 4 November 2016

Devblog: The Devbloggening: Devblog Harder

I haven't made a devblog post since April ... boy, do I suck at devblogs ...

But game development does progress, honest guv'.

I'm making a twin-stick SWAG 'EM UP, for which I need swag ... lots of swag ... so I've got 108 special attacks/defences/abilities/upgrades/buffs and stuff ... stuff which I shall now collective refer to as "POWER-UPS". These power-ups come in 3 levels of usefulness known as the now somewhat classic (thanks to uncle gaben) Common, Uncommon and Rare. Currently Common has an inverted green triangle, Uncommon has an amber triangle and Rare has a red circle ... though this might all change to bronze, silver and gold yet - which is the visual hint for the worth of coin loot dropped by slain enemies by which the player buys swag.

Whilst that's a hell of a lot of code to come up, the real workload has been in presenting it as a visual representation within the game. In fact the functionality for wasn't very difficult to code, regardless of the occaisional code comment which says something along the lines of:
//works for now but make better code later
 So here's a flavour of some of those, said power-up effects - cue a glut of youtube videos.

 
Knockback sends enemies flying whilst Shunt shoves the player out of harms way

 Banana Slip is the canned laughter of comedy gold, complete with lame sound effect

Magic Bullet bounces from enemy to enemy causing damage


Invulnerability uses full-screen postFX shader as a reference to classic 1993 Doom

Wrath Of The Gods sends down lightning strikes on Heaven's behalf

And of course it's not just explosions and fancy flashing particles and lights, each power-up requires an icon. Sometimes these icons are part of the actual visual effect to let the player know what has just happened.

Hamstring permenantly slows a wounded enemy 

BloodDonor heals the player when causing damage to an enemy 

Zone Of Comfy slows enemies whilst Hypnotism stuns them

Animated auras give off a nice effect in general

I've still got around 10 more complex effects to create. These will feature more complicated animated 3D models, plus I've some 90 icons and various sound effects to come up with. Hopefully after that I can finally start on actually creating game assets like levels, environments and characters. Until then, it's time to continue plugging away at the power-ups which underpin the gameplay of this Swag 'Em Up ... and hopefully remember to not wait 7 months between development blog updates ...

Wednesday, 13 April 2016

Random Explosions And Animated Particles

After having spent an inordinate amount of March as some sort of filthy casual nodev type, it was time to fill out the tax return and get back to cracking on with yesdev.


The stock way Torque3DMIT deals with projectile impact is to spawn an explosion, which is made up of a 3D animated object and/or particle effects with the option for sub-explosions. All well and good, but this does not really generate much variation. I decided to expand this into multiple explosion datablocks that would be choosen between randomly. I was slightly confused about how to pack/unpack using an array list of numbered keys, and whilst I didn't receive any build errors I could not get it to work in practice so chose a thoroughly less elegant solution. I simply listed 3 extra explosions for the projectile, had the engine check whether the datablocks were kosher, and then randomise which one to use, falling back on to the default explosion if problems occured.

And here it is in initial testing. Wooo! Pretty colours!

 I had also been practicing using animation with my particles via videoing fire and smoke and then creating a sprite sheet from the stills. This looks so much better than having static particles, allowing for flickering flames and billowing smoke. Animating particles not only looks good with all stuff moving but they save on performance by allowing you to use a single particle for the effect rather than multiples ones to create the illusion of movement or volume.


Since previously playing around with the idea of animating particles using sprite sheets, I had had my attention brought to a particle generator called TimeLineFX. For a poxy 30 of Her Majesty's British Quids (that's like 45 Seditiously Ungrateful Former Colonial Bucks or something like 5 trillion Emus) it was well worth the cash. It features a huge array of demo libraries and vast options for creating and exporting sprites sheets of animated particles.


To keep overhead low, I decided to use quick spawning, single particles which had a sprite sheet for weapon impact/explosions. By combing multiple emitters into an explosion constisting of starting impact flash, blast shockwave, ending sparks, all of which are basically a single particle playing through their animation and then deleting. Couple this with a small number of additional multiple particles for a puff of smoke and a few random sparks to add depth, and then make four of them as a variation on a theme and it gives a very nice selection of explosions.


I also took the concept of using a low overhead, singular animated particle to replace the build up to my 3D model of an energy blast from the offensive powerup named "Super Orbital Laser". Instead of having a fast growing glow with multiple balls of light getting sucked into it, I could use a single sprite sheet. End explosion still needs work but the 2 second buildup was what I was after.


And here's a test with 4 different types of glow and blends, though the two main versions are close enough for it to be almost impossible to tell.



So, next up, more of the same, more fancy animated explosions, more fixing errors with various special attacks which don't fire when triggered. More of the day in day out problems and conundrums of indiedev.

Wednesday, 24 February 2016

Detail And Layering Map Tests

I've been playing around and testing with materials to try and get a good work procedure for creating variation.

First up, I used some open source art resources from the Torque3D Pacific Demo, which can now be found free for download with all art assets here http://wiki.torque3d.org/main:downloads. I amalgamated various terrain textures with their images marked _detail for overlays, such as grass, dry ground and volcanic rock to create a starting texture. I used the detail textures as specMaps and the original normalMaps, before testing the various slots of detailMap and detailNormalMap in the matieral.


Adding a detail map with a scale of 1 made the highlights and shadows of the diffuseMap stand out more. Hardly surprising as the detailMap is taken from the diffuse. Increasing the strength of the detailNM increased the grain of the image. Scaling the detailMap across the diffuse caused a more even grain without sharpening specific features. I thought that textures tended to look better close up the more sharp they were, and the opposite further away.

Next up I tested layering textures. The idea was to create new materials without having to manually merge two images in an image editing app, thus saving on texture memory in the long run. I took a grass texture for the base layer0, and overlayed it with the volcanic rock texture in layer1, to which I had added an alpha channel. The alpha channel was quite simple, I simply boosted contrast on the reference image and took highlights, mid, and shadows.


After intial testing I thought that the grass was somewhat washed out so I boosted the reduced the mid levels of the alpha channel so that it favoured the grass over 50-50 mixing. Originally I had based the alpha channel directly from the contrast of the texture, but found it better to boost the hightlights and then expand them for white, then expand a smaller area for mixed and have the remaining as fully translucent black. This let much more of both layers appear with only limited fade, making the whole thing sharper.

For the final test I added a mask onto the grass texture to simulate earth or dirt (though this could have done this with another layer between grass and rock to again reduce image quantity and thus texture memory, but these are only tests for visual effect). I hoped this would give a more naturalistic effect rather than just having rock sticking out of grass.

Rock and Alpha Channel (at 25% scale) Very 1-0 with only a little semi-transparent

I also noticed in previous tests that whilst detailMaps, detailNMs and specMaps worked on higher layers, standard normalMaps only used the base layer0. To give the rock layer some extra height, I used the volcanic Nm and Spec for layer0 with the grass texture. I had used the rocks alpha channel to paste dirt over the grass and now reduced the size of the white and grey levels so that more of the dirt would show around the edges. I proceeded to do various tests to see it looked, changing detailMaps, detailNMs, and even tweaking layer1 diffuse.


Eventually my eyes went all googly from looking at tiny changes.