Wednesday, 16 December 2015

Buggy buggy FUCKING BUG!!!

So this is a post just to do with bugs that I found and both created whilst developing the mech game prototype. Now thinking about programming it again from everything I have learnt recently in terms of code structure and events, singletons etc with js! I HATE the code I've created before hand so considering starting from scratch for a while now, I promised to try and do a post a day, so this is a blooper reel.....

OK, the shoot yourself bug, simply didn't account for the user to decide to shoot themselves :)


Invisible mechs, caused by not building destruction methods the correct way or at all, so as more stuff was created, I think threejs auto destroyed some objects, perhaps the first models created, just needed to build proper disposal.


Ahh slanty explosion Sprites, I didn't want to use shader particles for explosions, so their base object had a method that made them lookAt(camera,position), I thought this was doing it every time the camera moved but perhaps not, or perhaps because I was stacking 3D models and assets together but the further the camera moved from the 0,0,0 world position, the sprite particles I made became more skewed.


I experimented with building destruction but at one point the mechs movements or my mapping of the walkable tiles was wrong and i could decide to blow up some of the flat road tiles which felt a little inception-y 



Never worked out what this tiny thing was lol


Was really hard to see these too but tiny pixel artefacts started appearing at one point, I fixed it but they just appeared round the movable characters, perhaps to do with invisible hitboxes :/


Tuesday, 15 December 2015

Parametric Geometry

Was browsing through the threejs cookbook and came across a chapter on parametric geometry and I had remembered a few years ago when working on a prototype for a games workshop warhammer game that we had a bit of trouble with one part. We had created a 3D landscape using random perlin noise and displacement, basic stuff. But when we wanted to start creating forest areas, we didnt want to place just tree after tree as that would have been an expensive polycount. But we did come up with the idea of using a programmatically generated geometry of a sort of forest canopy, something that could render the sides of a densely populated forest and also merge it into a tree top canopy.

For example you can see from the image below, that patterns can be found in how a large area of forest could be represented in 3D from the top.....
 
We completed it last time by sticking parts of these models together but wanted to really do it using good old math. So started to look into it again seeing as I had found this section on parametric geometry and whilst searching online I just found it a very interesting topic as parametric geometry and tessellation methods are creeping into more than just games but art, nature, design, architecture and more including the use of 3D printing....


 

I also found a university study someone had done on the actual process of dynamically generating tree's etc which shed's some light on the topic of mathematical 3d model generation.... 


The fact that threejs has enabled this sort geometry creation is definitely something I will be exploring again soon. 
In a game I have been working for a while I generate a dynamic city scape, but this city very much works on the grid based system found in New York. Parametric Geometry could be a key tool to generating more organic looking cities such as London's winding roads and alleys.