Previous posts in the experiment 1 2 3 4 5 6 7 8 9
Experimenting with a little better AI on the puck. In this example the game speed is increased so I can better track the AI, and the ghosts are on a almost random path (unless you try and take control!). The path to be followed is rendered on screen for debugging, and will be green(ish) when hunting pills and red when fleeing. The algorithm is still fairly basic, and currently does not calculate a real distance from ghosts when deciding the threat level which leads to some very stupid mistakes.
The horrible purple rendering is the result of playing with a toon shader on the maze walls. I would like the maze to just be outlined and glowing, but my maze mesh is far from optimised, and the artefacts come from the result of using cube primitives to construct each segment. A far more optimised builder will construct a mesh from scratch based on the maze layout and cull unneeded vertices. I’m not quite sure how the shader will cope with some of the cases, so I’ve added a follow script to the main camera so I can track down these glitches in the mesh builder.
The last build did not translate very well to iOS running at around 12fps. It was immediately obvious that the main issue was the dynamic lights.
Firing up the unity profiler I could see straightaway that the number of draw calls being made was huge. Up to this point Id just been using default materials and primitives from Unity with no real thought for performance, the idea was after all to test a gameplay idea. The issue, then is that I really want to use touch, and touch at 12fps works but is not really acceptable.
Firstly, i ripped out all the current materials, and moved to mobile specific shaders.
Secondly the maze is dynamically generated (although it does not change right now, its an important feature). Each block of the maze walls is just a unity cube primitive, however these dont need to be independently moved once placed, so running the unity combineChildren helper scripts spits out a nice single mesh for all these objects.
Finally I disabled all point lights in the scene.
Immediately the draw calls fell to 6 which is the number of unique materials used – meaning the dy
namic batching of geometry was working at its optimum factor.
Uploading this to an ipad3 the profiler is now showing a 100fps render speed (theoretically only as IOS is limited to 60fps). Sure things look dog ugly right now, but 100fps is a much better place to start from than 12!
This build represents the end of the line for the current branch of the experiment. Originally my plan was to make a quick tribute to pacman where you control the ghosts instead of the puck, by swiping on the junctions. Th idea was to see if this worked gameplay wise.
It became obvious quite quickly, (and pointed out by Trish from Lucky Red Fish, explicitly, that it was going to be be impossible to manage multiple ghosts when moving at the speed i wanted in the game. However, the aim is to experiment and see where things lead, and several ides have emerged.
1) Slow the game down massively, this would make it more tactical and deliberate. This may end up being a little more like spymouse. I like this idea as it keeps the core goal of honouring pac alive, and will revisit.
2) Iain from murkeygreen, mentioned that the dynamic lights and exploration feel felt interesting, and started to remind him of this Crash Bandicoot level.
My main issue with lights right now, is as it stands this build only runs at @12fps on ipads, which is not good enough for me. However, im intrigued as to why the performance is so sluggish, so will start to investigate IOS optimisation in the next build.
Couple of changes. Firstly the yellow dude has got the first iteration of a brain, previously he was following the same rules as the ghosts. Now he tries to plan a human-like route, preferably taking routes which allow have pills to pick up. I’ve added a little debug route highlighter so i can visualise the decisions. Theres plenty of bugs in this and lots of places to improve it, but the basic framework of decision making is starting to take form, and a quick and dirty A* path finder can handle most situations, im going to need.
Secondly the junction arrows can now be swiped to activate them in a given direction. This feels really nice on tablets. The stay highlighted for a short time. Eventually this will form the core of the gameplay, which should start to emerge on the next update.
Gameplay is about to be added, but just got a little stuck on this version with a brandy coffee! Its a bit weird and hypnotic (to me!) Probably not helped listeing to this… http://soundcloud.com/djshadow/all-basses-covered-the