WebPad: Bring your Own Controller
Going to take a break from my Useless Designer series to talk about a personal project which has me very excited. While judging Dare I came across a good idea which could be brilliant: using a mobile device as the controller in a shared space. The idea was shown by Lucky Ghost using the iPhone and a native iOS app. However, Apple would never let it through the AppStore and not everyone likes Apple. The idea was good but limited, but then a solution hit me there and then and I excitedly shared it with them.
The game hosts a web-service providing HTML5 WebApp with WebSockets transforming any modern mobile device into the controller.
Project Humps
This LudumDare I was hit by a blaze of inspiration. I was soooo excited by this project!!! Then the truck of problems ran me over, several times.
Build a 3D Spatial Puzzle based on a secret phrase. The phrase is revealed when the person completes the puzzle.
Then I opened Unity3D and it constantly hit me with minor irritations, though to be fair I've gotten over most of those. The real stumbling block is lots and lots of obscure Math and Niggly technical problems.
Now an interesting problem is exciting and one which you can get your teeth into and gets you excited. One example of this is the generation of the spatial puzzle. Which is awesome procedural content generation.
No I'm talking about stupid little math problems, rotations, parenting and frankly silly stupid problems. Stuff which on paper is stupidly simple. Things like smoothing out camera behaviours, improving physics performances and glitches.
I think I can safely say 90% of the project has been hung up on technical glitches and minor issues. Not sure if I'm going to continue. Taking a breather and thinking about it again.
Prototype - Click to Try
WASD + QE = Camera Controls
Space = Break-up & Rotate Drag Piece
Left Mouse = Select Object
Right Mouse Drag = Drag Object Around
When in doubt, break it down
I can point to countless notebooks some of which date back to some of my first programming experiments in my pre-teen years. One problem which I've never felt happy about are TILES.
Now I've always had a bit of a love affair with tiles but also an obsession with clean logic. Sadly tiles require some dirty link ups when working in an animated 2d or 3d world not built out of tiles but instead pixels or some floating point algebra.
Not to mention the issue of WALLS!!! Does tile A or B own the wall, or does it exist in wall space. Do you split the wall down the middle? In the case of wall space does the tile extend underneath it?
These all have quick and dirty answers but I don't like working like that. Sadly I've never been called on professionally to look at the tile problem. If I ever had I'm sure the sanity of deadlines and my team would have made the problem almost trivial filled with arbitrary choices.
So yeah the game I've been working on was stuck in limbo for a month while I fought with data formats, and variety of ways of representing the data. Not to mention a bunch of stupid graphic glitches.
Solution
Bless Sophie and her balance of manic development with apathy. After a coffee and my ranting about the tiles I realised how stupid it was and in one day rewrote it from scratch. In a horrible hacky memory inefficient way. Though my stubborn self and experience found the hacky method worked and then was easily smoothed out. I honestly couldn't tell you if it is the best solution but it is a solution!
For those curious I went with the concept of wall space which overlaps with tiles and belongs to no tile. So it has additionally memory overlap but no convoluted calculations involving bitmasks, or bit shifting.
So hopefully I can move on from here and just place objects in the world and then get some guys running around the room X-Com style.
Chess and Unity
So the big milestone for the Data Driven Dialogue project is in and frankly it needs some time to sit on the shelf while I gather my thoughts for a fresh assault. So I set about learning Unity, something I've been interested in for a long time as a prototyping tool.
The first thing I will say, and I found this with XNA as well, is 90% of the tutorials, resources ect... are worthless to anyone with any base level knowledge. Throw them out, you just need a quick run though the UI, and some quirks pages. All of 10 mins then just use your gathered experience and the reference docs from there on out.
Now when learning new tech two of my favourite test projects are Pong and Tetris. I immediately dismissed these however as Unity made both very easy with its built in functionality, and I knew I wouldn't learn much because I wouldn't need to solve too many problems. I immediately settled on Chess as a well defined game because as anyone who has worked with high level world based tools knows.
- Using any coordiante system for game logic not directly tied to render space is a pain
- Object and Game logic conflict requiring you to split things up
- State based animations and effects can be a pain
- A simple chess AI is a nice little work-out
So yeah I'm tinkering away with that at the moment. Slowly building more layers of complexity on top of it till I'm satisfied I know Unity well enough for a real project I have in mind.
Oh and if you asked why I'm writing a boring Pong / Tetris / Chess game to learn Unity when I could be making Cool Idea #63? The answer is simple always learn new tech with a pre-defined and tested design. Otherwise you will compromise the design to avoid problems rather than be forced to overcome them. The goal is to learn the tech not to make a super awesome game.
Cave Generator
Working on my Cave Generator.
Task List
- Trace Wall Outlines
- Smooth Lines
- Generate 3D Geometry
Podcast #1: Cross Platform Development
We are back guys, the new site is launched and the first podcast is up.
I grab Tim Kelsey & Neil Richardson to discuss cross platform development. In a world with iPhones, PS3, Wii and PC how do we write code across all these systems. That question is put on the table and we hear two different approaches.
Please provide feedback and suggest new topics on our Topics Suggestion Page.
Array vs Group Confusion
Array vs Group Confusion
Arrays are listed as { }
Groups are “- - -” boxes
So some graph confusion between arrays and groups. It’s very clear on the graph but the query starts looking strange. Really tired and not making progress.
So going home, grabbing some food and hopefully I can clean up the mess in my head.
Shadows are EVIL
Shadows are EVIL!
Okay above you see rough and blurred. The rough pass uses a single sample against the depth buffer. Those bloody pixels are a result of the resolution of the shadow map.
The blurred insanity is a shadow method called PCSS, based on the White Paper, “Integrating Realistic Soft Shadows into Your Game Engine” by Kevin Myers, Randima (Randy) Fernando, & Louis Bavoil. Sadly some of there stuff uses Shader Model 4 so I did my best approximation.
Not happy with either method… pulling my hair out.
To Debug it… Draw it
To Debug it… Draw it
Many people will tell you this but whenever you have a problem try to visualise it. This can be applied to almost everything (except cases where visualisation is a constraint, think advanced maths and quantum). So above you see the debug frustum.
Well after fighting with all these various problems I’m thinking to myself… I need to double check my Frustrum. Five minutes to write and BAM problem is instantly visible. The problem I was debugging for 5 hours solved in 5 minutes.
Printf & Debug Draw rocks.
Problem: Shadows giving strange LightViewSpace results
Well the problem manifested in many ways. I was debugging shaders and tweaking render targets. Not to mention twiddling the depth bias so often that it was indecent.
The problem was two fold. Firstly the sun view & position didn’t match up. The result of a quick hack to get the sun in the right place, hacks bad. The second issue was todo with the scene bounds.
The view matrix is built with a look-at call. Well the key is that the centre of the bounds must be equal to the look-at target. Why is this? Well draw some random shapes on an A4 page. Now draw a circle which contains all those objects. Now measure the radius of the circle and draw a square at the centre of the page with double that length per side.
You see the problem, unless the circle is at the centre of the page their will be bits of it outside of the box, which means they won’t be shadowed.
So you compensate for offset and increase the radius. To do this instead of measuring the radius of the circle measure the distance from the centre of the page to the furthest point of the circle.
Before you ask we can’t move the box from the centre of the page as that would change the angle the light was coming from.
Onwards and upwards.
The shadow is low quality due to…
Wooot!
Progress, the shadow is low quality due to PC card limits. I need to add some bias to avoid flicker, and smooth off the edges to get soft shadows.










