Recent projects & game development

Haven't posted anything in a while, so thought I would just maybe give some advice over general things I've learned lately, and perhaps some resource links :).

ClearCharity, the name of an application I built with another developer that goes on top of the Shopify platform. In short, it gives you the ability to publish a charity for a given period, so users can donate directly, or a percentage of your sales can be contributed to the charity. It keeps track of such information, and you can setup various milestones for automated social integration. This is about ready to go into beta for first release, and we have some ideas on how to take it further.

I recently participated in the LD48, which is essentially 48 hours to do a solo project of a game from start to finish. It was the first one I did, and while I didn't get very far, I learned a lot. For game development, I'm using jruby and the Slick2d library on top of it. Peter Cooper did an excellent job on a tutorial of how to get this going. It was a really simple game. You constantly fall. If you touch the lava, you die. You can click anywhere to teleport. If you kill an enemy, you gain 1 second of immunity.

Transient

Learnings from game development

Game development is tricky. It's definitely a very math-oriented style of programming, as you need to write more complex loops to solve problems, mathematical calculations for collision detection, drawing, physics, etc. But it's also a lot of fun. As I have made small improvements and added functionality to my games, I've found it extremely rewarding. If you're looking into gamedev but haven't done it much yet, definitely start small. Choose a platform you want to use, and sick with it. Use it to build games like:

  • Pong
  • Tetris
  • Minesweeper
  • Scaled down mario clone

The point is to keep scaling up in difficulty on what you can build. Even if the art looks like crap, I suggest making your own at least to get a feel on how to do it. For LD48, mine looked pretty awful, but it was fun learning how to use Pixen and TiledMap Editor.

Structure

Even if you decide to use mostly base language APIs and not a framework such as slick, or pygame, I recommend looking at one to see how they structure their code. Most of these have a few methods such as:

  • init
  • render
  • update

Init can often just be the constructor, but it's meant to run once when the object is initialized, or after the constructor is executed.

The render method is what draws everything. Generally using some sort of graphics object, you can draw various objects to the screen here. This is meant to be called in the gameloop, usually after update.

Update is essentially what updates the data for your objects. So if you have a ball bouncing around, its x & y values would change as necessary. It's important to pass the time in milliseconds past from the last frame to now to your update method. This so you can multiple your x & y values by that delta, so things move the same amount regardless of framerate. Most game libraries I've used handle this for you.

The game loop

The game loop is the main loop of the application that keeps things kicking. It usually starts when your main class or code is executed, and will go until some sort of escape and exit command is fired. This can be the escape key, closing of the window, or in text based games, a text command. Again, mananging the game loop is often delt with by various frameworks. SFML does have you write it out, but it's just a matter of writing a while statement based on the condition of a built in method.

As stated above, tracking the time difference between the last frame and the current one is crucial for smooth and consistent gameplay.

Resources

Some resources I use can be found here:

  • r/gamedev. Can't thank the community on reddit here enough. A lot of great posts and links can be found on that sub reddit. Great discussions on topics, tools, etc.
  • Simple games to clone again from reddit, but a great list if you want some alternatives for games to remake.
  • Art tools again credit to our good friends on reddit for putting this together. I use pixen on the mac, as I found it to have most of the features I needed.

Upcoming

I am working on a sidescroller in JRuby at the moment. Just doing the basics such as rendering backgrounds created in Tiled. Working on the jump algorithm at the moment. However, I'm considering getting back into something more web related: Sojourner. While that's a link to my dev blog, in short the game I was working on there is meant to be a browser turn based combat game involving ships and sub modules. While the screens I show there work well on desktop, the experience doesn't make sense at all in mobile. Most of the team members including myself have been busy, but I personally would like to get this going. We all maintain a pretty consistent contact with each other. The others I work with are mostly in the design and 3D design space, giving us a nice range of team members.

I try to keep that blog functioning for development over this one, but I can always post links on my twitter.