Kamis, 03 Januari 2013

Block Colours

I've started adding vertex colors to the blocks, this is actually the first time I'm differentiating between block types which is exciting, also it shows the terrain generation a lot better along with it's flaws. I think I'll be sticking to these block colors for the time being as mobile platforms won't be able to show the textures anyway.


And in first person:

templates-office.com Voxel Dwarf Game

Terrain Generation

I've started using Perlin noise instead of a height map to generate the terrain to have infinite generation and be able to generate caves and caverns as well as the surface of the terrain. The results have been encouraging but there's still a lot to be done to ensure that it creates a realistic surface with mountains and plains and other natural elements such as rivers and lakes.

First thing I generated was some rolling hills with a 2d Perlin noise function, looks good but too boring for gameplay.

Then I generated some 3d noise which made this alien landscape.

I modified the 3d noise function to create a slightly more realistic terrain, here by changing the thresholds for what makes a solid block dependent on elevation so that the lower levels are almost solid with more caves on the way up to the surface, then the surface gives way to mountains and floating islands. It's not realistic enough but if I hadn't used a linear change it might have worked better. 


Lastly: Layers upon layers of 2d Perlin noise generated terrain on top of each other, this is how I plan to make realistic terrain. Starting with a mountain layer I got tall mountains and large valleys, then I placed a layer of stone starting from the bottom replacing all air blocks in the way up to around 30 meters, then a layer of dirt replacing air up to 34 meters and lastly adding a layer of dirt on top of everything with a between 0 and 4 blocks deep to put dirt on the mountains and add some more noise to the surface.


templates-office.com Terrain Generation, Voxel Dwarf Game
Rabu, 02 Januari 2013

Kingdom of Dwarves

Working on a voxel based game in Unity where you build a kingdom with your group of dwarves. I have rendering of voxels in chunks of 16x16x16 cubes that can be updated independently and I'm working on a texture atlas based on block values and an alternative where blocks are just colored rather than textured for better performance on low end computers and mobile devices.

First test: a heightmap generated chunk

Second: larger heightmap based level with one layer of chunks

Finally: large terrain map with mountains



templates-office.com Voxel Dwarf Game
Minggu, 30 Desember 2012

Happy New Year and all the Best for 2013







Another year comes to a close and a lot has happened on this blog and off-line. It's been a good year in some respects, an interesting one in others and definitely one I won't forget. 

I didn't write as much as I wanted and I am not sure I will make up for in the new year - but I will try. I am still toying with the idea of putting my ramblings to print and giving you an offline version to work with. 

I wish you all the best for the new year. Keep on creating games and art - but most of all have fun whatever you do! 
templates-office.com
Sabtu, 15 Desember 2012

Digital Audio Signal Analysis

This latest update isn't about the stealth game but about an assignment that's nearing completion, one part of it is a music based game like Guitar Hero or RockBand, simple music, hit the keys in time with the notes on the screen. Originally we planned to write tedious code with the timing for each note in each song but nearing the due date I've written a script for audio spectrum analysis to recognize notes in the music. I have no experience in digital audio signal interpretation though so I've just been working my way forward learning as I go from trial and error but I have a working version now and some cool looking charts to go with it.

Amplitude time graph:

Amplitude time graph to the music we're using in the game:

Spectrum time graph:

Through trial and error I've come up with three options for beat recognition; simple amplitude check where any sound above a certain amplitude is counted, second I have a sudden start test that checks for sudden increases in amplitude and lastly I have a sudden stop test for sudden stops in amplitude. Almost everything is changeable as it plays, things like the cooldown before it checks for a new beat, sensitivity of each test and how far forward or back the sudden stop and start checks test for increase or decrease from.

The implementation isn't far from done now all that's left is converting the beats into arrows that scroll to the bottom of the screen in time with the song and letting the player input their presses.
templates-office.com Audio
Minggu, 09 Desember 2012

Aligning objects

A simple but very helpful tool that is often overlooked is the 'Align and Distribute'. It's the answer to a question I have been asked a few time 'How do you place your objects precisely in line?'.

The tool can do a lot more than that by aligning not only objects but groups of objects. 

In order to 'kill two birds with one stone' I am going to use and explain the tool while creating a cute animal. What defines cuteness? Cute usually is achieved by more 'child-like' proportions - round shaped heads, big eyes, small nose, small body. Perfect for my favorite start of a tutorial: "Let's create a circle" - well in this case we create three.     



Note:
Users familiar with Adobe Illustrator or CorelDraw for example might ask why I bother with the duplication and rotation when it's already build in. You create one copy, rotate it and the next copy will be a repeated version and you can create the full circle of triangles that way. 
I find this way easier and more controlled when creating evenly spaced content for a circular shape. 

Let's give the lion some facial features. The mouth might like conplexe but really it's just an up-side-down Y and if the deforming of the circle looks too difficult you might try using 3 separate elliptical shapes to create the same effect. 


I added another circle for the body, a deformed circle for the leg and the paw, duplicated them 3 times to create the legs and added a line with a deformed circle with a pointy edge for the tail. A simple (and in my opinion cute) little lion. 

With a little bit more detail (eyelids and eyebrows) it's easy to give the lion some features and create some variations.



Variations don't stop there. Taking the basic shapes, rearranging them and changing the colours you have a whole zoo at your fingertips.




I hope you enjoyed the tutorial and start playing around with the tools inkscape (and other vector tools) have to offer to create some magic. 




Get the source art (svg file) of this tutorial for
USD 3.00

templates-office.com

Alive and snowed under...

It's been a while and I haven't posted for a lot longer than I realized. I missed a major spike in traffic when a news site picked up the helicopter tutorial and barely kept up with the comments due to health problems, too much work, too much fun, too much happening in the real life and I am sure I can find another lot of excuses why I haven't written a new tutorial for a while... but... they will keep coming... I haven't given up on the never-ending quest for better 2D game art. :) 

For now I am snowed under in the true sense of the word. I woke up to a white world outside my window. It started yesterday with a little bit of a white cover but this morning I woke up to 5 cm of snow on my balcony and a good 15 cm (plus) outside. I know - that's nothing for you guys in Canada or other 'polar' regions - but way more than enough for me.

I made my way through perfectly white and fluffy snow (for the 2 minute 'polar expedition' from my flat to the office) for a cup of coffee.

A horrid time to run out of coffee at my place - and it keeps on snowing... 
templates-office.com
Sabtu, 01 Desember 2012

Path following

Guards can now be called on to find, then follow paths. Also the I took away the streamlining of the path, it was overkill to do that while drawing the path and it works better to do it while the guard walks, that way I can use his position to check if he can see any upcoming nodes as he walks and if he does, jump to those instead of any before them. The colored dev lines don't look as organized though :(
Also guard movement is smoothed so it looks pretty natural when he turns corners and along with the realtime checking for a more streamlined path it means that the movement looks a lot less node based because he doesn't need to get to the node before he turns, he just turns when he has a straight path to the next node. In the above picture you can see a non-steamlined path, the script then "sees" points one two and three drawing yellow lines to them, then because it can't see four yet it walks to three.
templates-office.com Pathfinding, Stealth
Kamis, 29 November 2012

Working A* pathfinding

The A* pathfinding system is now functional and very efficient, guards quickly generate a route to the player using the nodes placed on the map and then optimize the route deleting any superfluous nodes on the path. I ended up not using the arrays built into the nodes of closest other nodes because I would have to use that array and the open list of nodes on the pathfinding script at the same time constantly cross checking that a node in the node's array was also on the script's array and then finding the chosen node from the node's array in the script's array to remove it from the open list. I decided it would be more efficient to just check all nodes.
(Above) The pathfinder with no optimization finding the first route through the nodes to a set point. (Below) With optimization code (And fewer nodes) the script finds an efficient path to the target. Also switched to spherecasting instead of raycasting because rays were cutting corners too close and guards couldn't get past comfortable and from time to time would try to find paths through arrow slits.
One more addition needs to be made before the script is ready to be implemented by the guard movement script, that is back tracking. I haven't run into any problems that would need it yet, any failures of the pathfinding so far have been node placement related but as levels get larger and more complex it's probable that guards will start taking dead ends and the pathfinder will get stuck at the ends of hallways instead of reaching the target. To solve this the script needs to be able to backtrack one node at a time. So ad the end of the dead end it realizes its mistake and moves back one node and looks for a new closest node disregarding the previous choice, either it finds a new path or it moves back again until a new path is available.
Once all this is implemented guards will need some sort of smoothing to make their paths look more natural, also they may run this script over the course of a few frames to make sure it always runs smoothly and the guards don't need to move immediately anyway, a few frames to notice the sound or sight, then a few frames shouting out or looking around will only look natural.
templates-office.com Pathfinding, Stealth
Jumat, 16 November 2012

AI pathfinding nodes


I started writing an A* pathfinding system with branching nodes, each node is linked to it's closest eight nodes for more efficient path plotting. I wrote a script that would cycle through them and link them to their eight closest nodes who's paths don't intersect walls or obstacles. Above is the turn out when I got it right, below is the result when I accidentally required rather than disallowed raycasts intersect with walls and obstacles.



Two more examples, above just two links each, below is four which is probably the one I'll stick with for speed.



templates-office.com Pathfinding, Stealth