Monday 7 November 2011

Control issues

I have them. When it comes to games, at least. Really good controls is what makes a game "perfect", in my opinion. It's for good reasons that every time "best games ever" comes up, games like Super Mario Bros, N and Counter-Strike makes it into my list. These games have very well-honed controls and when learnt, it feels like you have a perfect connection to your avatar, and any mistake made in the game is your fault - exactly as it should be.

It's also about removing obstacles to accomplishing the goals and having effective controls in more ways than that - I couldn't play Warcraft 1 because I happened to play Warcraft 2 first - the controls were that much better in #2 so I just got frustrated.


So, obviously, while not hoping or even aiming for perfection, I need to have good controls in my game. I read somewhere that when Nintendo makes a Super Mario game, they build the character first, then run and jump and play with it until it feels perfect - and then they build the game around this great-feeling character. Whether that's true or not, doesn't matter, sounds like a recipe for greatness!


Also, since there's only a short, short month available for the project, and I'm not cutting down on other fun (well maybe in the end...) effectiveness is key. Nowadays everyone knows about fancy-schmancy terms like Extreme Programming, Agile or SCRUM and those are good tools for working with a customer to get the right things done as quickly as possible, as long as it's done right. But if you want to boil it down for really small teams (like my one-man team) and especially with no actual customer, the principle is to look at the project all the time and think about what is the most important next step for having a playable and fun game? Or, "if I have to turn this in tomorrow, what would make the most impact to do today?"

First step might be to have a program running at all, the next maybe to have a player sprite... then steering it, or maybe having some ground for it to interact with? Depends on the goal, of course.

So, good controls. I need a player, and being able to alter gravity to steer the player, and I need an example level to get the good feeling from. If I nail that, level design and goals can come later.

I'm using 2D-physics from Box2D and I've decided to use a simple ball rolling around + lots of smoke and mirrors to make it look like a skateboarding experience instead. But how to setup the test level? First, I was going to plot a level using squares and rectangles at different angles, forming slopes and slides and so on for collisions. But, how to put them on the level and update them? Enter lots of numbers by hand? Build a level editor (DANGER! DANGER!)? Seemed that way, I'd spend a lot of time not focusing on the game. Also, ideally, I would like to be able to be liberal in how the levels should look, preferably hand drawn by good designers.

So, here's where I may or may not have gotten side-tracked - I'm not actually sure myself. Anyway, I used Inkscape to draw some simple example levels, then wrote a tool to convert those paths to collision meshes and export the image as well. I had great help from some example code I found on a blog, so it didn't take almost any time to get it prototype 1 up and running: running on my phone, I could rotate all the way around to control gravity and thereby steer a ball with pretty good control. On top of that, already a good basis for level editing, Inkscape is already available and there's tons of stuff to extract from the drawings, can probably use it to place enemies and goals etc as well.

Very first level in Inkscape

On phone: down in the pit
On phone: successful escape!

Before I can really get down to nailing the feeling though, I need the ball to look like a skateboarder instead, and oh boy here comes trouble! There's a LOT of things going into creating that illusion:
  • Knowing what surface the skater is on
  • On what side of the surface
  • The angle of the surface
  • Maybe merging angles of multiple surfaces
  • Rotating properly a sprite that is irregular and off-center
This really took a long time to get it all right. For the technically interested, I:
  • Skipped triangulation and just use edge shapes (basically lines with collision)
  •  Make sure that only complete polygons are used for the level shapes, and find out if they are clockwise wound or not - this deals with "which side"
  • Precompute angles for all surfaces in level tool
  • Grab the angles from this when the player collides with a surface and rotates the player, whicle at the same time positioning according to where the ball is
Lots of this seems kinda obvious when you know about it and why, but it took me a couple of days of accomplishing nothing until finally it all fell into place. Had some great help in forums and on Google, once I knew what questions to ask.



On phone, held upside down - a sk8er boi!
So. One week done and gone (not that I've worked on the project all the days...) and I can now start tweaking the feeling and also figure out what the key game elements should be. Probably gonna go with running for time, like N, but am unsure about enemies, puzzles etc. Time will tell!

1 comment:

  1. Wow... Stoffe, you are doing some serious cool stuff here. Looking forward to a play test soon!

    ReplyDelete