Category:

Programming

Snake Game Design Question

Tuesday, January 19th, 2010 at 10:59 pm - No Comments »

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)

 
Dateline: Tuesday, January 19th, 2010 at 10:59 pm - No Comments »
Author: the_handy_vandal
 
 
 
Divider

FlashPunk ActionScript Library Released

Saturday, January 9th, 2010 at 2:46 pm - No Comments »

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

 
Dateline: Saturday, January 9th, 2010 at 2:46 pm - No Comments »
Author: the_handy_vandal
 
 
 
Divider

Virtual Humans to Teach Emotion Recognition and Programming Logic

Wednesday, January 6th, 2010 at 8:32 pm - No Comments »

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

 
Dateline: Wednesday, January 6th, 2010 at 8:32 pm - No Comments »
Author: the_handy_vandal
 
 
 
Divider

OOP Game Design Theory

Tuesday, January 5th, 2010 at 10:48 pm - No Comments »

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.

 
Dateline: Tuesday, January 5th, 2010 at 10:48 pm - No Comments »
Author: the_handy_vandal
 
 
 
Divider