Programming

Blog posts in this category:

Debugging Techniques

Categories: Programming
Posted by: the_handy_vandal

Some useful tips on debugging your code from roel at devmaster.net. This is in response to a question about collision detection in C#, but the same techniques apply to a wide range of situations in game programming.

roel writes: “Use your debugger to find out what happens …. If the problem occurs arbitrarily, this is usually my approach:

  • make your code work deterministically: fixed timesteps, random number generators with fixed seeds;
  • add a frame / iteration counter;
  • add code that detects your problem “player is one pixel above the ground” and then outputs that counter;
  • run your program and remember the value of the counter;
  • add a breakpoint when that counter is reached so that your debugger kicks in in advance of the frame/iteration where the problem occurs;
  • restart your program and wait until the breakpoint is reached;
  • step through it and see what went wrong and fix it.”
 

Infiltration

Posted by: the_handy_vandal

“Javascript- and browser-based games offer a very low barrier of entry.”
– Zach Johnson

Infiltration
Indie-game developer Zach Johnson is the author of Infiltration:

Infiltration was built in response to blog Boing Boing’s call for games to be developed that were inspired by “chip music”. Most likely very familiar to gamer cycles but not far beyond, chip music is inspired by early video game soundtracks. Think Asteroids, Pac Man and a host of Nintendo games. Grab a Casio keyboard and hang on …

Johnson, a fan of this unique musical genre, has spent more than his fair share of time listening to chip music and envisioning the game activity that it might accompany. A User Experience developer at Worrell, he says, “Video games contributed to shaping my entire career in computers.” It was clearly a natural for him to develop a chip-music-inspired game.

Indie-game-developer game designs tend to be very simplistic, with an almost nostalgic look and feel. “Part of the design is a nod to the old-school music, but it’s probably more about the amount of time and money indie game developers have to spend on the games.” He goes on to note, “It took nine people a year to write Pac Man; I wrote this in about 30 hours.”

Johnson also saw an opportunity to advance his passion for open programming. “I wanted to make a game that didn’t need a plug-in.” Hence the use of Javascript, allowing the ability to play the game directly from your browser. ” Javascript- and browser-based games offer a very low barrier of entry,” notes Johnson.

Phil Wilson @ minnpost.org

 

Caspian Learning Launches Simulation-Focused Web Deployment Tool

Categories: Game Design, Java, Teaching
Posted by: the_handy_vandal

Caspian Learning is now offering development tools for web-based simulations, including first-person over-the-shoulder view in 3D worlds:

Thinking Worlds editor

Simulations and serious games created using Caspian’s Thinking Worlds authoring tool may now be accessed online via Shockwave and Java, obviating the need for game-specific browser plugins.

The new functionality is made possible thanks to a recent core Thinking Worlds update integrating Java Applet and Java Webstart development. Java deployment will be available to all Thinking Worlds users in the next version release.

Thinking Worlds logo“Java technology is present in almost all of the world’s corporate and military networks,” notes Lee Rushworth, Marketing Executive for Caspian Learning. “Having the ability to rapidly create and publish simulations into these secure networks without the need for additional 3rd party plugins removes another huge barrier to the widespread adoption of simulations for training and performance within these sectors.”

Danny Cowan @ Serious Games Source

Now there’s an interesting observation: “Java technology is present in almost all of the world’s corporate and military networks.”

 

Snake Game Design Question

Posted by: the_handy_vandal

Stack Overflow is a useful resource for programmers — a repository of individual questions and collective responses, by and for programmers.

Someone recently asked a Snake Game Design Question:

I’m trying to make a snake game with additional functionality where snake can eat different types of food some of the foods will give it special powers for some time. like that

For designing diff. food i’m making a food interface. And all types of food implement it. So that using only Food’s ref. i can create any type of food.

The only power is representing a power. I can represent it either on board or in the snake. Snake is the best option as it seems to be more logical. Can any one tell me how am i suppose to represent it??

Snake is a classic game — one of my favorites.
Snake
Wikipedia states: “Snake is a video game first released during the mid 1970s in arcades and has maintained popularity since then, becoming somewhat of a classic. After it became the standard pre-loaded game on Nokia phones in 1998, Snake found a massive audience.”

The Stack Overflow responses include:

You might want to take a look at the Template Pattern or the Decorator Pattern.

The basic idea would be that your “Snake” would have its operations exported into a module tree which are called. So for instance Snake.Move() would really just check to see if there was a move modifier (as provided from your “powers”) otherwise it would default to its own internal move object. Depending on how you implement it the power could replace, temporarily override, or cascade its effects.

And:

You could create a base powerclass of which every food holds a reference. Every food this way can have a certain power.

For every power, you inherit form this base powerclass.

the moment you eat the food, the power class is transferred to the snake. The snake could hold one reference (to the last eaten power), or even a list of powers (if multiple powers can be active at the same time).

And:

Yes, per snake is more flexible. If you were to make it a multiplayer game then each snake would have its power.

What you seem to be missing is Power->Food mapping. But that really depends on whether or not one Food gives many Powers or one Power can have different powers.

Well there are many ways how you can do this. Most basic I can think of is having a static method that will produce a different powers when passed different type of food. Whenever your snake eats something you call
SuperPower.onNomNom(FoodEaten)

 

FlashPunk ActionScript Library Released

Posted by: the_handy_vandal

Flash developers may be interested in FlashPunk, a Flash ActionScript library:
Flash Punk

Chevy Ray Johnston (Beacon, Skullpogo) has released FlashPunk, his own ActionScript library designed to offer “a fast, clean framework for prototyping and developing games”. He’s not only put the tool online for free, he’s posted some online documentation, written a beginner’s tutorial, and setup forums.

FlashPunk is specifically geared toward creators who like to work with with 2D raster/bitmap graphics, as opposed to vector graphics. “It can manage thousands of animated bitmap sprites on-screen at a time without slowing, a lot faster than Flash normally could, because it operates under the assumption that your game primarily uses bitmapped graphics,” explains the developer.

- FlashPunk ActionScript Library Released @ Game Retail Store

 

Virtual Humans to Teach Emotion Recognition and Programming Logic

Posted by: the_handy_vandal

This looks interesting — !

Digiplay InitiativecMotion: A New Game Design to Teach Emotion Recognition and Programming Logic to Children using Virtual Humans

Publication Type: Journal Article
Year of Publication: 2009

Authors:
Finkelstein, S. L.
A. Nickel
L. Harrison
E. A. Suma
T. Barnes

Journal IEEE Virtual Reality 2009, Proceedings

Abstract:

This paper presents the design of the final stage of a new game currently in development, entitled cMotion, which will use virtual humans to teach emotion recognition and programming concepts to children. Having multiple facets, cMotion is designed to teach the intended users how to recognize facial expressions and manipulate an interactive virtual character using a visual drag-and-drop programming interface. By creating a game which contextualizes emotions, we hope to foster learning of both emotions in a cultural context and computer programming concepts in children. The game will be completed in three stages which will each be tested separately: a playable introduction which focuses on social skills and emotion recognition, an interactive interface which focuses on computer programming, and a full game which combines the first two stages into one activity.

- Digiplay Initiative

Philip K. Dick: android headHow very Phildickian: machines to teach children how to recognize human emotions. Martian Time-Slip comes to mind, with its teaching simulacra based on historical figures, e.g. the Abe Lincoln sim teaches self-reliance and related moral values. See also Do Androids Dream of Electric Sheep?, where androids — living secretly among us — are more human than real humans. And don’t forget: We Can Remember It For You Wholesale. Then again: We Can Build You. And, inevitably: The Simulacra.

In the gaming field, Valve deserves special recognition for pioneering the memorable virtual humans of Half-Life, Half-Life 2, and subsequent games. From elaborate models and scripted sequences to persuasive non-player AI to facial animation and voice sequencing, Valve has advanced game technology like no other company.

Halflife scientist administers CPR

 

OOP Game Design Theory

Posted by: the_handy_vandal

Question posted over at Stack Overflow:

I’ve tried to develop a 2D game with C++ in the past using mere objects, however, in the design process I don’t know how and what parts of the engine I should split into smaller objects, what exactly they should do and how to make them interact with each other properly. I’m looking for books, tutorials, papers, anything that explains the game engine design in detail. Thanks.

From the comments:

“You might want to take a look at XNA if only to see how the main game loop works.”

“Don’t use “mere objects”. Use whatever makes sense. Your game doesn’t have to be strict OOP. It has to work, and it should preferably be nice, well-structured code. Neither requires OOP. Write your game using every tool available. Classes, functions, functors, templates, procedural programming, object-oriented programming, functional programming, generic programming, whatever fits the task at hand. Don’t limit yourself to OOP just because some people 20 years ago thought it was the holy grail.”

“Mandatory reading: http://scientificninja.com/advice/write-games-not-engines

“Why do you think you need a game engine? Write the code you need in order to implement your game. Modify it along the way as requirements change. And when you have a complete game, take a step back and look at what the result looks like.”

“I like the try & refactor approach. Crafting OO design takes experience.”

“Even with experience, it’s still 1) impossible, and 2) a bad idea to try to come up with a complete detailed design before implementing it. There’s a reason the whole “agile” thing has caught on so much. You will encounter issues you hadn’t thought of, so make the design decisions when you’ve got the information you need — that is, when you’ve tried to implement it, and found out what all the pitfalls are.”

“Give this a try: http://www.devmaster.net/articles/oo-game-design/

“If you haven’t made a game before, how can you make an engine? There’s tons of free engines out there or you will be spending 20 years trying to get something done because you will be rewriting over and over again.”

“What makes a game good is the content not the engine, all good programmers ‘borrow’ other peoples code whenever they can.”

“Eberly’s 3D Game Engine Architecture and 3D Game Engine Design are rather heavy on the theory, but cover all of the bases quite well.”

- OOP Game Design Theory @ Stack Overflow

My own opinion: Don’t write a game engine. Start with an existing framework. Work within the framework, or modify the framework to meet your needs.