# Question
Title: What are the other three "game dynamics"?
Seth Priebatsch recently gave a tedtalk entitled “Building the game layer on top of the world.” In it, Seth described four “game dynamics,” techniques used by game designers to make games fun and addictive. The four dynamics that Priebtsch described were:

1. Appointment dynamic-a dynamic in which to succeed, one must return at a predefined time to take a predetermined action. (Real life example: happy hour)
2. Influence and status-the ability of one player to modify the behavior of another's actions through social pressure. (Example: different color credit cards as a reflection of status)
3. Progression dynamic-a dynamic in which success is granularly displayed and measured through the process of completing itemized tasks. (Example: linkedin profile progress bar)
4. Communal discovery-a dynamic wherein an entire community is rallied to work together to solve a challenge. (Example: finding interesting content on Digg.com)

Seth explained these four game dynamics in his talk and added that his company has an additional three. Does anyone know (or have any theories) about what the other three game dynamics are?

# Answer
> 11 votes
What he said in his speech is "...with seven game dynamics you can get anyone to do anything..." there was the implication that there were *only* four more. Then I did some digging and found: http://techcrunch.com/2010/08/25/scvngr-game-mechanics/ If the site I accessed is at all correct, there are not four more game dynamics - there are **forty four** more (for a total of 47). \>phew\< Instead of listing them all here - just visit the link. :)

# Answer
> 13 votes
From the MDA paper:

> 1. Sensation: Game as sense-pleasure
> 2. Fantasy: Game as make-believe
> 3. Narrative: Game as drama
> 4. Challenge: Game as obstacle course
> 5. Fellowship: Game as social framework
> 6. Discovery: Game as uncharted territory
> 7. Expression: Game as self-discovery
> 8. Submission: Game as pastime

Certainly sounds close, though not quite the same.

# Answer
> 5 votes
A word of warning: it sounds from your description like Seth is talking specifically about Facebook and other "social media" games. If those are the kinds of games you're designing then great, but be aware that the entire space of game design is much larger. (As others have said, the world has more than 7 dynamics.) If you want to know the other 3 that Seth was referring to, I'd suggest playing a bunch of Facebook games and looking for patterns. I'd be shocked if "set collection" isn't one of them.

Another thing to be aware of: there is a difference between Mechanics and Dynamics, and what you're listing are actually Mechanics. It's good to be clear about exactly what you're looking for.

The MDA paper (referenced in coderanger's answer) is talking about kinds of fun (what the authors refer to as "aesthetics" rather than mechanics and dynamics), although that paper does a good job explaining the difference. Note also there are other kinds of fun beyond these, as the authors admit.

# Answer
> 3 votes
Here's my *guess*: one of them is **scarcity**. It's like (in the real world) a closing down sale (or any sale): it's now or never. Various games have limited resources which you *must get* to beat your opponents. Think of the ore miners in Command & Conquer.

# Answer
> 3 votes
I think he actually left out 4 major points (as opposed to 3). These are my guesses based on experience.

**Economies** \- Not only do you earn points and level up but you may also spend them at your own will. For instance, look at the bounty system on Stack Exchange sites... I had a burning question to ask that was getting no feedback and had no reputation to spend on it, so I spend 4 days answering a ton of questions so I could post a juicy bounty (and it got me a great answer). There are players in China that play World of Warcraft as a full time job dubbed gold miners because all they do is run around collecting gold in the game to sell online for real money. The same was also true in Diablo II where some of the items were so rare than out of the hundreds of thousands of players playing at any given time over the course of a few years would only find a couple. The rarest item (a Zod rune) of which only one had been found after 3 years of gameplay sold for a reportedly 1100 USD on ebay. If games are the future of social engineering, than Blizzard Entertainment are poised to take over the world because they are the masters. I quit playing World of Warcraft after two weeks because I could tell that the game was more designed to have go on forever, be relatively boring and slow moving, while being designed to be extremely addictive (I had been through a pretty extensive Diablo II phase in the past and learnt that lesson).

**Identity** \- Not only is it important to be able to level but it's important to be distinguishable as an individual. Whether that means that you use a alias as your handle or you use your real name. That's what made Facebook win over MySpace. By getting people to use their real names, not only was it easier to find your friends (past or present) online but, by attaching real identities to the handle, most of the trolling/trash talking/spaming/lurking stopped because the people taking part in it could be held accountable. Stack Exchange sites do this by adding the profile to each user's account. World of Warcraft does it by allowing you to customize your character in many ways to look unique. Tiger Woods Golf, as well as Nintendo Wii and XBox360 does it by allowing you to create a custom 3D avatar. Twitter, Stack Exchange, and many other social networks do it by allowing you to respond to a unique user by adding the @ prefix to their name making it easier to have a direct dialog instead of the typical 'talking to a wall' experience of commenting systems that don't use it (IMHO the single greatest simple innovation in social networking ever).

**Scarcity** \- Blizzard have mastered this since the days of Diablo I with the 'normal item', 'magical item', 'rare item', 'unique item'. In the early parts of the game, normal items work. As it gets harder magical items become a necessity. Harder still and rare items become a must. Then unique items. Then (in the case of Diablo II on hardest difficulty) they went as far as to make it near impossible to beat without working as a team. As I remember the trade for unique items was a pretty brutal marketplace. It took a lot of work/time/effort on the hardest difficulty to gain worthwhile unique items and it was always a hard bargain to trade for them. World of Warcraft took this a magnitude further by creating the automatic-auction system that mimics ebay to sell items online over the course of a pre-defined time allotment.

**Social Dependence** \- In World of Warcraft, It's a lot harder (sometimes impossible) and a lot less fun to play alone. That alone makes it necessary to socialize and group up with other players. In Call of Duty, if you have a decent team all with headsets you gain a huge advantage by being able to share intel on the other team and coordinate attacks. A lot of services sold today offer the 'sign up a friend and save x amount on your first bill' bonuses. Facebook offers the like button and ability to comment on other's posts. Without comments and approval micro-blogging becomes pointless. Ever since the earliest games, the multi-player option has always been a necessity because once you beat a game on single player, there isn't much point in beating it again (IE, the story line is over). Multi-player games enable humans to play together or against each other. In almost every game I've ever played multi-player, with an equal set of advantages/disadvantages the human is always harder to play. About the upper limit of a single player game for playability length is about 60-100 hours of content. Anything beyond that feels tedious. With multi-player, it becomes unlimited (or until the next great multi-player game comes out) because human strategy is dynamic. A top sniper spot on one map one day may become common knowledge in a week thereby making it an easy target. Sometimes, there are anti-strategies where picking a strategically poor position may be a huge advantage because it is unpredictable. The only games where a computer can consistently win are lame algorithmic games with really limited sets of rules and dynamics like chess (IE the computer can calculate every possible move and counter-move before playing out its turn). IMHO, chess is too simplistic to be a chess game. I prefer to place it in the category of mental masturbation. The best part about social dependence is, the game sucks without your friends so you have to get them involved. How much more viral do you get than that. That's how MySpace and Facebook became successful. Nobody wants to have 0 friends online.

# Answer
> 2 votes
http://www.youtube.com/watch?v=Yn9fTc\_WMbo#t=4m09s

> Back at scavenger we like to joke that with seven game dynamics you can get anyone to do anything, so today I'm going to show you four because **I hope to have a competitive advantage at the end of this still.**

You certainly won't get the other three out of him. :)

---

None of those four discusses **creating a history of experiences**. I think this would be a good one; take Minecraft, for example. A whole community has arisen out of Minecraft because it is so open-ended that people build things and remember those fun experiences long after their physical (virtual) manifestations have been destroyed or deleted. They continue to have fond memories, and hopefully continue to return to the game. The same can be said of many games; it's not only how you are currently playing the game but how you have played it in the past that gives you a good feeling of fun and excitement even after hundreds or thousands of hours of play time. And very few games have that.

---

I think we should ask Jeff Atwood and Joel Spolsky for their insight on this. After all, Stack Exchange is a perfect formula of these different "game dynamics" as evidenced by all the programmers now addicted to the sites.

# Answer
> 2 votes
Another *guess*: **creativity**. I'm thinking here of the Command & Conquer series and especially the various Sim games (most notably Sim City). Both give you huge amounts of *freedom* to *create* bases / cities etc. Games like Grand Theft Auto do it in a different way: multiple ways to solve the same problem.

Maybe, based on GTA, also **exploration** is also a motivation. But even in C&C exploration is part of the game, *discovering* what new units do. Perhaps **discovery**, then, is a better (more general) word than exploration.

# Answer
> 1 votes
Here are some possibilities:

**Problem solving**-A game should require of its players creativity insight and problem solving skills to progress. Examples: I'm completely addicted to pacman and tetris.

**Evolution**-progress in a game should be rewarded by opening new facets and changing the gaming experience. Examples: moderator tools provided to high reputation users on the stackexchange network.

**Productivity**-The sense that what you've done is somehow productive and useful in some way, even if its intangible and/or abstract. Not all gaming experiences offer this, but some that do have been surprisingly successful. I think this dynamic is the only way to explain the success of sites/projects like stackoverflow.com, wikipedia and opensource software.

**Edit:**

Not quite a dynamic but necessary for any successful game:

**Seamless interaction**-a neat, flawless and clear user-interface that does what the user expects it to do and does not overwhelm with choices.

---
Tags: game-design
---


# Question
Title: Data structures for interpolation and threading?
I've been dealing with some frame-rate jittering issues with my game lately, and it seems that the best solution would be the one suggested by Glenn Fiedler (Gaffer on Games) in the classic Fix Your Timestep! article.

Now - I'm already using a fixed time-step for my update. The problem is that I'm not doing the suggested interpolation for rendering. The upshot is that I get doubled or skipped frames if my render rate doesn't match my update rate. These can be visually noticeable.

**So I'd like to add interpolation to my game - and I'm interested to know how others have structured their data and code to support this.**

Obviously I will need to store (where?/how?) two copies of game state information relevant to my renderer, so that it may interpolate between them.

Additionally - this seems like a good place to add threading. I imagine that an update thread could work on a *third* copy of the game state, leaving the other two copies as read-only for the render thread. (Is this a good idea?)

It seems that having two or three versions of the game's state could introduce performance and - *far* more importantly - reliability and developer productivity problems, compared to having just a single version. So I'm particularly interested in methods for mitigating those issues.

Of particular note, I think, is the problem of how to handle adding and removing objects from the game state.

Finally, it seems that some state is either not directly needed for rendering, or would be too difficult to track different versions of (eg: a third-party physics engine that stores a single state) - so I'd be interested to know how people have handled that kind of data within such a system.

# Answer
Do not attempt to replicate the whole game state. Interpolating it would be a nightmare. Just isolate the parts which are variable and needed by rendering (let us call this a "Visual State").

For each object class create an accompanying class which will be able to hold the object Visual State. This object will be produced by the simulation, and consumed by the rendering. The interpolation will easily plug in between. If the state is immutable and passed by value, you will have no threading issues.

The rendering usually does not need to know anything about logical relations between the objects, therefore the structure used for the rendering will be a plain vector, or at most a simple tree.

## Example

### Traditional design

```
class Actor
{
  Matrix4x3 position;
  float fuel;
  float armor;
  float stamina;
  float age;

  void Simulate(float deltaT)
  {
    age += deltaT;
    armor -= HitByAWeapon();
  }
}

```

### Using Visual state

```
class IVisualState
{
  public:
  virtual void Interpolate(const IVisualState &newVS, float f) {}
};
class Actor
{
  struct VisualState: public IVisualState
  {
    Matrix4x3 position;
    float fuel;
    float armor;
    float stamina;
    float age;

    virtual auto_ptr<IVisualState> Interpolate(const IVisualState &newVS, float f)
    {
      const VisualState &newState = static_cast<const VisualState &>(newVS);
      IVisualState *ret = new VisualState;
      ret->age = lerp(this->age,newState.age);
      // ... interpolate other properties as well, using any suitable interpolation method
      // liner, spline, slerp, whatever works best for the given property
      return ret;
    };
  };

  auto_ptr<VisualState> state_;

  void Simulate(float deltaT)
  {
    state_->age += deltaT;
    state_->armor -= HitByAWeapon();
  }
}

```
> 4 votes

# Answer
My solution far less elegant/complicated than most. I'm using Box2D as my physics engine so keeping more than one copy of the system state isn't manageable (clone the physics system then try to keep them in sync, there might be a better way but I couldn't come up with one).

Instead I keep a running counter of the *physics generation*. Each update increments the physics generation, when the physics system double updates, the generation counter double updates as well.

The rendering system keeps track of the last rendered generation and the delta since that generation. When rendering objects that wish to interpolate their position can use these values along with their position and velocity to guess where the object should be rendered.

I didn't address what to do if the physics engine was too fast. I'd almost argue that you shouldn't interpolate for fast movement. If you did both, you'd need to be careful to not cause the sprites to jump around by guessing too slow then guessing too fast.

When I wrote the interpolation stuff I was running the graphics at 60Hz and the physics at 30Hz. It turns out that Box2D is much more stable when it is run at 120Hz. Because of this my interpolation code gets very little use. By doubling the target framerate the physics on average updates twice per frame. With jitter that could be 1 or 3 times as well, but almost never 0 or 4+. The higher physics rate kinda fixes the interpolation problem by itself. When running both the physics and framerate at 60hz you might get 0-2 updates per frame. The visual difference between 0 and 2 is huge compared to 1 and 3.
> 3 votes

# Answer
I've heard this approach to timesteps suggested quite frequently, but in 10 years in games, I've never worked on a real-world project that relied on a fixed timestep and interpolation.

It seems generally more effort than a variable timestep system (assuming a sensible range of framerates, in the 25Hz-100Hz sort of range).

I did try the fixed timestep+interpolation approach once for a very small prototype - no threading, but fixed-timestep logic update, and as-fast-as-possible rendering when not updating that. My approach there was to have a few classes such as CInterpolatedVector and CInterpolatedMatrix - which stored previous/current values, and had an accessor used from the render code, to retrieve the value for the current render time (which would always be between the previous and current times)

Each game object would, at the end of it's update, set it's current state in to a set of these interpolatable vectors/matrices. This sort of thing could be extended to support threading, you'd need at least 3 sets of values - one that was being updated, and at least 2 previous values to interpolate between...

Note that some values can't be trivially interpolated (e.g. 'sprite animation frame', 'special effect active'). You may be able to skip interpolation entirely, or it may cause issues, depending on your game's needs.

IMHO, it's best to just go variable timestep - *unless* you're making an RTS, or other game where you have a huge number of objects, and have to keep 2 independent simulations in sync for network games (sending only orders/commands over the network, rather than object positions). In that situation, fixed-timestep is the only option.
> 2 votes

# Answer
> Obviously I will need to store (where?/how?) two copies of game state information relevant to my renderer, so that it may interpolate between them.

Yes, thankfully the key here is "relevant to my renderer". This might be no more than adding an an old position and a timestamp for it into the mix. Given 2 positions you can interpolate to a position between them, and if you have a 3D animation system you can typically just request the pose at that precise point in time anyway.

It's quite simple really - imagine your renderer has to be able to render your game object. It used to ask the object what it looks like, but now it has to ask it what it looked like at a certain time. You just need to store whatever information is necessary to answer that question.

> Additionally - this seems like a good place to add threading. I imagine that an update thread could work on a third copy of the game state, leaving the other two copies as read-only for the render thread. (Is this a good idea?)

It just sounds like a recipe for added pain at this point. I haven't thought through the whole implications but I'm guessing you might gain a small bit of extra throughput at the cost of higher latency. Oh, and you may get some benefits from being able to use another core, but I dunno.
> 2 votes

# Answer
*Note I'm not actually looking into interpolation so this answer doesn't address it; I am just concerned with having one copy of the game state for the rendering thread, and another for the update thread. So I can't comment on the issue of interpolation, though you could modify the following solution to interpolate.*

I've been wondering about this as I've been designing and thinking about a multithreaded engine. So I asked a question on Stack Overflow, about how to implement some sort of "journaling" or "transactions" design pattern. I got some good responses, and the accepted answer really got me thinking.

It's tough to create an immutable object, since all of its children must also be immutable, and you need to be really careful that everything truly is immutable. But if you are indeed careful, you could create a superclass `GameState` which contains all of the data (and subdata and so on) in your game; the "Model" part of the Model-View-Controller organizational style.

Then, as Jeffrey says, instances of your GameState object are fast, memory efficient, and thread safe. The big downside is that in order to change anything about the model, you sort of need to recreate the model, so you need to be really careful that your code doesn't turn into a huge mess. Setting a variable within the GameState object to a new value is more involved than just `var = val;`, in terms of lines of code.

I'm terribly intrigued by it though. You don't need to copy your entire data structure every frame; you just copy a pointer to the immutable structure. That by itself is very impressive, don't you agree?
> 1 votes

# Answer
I started by having three copies of the game state of each node in my scene graph. One is being written to by the scene graph thread, one is being read by the renderer, and a third is available for reading/writing as soon as one of those needs to swap. This worked well, but was over complicated.

I then realized I only need to keep three states of what was going to be rendered. My update thread now fills one of three much smaller buffers of "RenderCommands", and the Renderer reads from the newest buffer that's not currently being written to, which prevents the threads from ever waiting on one another.

In my setup, each RenderCommand has the 3d geometry/materials, a transformation matrix, and a list of lights that affect it (still doing forward rendering).

My render thread no longer has to do any culling or light distance calculations, and this sped things up considerably on large scenes.
> 1 votes

---
Tags: physics, multithreading, fixed-timestep, interpolation
---


# Question
Title: Accurately record and play back game sessions in an MMO - timing issues?
In order to detect and reproduce bugs in an MMO, recording game sessions **on the server** can help.

How can such recording and replay of the data be implemented to be accurate, i.e. be 100% deterministic / produce exactly the same result on each replay?

I intend to record timestamped incoming messages as the only data necessary, if possible. The playback would use the database snapshot as present at the beginning of the recording.

Details about the MMO

* mainly I/O driven (act on incoming network messages plus simple periodic AI)
* 2D
* C++ and Lua, RDBMS for storage.
* Clients send updates at around 1-3 times per second due to the simple nature of the MMO

---

In particular, consider **timing issues**:

If run-time for computations on playback differ from the run-times when recorded, frame times will also differ and can for example affect the movement of NPC units (move 3px instead of 1px).

How to make sure that in the replay AI has the same time constraints compared to when recorded? Fixed time-step? Record the time deltas between each frame and on replay make sure those deltas determine the actual frame time?

# Answer
> 2 votes
For a number of reasons I'd recommend running such a game at a fixed framerate when it comes to updates. Rendering can run variable framerate using interpolation or extrapolation.

Other than that, I'm not sure what's what in your system. Is it the client or the server you're talking about here? I'll assume the client since you're talking pixel values, but can't work out how that relates to the server. How often are you sending updates? It'd be a reasonable goal to keep things deterministic between network data updates and input, ie if you save those two input streams and replay them you get exactly the same result.

---
Tags: mmo, testing, game-recording
---


# Question
Title: What is the name of the balancing technique that reduces the incremental value of bonuses?
Some games, including Dungeon Crawl (example), use a balancing technique that attempts to prevent certain values (stats, damage, etc.) from being excessively high. The algorithm looks like this:

```
if value > 20:
  value = 20 + (value - 20)/2
#70 → 45

```

...and can be applied multiple times:

```
if value > 20:
  value = 20 + (value - 20)/2
if value > 40:
  value = 40 + (value - 40)/2
# 70 → 45 → 37.5

```

# Answer
> 9 votes
They usually use **diminishing returns** for stat values so as you add more of the same stat it actually makes less of a difference.

# Answer
> -1 votes
I think you'll be lucky to find specific names for balancing techniques. ;) There isn't exactly a large body of standardised science here...

# Answer
> -3 votes
I'd call it "lazy design" or alternatively "mindlessly applying design principles from brain-driven pen & paper games to CPU-driven computer games without stopping to think if it makes any sense". If you want to use a **logarithmic scale** for a value (and the algorithm cited is a rough approximation of that), *use a logarithm*.

---
Tags: balance, terminology
---


# Question
Title: State of art shadowing technique for OpenGL on isometric terrain?
What's the most efficient way of creating shadows for object on a isometric terrain with OpenGL and JOGL? Note that this terrain is not flat and is not heightmap generated. Think it as another model. However objects' shadows on other objects is just nice to have.Objects must drop shadows just on the terrain.

# Answer
> 2 votes
Projective shadow mapping is a very common technique, almost inexpensive on current hardware and used in most of AAA video games around. The nice thing is that you can cast shadows on any object, regardless of their shape, and you can easily obtain soft shadows with a number of techniques, e.g. percentage closer filtering (PCF).

---
Tags: opengl, java, terrain-rendering, shadows
---


# Question
Title: Car (or other "object") acceleration and braking: how to?
I'm not good in math so I'm here to ask you how to manage, in a simple 2d game, the car acceleration and braking.

I'm trying to develop it (as a hobby) in c# and sdl.net.

# Answer
## Thought Process

Rather than showing the implementation, this answer will walk you through the thought process used to design a basic 2D car without steering. Each of the headings below (behaviors, variables, and formulas) represent a portion of the thought process, and the car’s implementation.

Note: All the "code" is pseudo-code.

## Behaviors

To start, we need to think about what high-level behaviors we’d like our car object to exhibit. These behaviors give insight into the methods that will need to be implemented. The key behaviors for our car are:

* Starting at a defined position, with zero velocity
* Adjusting velocity based on player input (accelerate and break), and modifying the car’s position

## Members

The next thing we need to do is look at our behaviors and think about what pieces of information they’ll need to share with each other. These pieces of information will be our class’s member variables. The members for our car are:

* It’s position (xPos, yPos)
* It’s velocity (xVel, yVel)

## Formulas

Finally, we use our formulas (which utilize our members), to define the behaviors we listed earlier.

**Start at a defined position, with zero velocity**

```
(xPos, yPos) = (starX, startY)
(xVel, yVel) = (0,0)

```

**Adjust velocity based on player input**

```
// acceleratedX/Y represents the acceleration/deceleration amount
(xVel, yVel) += (acceleratedX, acceleratedY)

```

**Simulate drag to slow the car down**

```
(xVel, yVel) -= (drag,drag)

```

**Make sure we don't go in reverse!**

```
if (xVel < 0) { xVel = 0 }
if (yVel < 0) { yVel = 0 }

```

And our car should work! :D
> 8 votes

# Answer
To get you thinking, here is how you might consider it:

You've got a velocity variable that starts at zero. As you hold the acceleration key/button, the velocity is increased by say, 2 units per frame, or whatever you want. And every frame that the velocity button isn't held, you decrement 1 unit per frame (until you get to zero). To break, decrease 2 units every frame the break button is held.

This way, you've got a car that is always slowing down while the acceleration isn't held. Of course, you can increase/decrease however much you want, based on your car's stats, the friction of the ground it's on, etc...

Now, to move the car, you look at the velocity and move it however many units you want to in the game world, based on how fast your velocity units are.
> 5 votes

# Answer
There's a really good article on just this, 2D car physics at gamedev.net and its based on C#.
> 0 votes

---
Tags: algorithm, physics
---


title: What type of document for game design?

text:
# Question
Title: What type of document for game design?
What type of support/format do you use to store and diffuse your game design documentation? Wiki? Doc files? Files in Repository? Shared folder? Google Doc?

Please provide pros and cons for each one.

# Answer
> 14 votes
I'm using Google Docs because all I really need is a text editor that's online. I can collaborate with people online with relative ease and I know my information is secure there in case my computer crashes.

Another option worth looking at is using Dropbox. Drop a Word document in there and you instantly have a collaborative environment with version control.

# Answer
> 5 votes
**Wiki**

Pros:

* Latest version always accessible over web, from off-site, etc.
* Fairly easy to use (if you steer clear of those with a trainwreck for formatting like MediaWiki, that is)
* Automatic indexing, searching, easy categorisation
* Easy to attribute changes to people and to make them accountable for changes
* Supports linking and makes it easy and effective to factor out details
* Can link to wiki pages directly from internal bug reports and other correspondence, making verification of a bug very easy
* Version history and revision control typically built in

Cons:

* Sometimes TOO easy to change (\*see below) and requires discipline
* Pages can get out of sync when edited in isolation (often no 'global search and replace', for example)
* Pages get orphaned or superceded and left as potential minefields for coders later. (*"What do you mean we're not implementing that any more? It's still in the design wiki!"*)
* Syntax can be a little esoteric unless you get the right package
* Have to arrange hosting, or accept what is available online for free
* No clear route through the document - how do you read it 'all'?
* Hard to print. Can you print it all out with one click? Can you easily print out everything relevant to one given feature in order to take it into a meeting? Can you annotate the digital version easily without obscuring the underlying document?

---

(\* We used a wiki for one project and designers were always tempted to go in and 'improve' parts of it, even on features that had been signed off and sent to be coded up. Then when QA got to testing the feature, it would be a nightmare because often the design would suggest something different to what was actually coded, and it would take a fair bit of frustrating work to find out which happened first, the change to the design or the code.)

# Answer
> 3 votes
**Text Files**

On my current project, I'm using simple plain-text files in my "Docs" folder of the project, stored in the repository beside the code.

Pros:

* Documentation is kept close to the actual work, so its easy to find.
* Simple formatting means it is easy and fast to maintain documentation.
* Simple format also means there's little risk of losing documentation due to server crashes, file corruptions, etc.
* Absolutely minimal set-up time makes this a great start for single-developer or tiny (2-3 person) teams.
* Using version control means that changes are tracked, and often one can link changes in documentation directly with a change in the code.
* As easy to work with as text, so searching, editing, and so on can often be done with command line tools.

Cons:

* More than a couple of users and the document would get out of sync easily.
* No links, so either you use one grotesquely large document or several smaller but disconnected documents.
* Limited formatting and publication options (though conversion, such as through Markdown, is easy to do.)
* As easy to work with as text, so often the only way to get searching, advanced editing, and so on is to use command line tools.

It's not something you want to rely for any kind of team work, but the power of text files in the repo to let you get right to work should not be underestimated for the single-developer. Currently I use one document as a kind of overview/master-planner that contains the general design, a second document that acts as a ToDo-list of specific things the game needs, a third document as a loose bug tracker, and ancillary documents to elaborate on "feature x" as needed.

# Answer
> 2 votes
Don't use a document format/editor that's not multi-user capable (eg. MS Word, Open Office Writer). Only one person can edit the doc, and even with source control it's too easy to start working on an outdated version, and by saving that you basically destroy everything the other user(s) have done since the last time that user has updated his version of the document.

Shared folders are by far the worst solution and an absolute no go for any kind of asset that's supposed to be worked on collaboratively. You can never be sure that someone else is working on that file right now, or will do so in the next couple minutes. You also don't have change tracking and can't revert back to a previous version in case of a disaster (human error or human stupidity or human neglect).

Preferably use a Wiki, but one that's user friendly and is truely WYSIWYG. I personally swear by Confluence, which is also used in bigger game dev studios and is only $10 for up to 10 users and unlimited viewers.

Most other wikis (MediaWiki, TikiWiki, etc.) have the downside that they have a steep learning curve or are even practically unusable by non-technical personnel. Not that they couldn't learn it but they (rightfully) don't accept using a document system that's basically requiring you to write code like HTML. This is my pet peeve: Wikis that say they are WYSIWYG but all they do is insert the syntax into the text you're writing. That's not WYSIWYG!

The guideline for using a wiki is to put every heading on a seperate page, so you can cut the document into many manageable parts. Confluence offers features with which you can then aggregate all those subpages back into a single site or document, which can be exported to PDF for example.

# Answer
> 1 votes
I think One Note is a good option. It is something like a Wiki but with lots of rich text editing support. In addition to the standard desktop client which comes with Office there is a web based version with the Office Live suite. Honestly, I think the web based version, which is free, should be enough for most needs and when combined with Skydrive you have a pretty good system to collaborate on a live document.

# Answer
> 0 votes
For one of my open-source projects, we've been using (gasp) SharePoint to store documents and media. Managing users and permissions is pretty straightforward, and it has support for full version history. We've had the SharePoint site for about four years now, so there may very well be better options nowadays. However, it *has* worked out pretty well for us. It's hosted by a third party (for around $20/month), so after the initial setup there has been virtually no maintenance on our part. In addition to supporting document and image libraries, SharePoint has Wiki support, though I'm not sure how well it measures up against the more popular Wiki engines.

---
Tags: game-design, design-document
---


title: DirectX Overlay

text:
# Question
Title: DirectX Overlay
I have been a code in full convertion mods for the source engine, but now im mostly coding C# applications. That provide utilties for games, during this proccess i have often wanted the ability to do a overlay that shows ingame.

During my research i found out it seems i would need one "hook" for eatch version of major version of the DirectX API. When i was coding for mods, i never got down renderer so i have no experience with that.

My question boils down to.
1) Is making a DirectX API overlay something that can be maintained in a 1 developer freeware project?
2) Anyone got any pointers on where to start ( With code samples, since this is freeware i dont have infinite time to spend learning DirectX).
3) My internet research has pointed me towards basicly feeding the overlay a bitmap that overlay will draw, is this the correct direction?

# Answer
1\] It depends on the developer, the time they can dedicate to the project, and on the scope of the project but yet it's certainly possible.

2\] You could use Microsoft Detours: http://research.microsoft.com/en-us/projects/detours/, but this pretty good blog post that describes how it could be done in c#: http://spazzarama.wordpress.com/2010/03/29/screen-capture-with-direct3d-api-hooks/. More resources can be found by googling "fraps detours".

3\] Correct. Typically, the overlay is implemented by intercepting the DX "present" call, and injecting code to blit your bitmap to the surface that is being presented. The concept is trivial, but the implementation could be replete with corner cases.

Good luck!
> 2 votes

# Answer
Take a look at PLAYXPERT. It's a tool that takes care of the overlay using the driver sub-system and lets you build widgets in C# .NET.
> 1 votes

---
Tags: c#, directx
---


# Question
Title: How do I handle moving platforms in a platform game?
I don't want to use box2d or anything, I just want simple moving platforms (up-down, left-right, diagonal and circular paths). My question is to handle the update order / control hierarchy so that the player stays fixed to the platform solidly, without bouncing or wobbling?

# Answer
> 16 votes
My solution would be to treat every physical entity in the game map as a *tree node*, and the map itself as the *root node*. Nodes can contain other nodes. Every node is contained (directly or indirectly) inside the map node.

For example, let's say your character is standing on a platform. The platform's node contains the character's node. So, whenever the platform moves, the nodes it contains (in this case the character) will move too.

For this to happen, **every node should have an (x,y) position *relative to the parent node***. For example, your character could be located at (1,0) *relative* to the platform, which itself could be located at (10,10) *relative* to the game map. That way, if the platform moves, your character will move along implicitly.

In this hierarchical tree, the position of every node is equal to the sum of his position plus each of his parent nodes' positions. Let's say we want to get the character's position on the map. We calculate:

(character's position) + (parent node's position) + (root node position) = (1,0) + (10,10) + (0,0) = **(11,0)**

OK, so all this time your character has been standing on the platform. What about jumping? Well, the moment he jumps, you *detach him from the platform* and *attach him to the node containing the platform*; in this case, the map (root node).

When he lands again, attach him to whatever node he landed on.

# Answer
> 10 votes
I would suggest treating this as a pseudo-physics problem and solve it by using ground friction.

You're already using gravity to hold the character on the ground, this handles the situations where platforms move up and down. To handle the left and right movement, the ground should exert a great deal of friction on the character. Typically this friction level would be 1.0, or 100%.

If the character is standing still, then their velocity is 0, and they instead inherit 100% of the velocity of the platform because of the friction. Something like the following:

```
character_velocity = friction * platform_velocity

```

The benefit of this approach is that it easily lends itself to additional platforming mechanics, like being able to overcome the friction on steep slopes, allowing your character to slide. It also allows you to easily reduce the friction to create ice that the character will slide on.

It also is easier to deal with issues like low hanging walls that can knock your player off a moving platform. If you simply treat the character as a child of a parent platform, there's a good chance it won't interact very easily with the rest of your collision detection without a lot of work.

# Answer
> 0 votes
You might fix the player position not "absolute in the level" but "relative to the platform", then have a function that gives his actual position. I don't like this though.

It would be probably better (and simpler) to bind the player to the platform so that when the platform moves +x/+y, the player moves as much.

---
Tags: physics, moving-platforms, platformer
---


# Question
Title: What are effective strategies for a small game development team?
What are language/platform-agnostic best practices for a small game development team of intermediate to advanced developers?

High-level strategies (as well as suggestions in terms of frameworks, engines or IDEs which might offer a good ROI) are welcome.

# Answer
Small team must target "small but beautiful".

* Be sure of your target. Easy & broad supply is vital.
* The Game design should be very simple(no rpg but more like some tabletop games or oldies),
* The art should be minimalistic/2D (or using procedural tech)
* the tools must be high level: use a established game engine.
* the Language must be high level also (Python, Lua, C#). You prefer a low dev time over a very speedy program.

But do not sacrifice quality, that the only way to stand out.
> 10 votes

# Answer
Small team + small budget = small games. Never forget that you're on a budget so the team/budget ratio have to define the time you can work on each game.

That said, take time to prototype. You can't afford to make not good enough games.

For the game engine, the current best all-in-one and cross-platform engine affordable for (very) small teams is Unity.

If you think that the games you will make require precise control of the game engine (if it's not an established genre), then you'd better setup a framework made of several specialized libraries (Ogre, FMod, CAudio, RakNet, etc.). That said, it means you'll have to maintain the glue code yourself, so it have a cost. If you can't afford it, take a full engine anyway and try to wrap your game concepts in it.

Frameworks like SFML might be good for you as it provide basic bricks to build game-specific engine on (but it's more oriented to 2D games).

If you want to make a lot of games quickly, you'd better go the Flash way, as it's like some kind of basic game engine platform. There are a lot of game engine built on it and it's cross-platform.

For the tools, use whatever source control that works fine with your team organisation. Ides are relative to the language you want to use, so you'll have to search. Just know that if you work on Windows with C++ or C# then Visual Studio is always the best choice. It seems XCode is the best on Mac. I'm not sure for other unix platforms.

If you want to make a cross-platform game that is not based on an already cross-platform engine, then use C++. If you target only Windows and want to get fast to game programming (and find an adequate game engine like NeoAxis), then use C#. Python, over a cross-platform game engine or framework like SFML, can be a good idea too.

If you have the time, setup a project management tool. If you don't have time, don't bother and just make someone keep track of everyone's tasks. Redmine or TRAC are good candidates for this kind of stuff, but requires that you know how to install them. A quicker alternative might be Mantis that is php only (copy/past in your web hosting ftp). There are a lot of other simple alternatives on the web but don't spend too much time looking for them.
> 5 votes

---
Tags: architecture, cross-platform
---


# Question
Title: What roles are important when staffing up a mobile studio?
For a new studio that will be focusing on social, mobile platform games. What are roles do we need to fill and how many of each role would be ideal?

# Answer
It really depends on the kind of game you are making - are you doing procedural content or multiple platforms at once? Budget an extra programmer. Multiplayer? Another half a designer at least. The studio founders (I'm guessing there are between 2 and 4) should sit down and do a rough schedule for the first few games, and then figure out what the headcount should be.

Some positions that are easy to overlook:

* User interface designer/artist - A small studio will probably want to merge the positions, but the importance a good UI cannot be overstated for mobile games.
* Marketing. Even if it's just your CEO pestering every gaming news site with review codes constantly and your concept-artist-web-designer-art-director putting together a press sheet, you're going to need to budget some person-time for this.
* Testing and integration. Again, maybe this is just part of a programmer, but you should have someone whose priority is making sure your builds work and don't regress. When you don't have a fully staffed QA department, this is your only defense against 3AM checkins and oh-crap-we-need-this-immediately-for-the-demo changes.
> 4 votes

---
Tags: planning, human-resources
---


# Question
Title: How are components properly instantiated and used in XNA 4.0?
I am creating a simple input component to hold on to actions and key states, and a short history of the last ten or so states. The idea is that everything that is interested in input will ask this component for the latest input, and I am wondering where I should create it.

I am also wondering how I should create components that are specific to my game objects - I envision them as variables, but then how do their Update/Draw methods get called?

What I'm trying to ask is, what are the best practices for adding components to the proper collections? Right now I've added my input component in the main Game class that XNA creates when everything is first initialized, saying something along the lines of `this.Components.Add(new InputComponent(this))`, which looks a little odd to me, and I'd still want to hang onto that reference so I can ask it things.

An answer to my input component's dilemma is great, but also I'm guessing there is a right way to do this in general in XNA.

# Answer
You're on the right track. Getting a reference to a GameComponent from other GameComponents relies on GameServices.

Revised code would look something like:

```
var inputComponent = new InputComponent(this);
this.Components.Add(inputComponent);
this.Services.Add(typeof(IInputComponent), inputComponent);

```

Getting the component back out from another component would look like:

```
var inputService = (IInputComponent)Game.GameServices.GetService(typeof(IInputComponent));

```

More information about the GameComponent and GameServices architecture can be found here: http://www.nuclex.org/articles/architecture/6-game-components-and-game-services
> 8 votes

# Answer
From examples I've seen, the best way to instantiate a component and then use it depends on what type of component it is. For the mentioned input component, keep a reference to it in the main Game class in XNA, and in the Game's Update() method, add a line like `input.Update(referenceToSomethingIfNeeded)` so that the Game class manages its component updates. For other components that are needed within specific game objects, have the game object Update() methods do the same for their components.
> 1 votes

---
Tags: xna, xna-4.0, component-based, input
---


title: How do I implement deceleration?

text:
# Question
Title: How do I implement deceleration?
I say "deceleration" because I'm not using acceleration at the moment; what I mean is moving the velocity back towards zero, eventually stopping.

I'm new to vectors and not so great with physics and such. How is "deceleration" normally handled?

---

What I have now works, but it seems kind of *hackish*.

```
update:function(Game, t, dt) {
    var speed = Game.Input.isKeyDown('shift') ? 8 : 4;

    if (Game.Input.isKeyDown('a')) {
        this.velocity.i -= speed;
    }
    else if (Game.Input.isKeyDown('d')) {
        this.velocity.i += speed;
    }
    else {
        if (Math.abs(this.velocity.i) > 3) {
            this.velocity.i += (this.velocity.i > 0) ? -speed : speed;
        }
        else {
            this.velocity.i = 0;
        }
    }

    if (Game.Input.isKeyDown('w')) {
        this.velocity.j -= speed;
    }
    else if (Game.Input.isKeyDown('s')) {
        this.velocity.j += speed;
    }
    else {
        if (Math.abs(this.velocity.j) > 3) {
            this.velocity.j += (this.velocity.j > 0) ? -speed : speed;
        }
        else {
            this.velocity.j = 0;
        }
    }

    this.updateVectors(dt);
}

```

I used 3 because anything lower exhibits weird behaviour, I'm guessing if I raised the speed then it would need to be changed.

# Answer
> 16 votes
Something as simple as

```
this.velocity.i *= 0.9;

```

works nicely.

# Answer
> 7 votes
In Pseudocode, I do variations of this:

Speed += ((MoveDirection * MaximumSpeed) - Speed) * AccelerationFactor

Where:

* Speed is the current speed the entity is travelling at on the current axis.
* MoveDirection is the direction the entity is trying to travel in on the current axis, 1 is forward, 0 is still and -1 is backwards. All values in between are allowed.
* MaximumSpeed is a constant determining the fastest that the entity can travel on the current axis.
* AccelerationFactor is a constant between 0 and 1 that represents the rate of acceleration and deceleration. 1 is instant, and 0 will never move.

Which handles *both* Acceleration and Deceleration nicely in a curved, rather than line. If you want different acceleration and deceleration rates you could do IF statements that determine whether the player is attempting to not move or move in the opposite direction.

# Answer
> 3 votes
The answers here (`vel = vel * 0.9`) are actually *damping*, not what I would consider *'deceleration'*.

I often do deceleration like this:

```
if ( Game.Input.isKeyDown( "w" ) )
{
    this.velocity.i = Math.max( -WALKSPEED, this.velocity.i - WALKFORCE);
}
else if ( Game.Input.isKeyDown( "d" ) )
{
    this.velocity.i = Math.min( WALKSPEED, this.velocity.i + WALKFORCE);
}
else
{
    if (this.velocity.i < 0)
    {
        this.velocity.i = Math.min( 0, this.velocity.i + WALKFORCE);
    }
    else if (this.velocity.i > 0)
    {
        this.velocity.i = Math.max( 0, this.velocity.i - WALKFORCE);
    }
}

```

Some pros and cons vs. damping:

*Pros*:

* The speeding up acceleration and the slowing down acceleration are both linear, which gives a pleasant subtle 'game feel' that I think damping doesn't provide. This is the **important** part.
* The character comes to a predictable complete stop after a predictable number of iterations.

*Cons*:

* This is trickier to implement if you are using non-orthogonal motion (which it sounds like you are?) Basically, you have to get a force vector that is aligned with the velocity, compare lengths, and subtract or zero-out as approrpriate. (If you want that explained with code, just ask.)

# Answer
> 1 votes
Very simply put, in pseudo code:

```
if(no movement keys pressed) [Meaning we want to start to decelerate]
current speed *= 0.85 [Or some number between 0 and 1, the smaller the faster the deceleration]

```

However, you would need to check if(current speed \< 0.001f) or something and set to 0.

---
Tags: 2d, mathematics, physics
---


# Question
Title: Starting career with enough education but no experience?
I am a student in Game Programming at University and a lot of students like me are wondering the best way of entering the industry. With a bachelor degree in game programming, but no real experience in the game industry, how can students begin developing real projects ?

Major game companies requires you to have 2 - 3 years of experience, so how do you guys suggest us to make our way through this selective industry ? Start in smaller buisness ? Build a kick-ass demo could maybe be enough ? Massively read all game programming books we can ?

Thanks for your suggestions, the question is yours !

# Answer
> 16 votes
As someone trying to get into the programming side you've got two main options.

**Internships**

Look for any internships you can find with game companies in your area. These are a great way to get your foot in the door. Many larger publishers use internships as a try-before-you-buy plan with students. If you can prove yourself in a real production situation then you will often find a job offer at the end of that internship, if the company has open slots.

However, please come into it with mindset to learn as much as you can. There are few things more annoying than a student who has spent a couple years in school and thinks they know how everything works.

**Make Something, Show your Passion!**

When looking at two inexperienced candidates if one of them has some software they can show that's certainly a leg up on someone that has nothing. It doesn't have to be a finished game, but obviously if another candidate has a game and you don't that looks better on them. Most importantly it needs to be easily demonstrated (have video of it running as well as the code) and you should be able to clearly explain what you did.

Note, you've likely made some projects in school, but so has everyone else and often similar projects. I'd advise against showing those unless they are very good, or you've taken them far beyond the class requirements. Think about the message you send with what you show. Class work says, "I couldn't be bothered to do more than the minimum." That's not the message you want to send.

# Answer
> 5 votes
The barrier for developing games is so low now that if you are truly interested you have no excuse not to.

Use Flash, HTML5, Java, Ruby, Python, even GameMaker. You can create a game for a game making competition, or just for yourself, but the important thing is to make one and complete it. It really adds a lot of perspective into what matters and what doesn't when you sit down and complete a game.

Additionally be sure to get your games in front of real players and get their real feedback. All the university courses, and even industry experience are a poor proxy for seeing how real people interact with your game.

# Answer
> 2 votes
I think one of the better ways to establish yourself in the industry is to do just that - establish yourself in the industry. Develop an independent game, keep a blog, have it heavily publicized, and then everyone is going to know who you are, or be able to find out quickly. Like you said, game companies require you to have experience, so you can apply all you want, but in the meantime one of the only ways to fulfill that requirement is to create the experience yourself. Of course, one of the key dependencies of this plan is the fact that you must put out a quality product by yourself or in a small team/business. A portfolio of any sort will give you a much better chance of succeeding than those without one.

# Answer
> 0 votes
The important thing in the age of online news, twitter and blogs is to be well known. To get a job in the games industry you only really need to do 2 (not so easy) things:

* make an amazing independent game
* publicize your game like crazy

As soon as you are "that guy who created *Angry Farm*" rather than some anonymous person, you will find it easy to get a foot in the door.

---
Tags: education, game-industry
---


# Question
Title: What's the best practice to have NPC enemies taking cover in an FPS game?
My question is about the data structure (and logical way to use this structure) behind this type of comportment of NPC enemy : How does he computes the place where he can take cover when the player is shooting at him ?

It can be in a FPS-like, or a "board game" view game...

# Answer
> 9 votes
You've got 3 main options:

**Option #1:** (Most robust, but most CPU Intensive)

In real-time calculate corner areas wide enough for the NPC to hide and that aren't exposed to the player. Choose the nearest for the player to hide.

This will work on any level which is nice and on levels with geometry that changes during gameplay. But it will take the longest to get working consistently and will use up to most CPU resources during the game.

**Option #2:** (Save level designer time, minimal real-time hit)

Create an offline tool that does the corner test and then places nodes in your level for all potential cover areas. LD's can then tweak these nodes or remove ones that aren't appropriate.

During gameplay just find the nearest valid node.

This is nice in that your corner finding routing doesn't have to be 100% accurate since LD's can screen out a few bad nodes here and there. Can't respond to changes in geometry though unless you start getting clever with attaching them to objects, or scripting them on/off.

**Option #3:** (Brute Force, minimal real-time hit)

Have LD's manually place all cover nodes, and then just choose the nearest valid node during gameplay.

If you have lots of levels or big levels expect the LDs to complain.

# Answer
> 3 votes
I think the best way to do it would be to manually set up boxes in the area(s) that you want the NPCs to take cover in.

Have a variable for "fear" or some other metric you want, when a threshold is reached the NPC should move to the closest box that is out of the players line of sight.

You could figure a way to dynamically have enemies take cover over behind any object, but more times than not those can generate some strange and illogical cover positions.

# Answer
> 1 votes
There is a description of how the AI of killzone searched the position space to get a good position here (PDF). You could change the evaluation function to augment the value of a cover position if the AI is shooted at, or heavily damaged. Thus AI that are not shooted at would take a little more risk to get the target.

You could also add AttackingHobbo's solution, augmenting the cover interest depending on the fear factor (ie 0 : i'm invincible / 1 : i take care / 5 please make it stop)

regards

# Answer
> 1 votes
Depends on the style of game. It's fairly common to let level designers place cover objects, which can be either a volume, a shape representing a covering object or a node. This is more labor-intensive for LDs but gives much more control, which is usually wanted in a tightly scripted game.

For open-world games, you need an automatic cover detection system. We used one that detected cover at runtime in Battlefield: Bad Company (1 & 2) in order to be able to invalidate and re-detect on environmental destruction.

---
Tags: architecture, ai
---


# Question
Title: What are the pros and cons to building an audience with a small, simple, free game first as opposed to focusing efforts on a commercial release
There are two projects we can work on. One would be a small free game to try and get our name out/build an audience. The second is our main idea for a first product.

What are the pros and cons of building the small, simple, free game first instead of focusing that time/effort into the main money making project.

# Answer
> 4 votes
It depends a lot on what the two games are, your distribution channels, and what kind of time/money the team has available.

Ideally, your two game ideas are somewhat similar: close themes, close genres, something. If you get fans based on your great free racing game, then release a fantasy RPG, there won't be much cross over in the audiences. Also, two games with similarities can share code. You won't be "wasting time" making a free game first if you can reuse large chunks of the code and content as the basis for the premium new game.

Distribution is important. A free PC game and a premium Xbox game wouldn't have much crossover. Again, you want to ensure that the audience you build up from the free game would actually be likely and able to purchase your premium offering. Consider your options here too. For a free PC game, you're main distribution is going to be your own website. For a pay game, you may be able to access additional avenues like Steam or other content sellers who will open your game up to a wider audience. If you need something out there to impress these sellers that your company is a good risk, then the free game is going to valuable both as a audience builder AND a resume booster for the company.

An additional note on distribution, if you are eligible for any kind of contests or awards with either game, make sure to enter them. Just being a contestant gets you exposure beyond your own word of mouth. Making a free game is more appealing if you can enter it in an indie game competition and get free advertising for your website.

Finally you have to honestly assess your own time. If everyone involved is doing this as their job, you may need paying work out there now. On the other hand, if the game design thing is a hobby outside of real work, you may be able to use advertising and donation revenue from a free game to help fund work on the premium game.

Some additional thoughts: Let's say your two games are pretty different. Different enough that you can't really share code or lots of audience between them. What else is there to consider?

On the free game, you might also look at how you can charge for it. Is there premium content you can add to that? Can you sell it as a beta on the promise of making it bigger and better in the future? (the "Minecraft model" ) Can you sell a premium "HD" version of the free game later? (EDIT: Tetrad's excellent answer points to some further ways to monetize the free game, making it both an audience builder and a revenue stream for future game development.)

On the premium game, could you spend time working on a free demo or shareware version of it? It might be better to have a demo of your main game out there instead of a free but unrelated game.

# Answer
> 4 votes
Just because a game is "free" doesn't mean you can't monetize it. See this question: What are some common ways to generate revenue from a free game?

In short, "freemium" (namely, releasing a game for free to build up a user base and relying on microtransactions to build up revenue) is one of the better ways these days to make money on smaller games. Which I'm assuming your game would be in order for your studio to be able to stay afloat.

# Answer
> 3 votes
It all depends on the games themselves, and the team that's working on them.

If for example the small game is a Breakout clone and the large game is a full-scale RPG, the former won't really help "establish" you to do the latter.

If the small game isn't a project worth doing in its own right -- if it's just a derivative clone or similarly uninspired -- then the only thing it will "establish" is that your team doesn't know how to make a great game.

If your team has not made a game before at all, then it IS worth working on (and completing) one or more small projects, but the purpose of these is not to get your name out there, it's to get experience completing projects. It is very easy to start a large project with grand plans and huge ideas, only to never finish it because the scope is just too large for the team. An inexperienced team would do well to work on a few simpler projects first, whether they are released or not, simply to get a feel for what it's like to work together on a team.

Then there's the question of burn rate. Do you NEED to make money to support yourselves, or do you all have day jobs? How soon do you need to be profitable? Do you have a business plan? Are you actually treating this like a business, or is this just the three-guys-in-a-garage model where it's great if you make money but that's not the priority? If this is a business question, then top priority should be to halt development until you create a viable business plan first, and once you have one, that should answer your question right there.

---
Tags: marketing, planning
---


title: Writing Logic behind card games

text:
# Question
Title: Writing Logic behind card games
I'm not a dev noob, but definitely never done anything in game dev. There is a trump based card game we play in town that I plan on coding. I'll be either using python/ajax/pyqt or c++/qt.

My question is as follow, what kind of advice would you give to writing card based games?

# Answer
> 12 votes
I'm not really sure what card game you're trying to create, but here are the general steps I would go through:

1. **Write the rules down on paper** \- Write the rules down in bullet format. This will get your brain thinking about the logic, and will provide you with a handy reference to use later on.
2. **Rewrite the rules to follow the programmatic flow** \- Keep the rules in bullet format, but reorder and indent them, so they form an outline of the programmatic flow.
3. **Write the pseudo-code** \- Using your outline as reference, write out the pseudo code.
4. **Create the classes** \- Make a list of classes you'll need, based on your pseudo code, and implement them.
5. **Replace your pseudo-code with code**

The process is a little slow, but it has a number of benefits to someone in your situation:

* Each step creates documentation that can be referenced in future steps
* You have multiple opportunities to catch mistakes in your logic before you ever touch code
* It's very easy to see how logic should breakdown into code

Best of luck on your programming adventure! If you have any questions or something seems unclear, let me know. :)

# Answer
> 1 votes
The good news about card games is, they are some of the simplest to program, so this is a great first project for getting into game dev. Why? Because you don't have to deal with a great deal of graphics (simple sprites for the cards, no scrolling, no 3d, not even necessarily any animation) nor do you require realtime input (when you say "trump based" I assume this is a turn-based game where you select cards one at a time to take tricks), so the event-driven programming that you're used to in more general software development can apply here just fine.

If you're an experienced programmer, there are likely only two things you'll need to learn here. One is how to draw sprites to the screen, which is not terribly hard -- there are tons of libraries that will let you do this, PyGame has the functionality built in if you go with Python. The other is, assuming this is a multiplayer game to be played over the internet, you'll need to figure out how to establish a connection and send messages over a network. But that's really it... aside from that, treat it like any other software project.

# Answer
> -1 votes
AJAX/PyQT? Not sure how that would work out. Card games aren't especially complicated unless you are trying to make some kind of generic card game engine (don't do that). Just don't focus too much on the tech, pick something you are comfortable with and make it fun first. Once it is fun, worry about making it snazzy.

---
Tags: c++, python, logic
---


# Question
Title: Can I start implementing Game Center in my iPhone app, without having created a new app in iTunes connect?
I'm in the process of developing a game for the iPhone and I want to add Game Center support to it. The problem, as I see it, is that I need to have named my app, created an icon and uploaded screenshots etc. before I can create a leaderboard and start implementation?

My game is unfinished and the iTunes Connect developer guide seems to indicate that certain information can't be edited once entered. Can anyone point me in the right direction on this one?

Thanks.

# Answer
You have to add a new App to iTunes Connect in order to use Game Center.

However, all of the data can be bogus (it just needs to be valid) and you can change it later. Except for the App's name if I remember correctly. If you need to change that, you can still simply create a new App with the desired name, and then transfer the Achievements and Leaderboards setup to the new App, which is a bit of work but nothing you can't do in an hour or so.

A lot of the restrictions about what you can't edit in hindsight is only in regards to an App that has been submitted and approved. That's when a few things get locked in, I think keywords being one of them. Even then you can submit an update of your App and you'll be able to change some of the App's data that's otherwise no longer editable.
> 4 votes

---
Tags: iphone, game-center
---


title: Commercial 2D game engines?

text:
# Question
Title: Commercial 2D game engines?
I know that there are several open-source/free 2D game engines out there; I am just wondering about commercial ones (if any). The idea of wanting of looking for a commercial engine is for support and continual updates.

Off the bat I know that there is DarkBasic, Blitz Basic and Torque 2D. What's else are there?

What I am looking for (technical wise):

* Sprites and Animation capability
* GUI (menus, dialogs, simple controls)
* Math helper for usual math operations -vectors, rotation, turning an entity to face another...
* Entity management
* Particles
* Serialization of game data
* Level design tools
* Deployment tools

And support wise

* Documentation
* Examples and Tutorials
* Continual update
* Support through forum/emails/private channels

# Answer
These are the ones I know of which are commercial and 2D, at least primarily. Pushbutton is an edge case, since the engine is free but components cost money. If you take that into account, I guess a few more engines could be seen as commercial if you count the byproducts that are being sold. Cocos2D for iPhone would be an example for that, or SIO2 Interactive.

Plus all the other, specialized Game Creators. For example for RPGs, Adventures, Shoot'em Ups, Jump'n Runs, etc ...
> 6 votes

# Answer
Well it depends on what are your needs. I dont know about DarkBasic and Blitz Basic but for Torque2D, depending on your experience you will encounter some "weird" situations because TorqueScript is not the type of language we are really used to use. First of all it's a scripting language, and maybe it is what you need but maybe not.

I Sugest you take a look on this list : http://en.wikipedia.org/wiki/List\_of\_game\_engines

As it's seems quite complete. Maybe you could tell us what are your specific needs ? This way we could sugest some engines.
> 1 votes

---
Tags: 2d
---


# Question
Title: How to make a simple escape the room game?
I want to make a very simple "escape the room" game. I was hoping for something that looks something like this. You would see images of some room and you click around to move or to add things to inventory. Then, you can select something in your inventory to use that item with something on the screen. During the whole game there would be a text box describing what is happening (probably in really broken English instead of Japanese).

I am looking for something that can be quite simple. I would prefer to have the ability to play sound (probably mp3's) when something happens. It can be web-based or a downloaded executable or .jar file. It doesn't have to be perfect, just a proof-of-concept really.

What is the best approach to get this game working with minimal effort? Are there some libraries that can help? I have plenty of Java experience and some C++, PHP, and others. I'd rather avoid Windows-based technology as I primarily run Linux. I am willing to learn other languages if they have a huge advantage.

Ideally, if someone could point me to an example program that I can modify. I'm not expecting to sell or distribute this game.

# Answer
Personally, I'd recommend sticking to the programming language you know best, and checking out the graphic/audio libraries available to you. If you're familiar with Flash, there is a tutorial on how to make a basic escape the room game. Even if you don't know Flash, that tutorial should help give you an idea as to how such games are constructed.
> 9 votes

# Answer
You have plenty of Java experience? Use Java.

Famous games written in Java.
> 1 votes

# Answer
You can use the Wintermute adventure engine http://dead-code.org/home/index.php/lang-pref/en/
> 1 votes

# Answer
If you plan to stick with C++, you could give a try to Allegro ( http://www.allegro.cc/ ) Simple to learn and suitable for what you need. Technically tough, I see this easier to build with PHP and some Javascript, without any libraries except maybe jQuery. It's all up to which language you're more comfortable with.
> 0 votes

# Answer
Take a look at Scratch: http://www.scratch.org It was designed to teach kids, but it's very suitable for adults, and it's an absolutely wonderful prototyping engine.

It has an integrated audio sampler and image editor. You can also import images and audio files. It doesn't have a state mechanism, which could be useful in this type of game, but that's not really a major problem.

This is probably easier than just about any other approach, as the language uses a tile-based programming system (no code typing.) It works fine in Linux (I'm an Ubuntu guy myself) and it creates web friendly apps in a Java Applet container.

You could do this entirely in HTML and JavaScript, too. Use an imagemap for the background image (or small absolutely positioned elements.) You can keep track of your inventory with JavaScript code. You could also have the inventory pop up as a secondary window.
> 0 votes

---
Tags: game-design, linux
---


# Question
Title: Polygon/Shape definition changes in Box2D 2.1
I was going through a pretty good tutorial on Box2D here, but I ran into a problem when he made a `b2PolygonDef`, because the tutorials were made in 2.0, and I'm using 2.1. I could download 2.0 I guess, but I'd really like to know how to update how to do this to the newest version.

If you guys don't want to watch the whole video, basically, he does this in this one:

```
        private function createWallsAndFloor():void
    {
        // Create the shape (polygon) definition
        var bigLongShapeDef:b2PolygonDef = new b2Polygondef();
        bigLongShapeDef.vertexCount = 4;
        b2Vec2(bigLongShapeDef.vertices[0]).Set(0 / RATIO, 0 / RATIO);
        b2Vec2(bigLongShapeDef.vertices[1]).Set(550 / RATIO, 0 / RATIO);
        b2Vec2(bigLongShapeDef.vertices[2]).Set(550 / RATIO, 10 / RATIO);
        b2Vec2(bigLongShapeDef.vertices[3]).Set(0 / RATIO, 10 / RATIO);
        bigLongShapeDef.friction = 0.5;
        bigLongShapeDef.restitution = 0.3;
        bigLongShapeDef.density = 0.0;

        // Create the body definition
        // Create the body
        // Create the shape
    }

```

I can see that they removed `b2PolygonDef` and `b2ShapeDef` because I'm using Flash Develop, so what basically do I do?

(If you don't mind watching videos, he explains what he's doing in the one before this one.)

# Answer
The errors are to do with the Box2D engine being updated. The excellent tutorials by FlashyTodd are unfortunately out of date now (22/10/10). Although he does mention this at the top of the videos the link to the things that have changed isn't much use for the novice (myself included).

Also the link above to the Box2D manual from DrDeth is the C++ manual, not AS3 which is what FlashyTodd is working through.

I also found this useful example which notes the changes made from 2.0 to 2.1 code.

For anyone else that comes across this, here is the FlashyTodd example HelloBoxWorld updated to be Box2D 2.1 compliant. (just a floor and dynamic box)

```
   package{

import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;

import Box2D.Dynamics.b2World;
import Box2D.Collision.Shapes.b2PolygonShape;
import Box2D.Dynamics.b2Body;
import Box2D.Dynamics.b2Fixture;
import Box2D.Dynamics.b2FixtureDef;
import Box2D.Dynamics.b2BodyDef;
import Box2D.Common.Math.b2Vec2;
import Box2D.Collision.b2AABB;
import Box2D.Dynamics.b2DebugDraw;

    public class HelloBoxWorld extends MovieClip{

        protected var _world:b2World;

        //ratio of pixels to meters.
        public static const RATIO:Number = 30;
        private var _fallingCrate:b2Body;

        private var timeStep:Number = 1.0 / 30.0;
        private var velocityIterations:int = 6;
        private var positionIterations:int = 2;

        public function HelloBoxWorld() {

            //1. set up the world
            setupWorld();

            //2. create walls and floor
            createWallsAndFloor();

            //3. make create
            addACrate();

            setupDebugDraw();

            addEventListener(Event.ENTER_FRAME, newFrameEvent);
        }

private function setupDebugDraw():void {

        var spriteToDrawOn:Sprite = new Sprite();
        addChild(spriteToDrawOn);

        var artistForHire:b2DebugDraw = new b2DebugDraw();
        artistForHire.SetSprite(spriteToDrawOn);

        artistForHire.SetDrawScale(RATIO);
        artistForHire.SetFlags(b2DebugDraw.e_shapeBit);
        artistForHire.SetLineThickness(2.0);
        artistForHire.SetFillAlpha(0.6);

        _world.SetDebugDraw(artistForHire);
}

private function newFrameEvent(e:Event):void {

    //variables assigned at the top
    _world.Step(timeStep, velocityIterations, positionIterations);
    _world.ClearForces();

    _world.DrawDebugData();

    trace("Falling Craete is at x:"+_fallingCrate.GetPosition().x +",y:"+_fallingCrate.GetPosition().y);
}

        private function setupWorld():void {

            //1. set up the size of the universe
            //var universeSize:b2AABB = new b2AABB();
            //universeSize.lowerBound.Set (-3000/RATIO,-3000/RATIO);
            //universeSize.upperBound.Set (3000/RATIO,3000/RATIO);

            //2. Define gravity

            var gravity:b2Vec2 = new b2Vec2(0, 9.8);

            //3. Ignore sleeping objects.
            var ignoreSleeping:Boolean = true;

            _world = new b2World(gravity, ignoreSleeping);

            trace ("My world has "+_world.GetBodyCount()+" bodies");
        }

        private function createWallsAndFloor():void {

            //1. Define a body with a position
            var groundBodyDef:b2BodyDef = new b2BodyDef();
            //x,y of centre. set as integers, not floats
            groundBodyDef.position.Set(250 / RATIO, 400 / RATIO);

            //2. Use the world object to create the body using the body definition above
            var groundBody = _world.CreateBody(groundBodyDef);

            //3. Define fixtures with a shape, friction, density, etc.
            var groundBox:b2PolygonShape =  new b2PolygonShape();
            //width ,height. set as integers, not floats
            groundBox.SetAsBox(200 / RATIO, 20 / RATIO);

            var fixtureDef:b2FixtureDef = new b2FixtureDef();
            fixtureDef.shape = groundBox;
            fixtureDef.density = 0.0;//density is set to 0.0 by default so this isnt really needed here
            fixtureDef.friction = 0.5;

            groundBody.CreateFixture(fixtureDef);

            trace ("My world has "+_world.GetBodyCount()+" bodies");

        }

        private function addACrate():void {

            //moving object
            var movingBodyDef:b2BodyDef = new b2BodyDef();

            //set the type of body here
            movingBodyDef.type = b2Body.b2_dynamicBody;//b2_dynamicBody is a property of b2Body. !manual is confusing here.
            movingBodyDef.position.Set(100.0 / RATIO, 100.0 / RATIO);
            movingBodyDef.angle = 30 * Math.PI / 180;

            _fallingCrate = _world.CreateBody(movingBodyDef);

            var dynamicBox:b2PolygonShape =  new b2PolygonShape();
            dynamicBox.SetAsBox(50.0 / RATIO, 50.0 / RATIO);

            var dynamicfixtureDef:b2FixtureDef = new b2FixtureDef();
            dynamicfixtureDef.shape = dynamicBox;
            dynamicfixtureDef.density = 1.0;
            dynamicfixtureDef.friction = 0.3;

            _fallingCrate.CreateFixture(dynamicfixtureDef);

            trace ("My world has "+_world.GetBodyCount()+" bodies");

        }

    }
}

```
> 1 votes

# Answer
You should really check out the Box2D Manual page. It's well written and easy to understand.

To more directly address your question, it looks like you no longer use shape definitions to define shapes. You would simply create the shapes themselves, and use a fixture to attach the shape to a body.

```
b2PolygonShape dynamicBox;
dynamicBox.SetAsBox(1.0f, 1.0f);

b2FixtureDef fixtureDef;
fixtureDef.shape = &dynamicBox;
fixtureDef.density = 1.0f;
fixtureDef.friction = 0.3f;

body->CreateFixture(&fixtureDef);

```

Hope this helps.
> 2 votes

# Answer
Here's a snippet of code directly from the game I'm working on:

```
        // Create the shape
        b2PolygonShape shape;
        // Create a "capsule" shaped object
        b2Vec2 vertices[8];
        vertices[0].Set( (-mWidth/2 + 5.0f) / PhysicsManager::mPhysicsScale, (mHeight/2) / PhysicsManager::mPhysicsScale);
        vertices[1].Set( (-mWidth/2) / PhysicsManager::mPhysicsScale, (mHeight/2 - 5.0f) / PhysicsManager::mPhysicsScale);
        vertices[2].Set( (-mWidth/2) / PhysicsManager::mPhysicsScale, (-mHeight/2 + 5.0f) / PhysicsManager::mPhysicsScale);
        vertices[3].Set( (-mWidth/2 + 5.0f) / PhysicsManager::mPhysicsScale, (-mHeight/2) / PhysicsManager::mPhysicsScale);
        vertices[4].Set( (mWidth/2 - 5.0f) / PhysicsManager::mPhysicsScale, (-mHeight/2) / PhysicsManager::mPhysicsScale);
        vertices[5].Set( (mWidth/2) / PhysicsManager::mPhysicsScale, (-mHeight/2 + 5.0f) / PhysicsManager::mPhysicsScale);
        vertices[6].Set( (mWidth/2) / PhysicsManager::mPhysicsScale, (mHeight/2 - 5.0f) / PhysicsManager::mPhysicsScale);
        vertices[7].Set( (mWidth/2 - 5.0f) / PhysicsManager::mPhysicsScale, (mHeight/2) / PhysicsManager::mPhysicsScale);
        shape.Set( vertices, 8 );

        // Create the fixture def
        b2FixtureDef fixtureDef;
        fixtureDef.shape = &shape;
        fixtureDef.density = mDensity;
        fixtureDef.friction = mFriction;
        fixtureDef.restitution = mRestitution;
        fixtureDef.isSensor = mIsSensor;
        if (contactGroup) {
            fixtureDef.filter.categoryBits = contactGroup->mCategoryBits;
            fixtureDef.filter.maskBits = contactGroup->mMaskBits;
        }

        // Create the fixture
        b2Fixture *fixture = mBody->CreateFixture(&fixtureDef);

```
> 1 votes

---
Tags: flash, actionscript-3, box2d
---


# Question
Title: Will an XNA "XBox 360 Project" also work on Windows?
I understand that an XNA project for XBox 360 will use a specialized version of the .NET Compact Framework. But let's say I want to release for both XBox 360 and Windows.

Will the XBox version (using compact framework) still work if distributed for Windows, or would I need to rebuild against the regular framework (or the non-Xbox CF) in order to distribute?

# Answer
Yes, different platforms run different .net runtimes.

The way this works in xna 3/3.1/4 is you create your game project for a single platform (say, create a new Windows Xna game project in visual studio). In visual studios 'solution explorer', right click the project and then chooses 'create copy of project for X', where x is the platform you want the new project to target. Thats pretty much all there is to it.

These two projects are kept in synch, anything you add to one will show up in the other. Use #if WINDOWS or #if XBOX or #if WINDOWS\_PHONE blocks to add code that is specific to a single platform.
> 15 votes

# Answer
You need to rebuild for Windows. There is a tool to automate the process of converting the visual studio projects. Since you started on the 360 and the compact framework you should be largely okay. Going the other way you can run into issues where you use .Net framework features that aren't supported by the compact framework.

The docs contain a section on differences between the two (for example, you can't set the processor affinity on Windows). If you're actually releasing your game on the PC you might run into compatibility issues. Eg, your render buffer format might not be supported, or your shaders might not compile. This is the curse of PC development though and not specific to XNA.
> 3 votes

---
Tags: xna, windows, xbox360
---


# Question
Title: Game uses gamecenter in iphone - can I design a fallback for 3G and prior devices?
If I develop a game using gamecenter, does itunes connect lock me in to only supporting 3GS and above with iOS 4.0 and above, or will it still allow sales of my game on older devices (as long as I build in fallback so it never calls gamecenter framework)?

# Answer
> 4 votes
You can include Game Center without limiting which devices can run your game. First you have to set the 'Base SDK' to 4.1 or higher and the 'Deployment Target' to the minimum you want to support e.g. 3.1.3. Then you weak link and use GameKit as described in the Apple docs about Optionally Using Game Center In Your Application.

# Answer
> 3 votes
You consider using OpenFeint and support both it and GameCenter if you want to. OpenFeint works on 3.1+ firmware, GameCenter works on 4.1+ firmware.

---
Tags: iphone, game-center
---


# Question
Title: How do you choose the right price of items in your games?
I have a game in which the player earns money for wining races and, then, he can spend that money to unlock new levels or to improve his vehicle. Now, I am choosing the money you earn and the prices of things without a clear criteria, I just test them and see if it feels right... Do you think there is a better way? How do you do it?

# Answer
> 24 votes
Build yourself an Excel spreadsheet. There you can calculate exactly how much money a player who is placing first each race will have acquired at any point in the game. The same goes for a player at the bottom end of your payout bracket.

Once you know the money range for a good/bad player then just ask yourself how many parts do you want them to be able to buy after 1 race, after 3 races, after X races. You can plot the cost of the parts vs. the income of the players over time.

Using VBscript you should be able to play through the entire progression game in Excel.

# Answer
> 4 votes
Remember, price is a placeholder for value or utility. You should have an idea of how much value a player should get from winning a race, ie. how much that should benefit them in a future race. When you know the relative values of the different items you can buy, then you can assign prices to them based on those values.

# Answer
> 2 votes
If your game doesn't lend itself to a straight model like excel (although if it does, do that), then you should try and get statistics about when things are purchased and what is with your beta testers. Steam has had a lot of success with this model, so much so to provide heat maps of popular death zones in maps to find problematic regions. There's no reason you can't use that to place your price points.

---
Tags: game-design, balance
---


# Question
Title: How to avoid self-intersection when applying stroke to a curve?
I have several Spline2D objects in my code, each of which has a Position, Velocity, and Acceleration method that returns a vector of the specified quantity at a particular time. I've been using these vectors in order to construct geometry to create gradient strokes for the curves, but I'm having problems with self-intersections at steep curves. As an example, here's one curve where I'm having this occur:

Wireframe: http://twitpic.com/2zplw1/full
Filled: http://twitpic.com/2zpmnt/full

As you can see, on the second bend, the inner portion intersects itself, which causes that ugly artifact. Is there a good algorithm/method to stroke curves without causing that self-intersection?

**EDIT**: More extreme examples, plus a mock-up of what I'd like to achieve:

Wireframe: http://twitpic.com/2ztwzi/full
Filled: http://twitpic.com/2ztwkt/full
Ideal Outcome (Mock-Up): http://twitpic.com/2ztxa8/full

# Answer
If you're rendering these with the GPU and any modern 3D api (eg. OpenGL/D3D), it looks to me like you can get rid of this with depth testing. If you assign your outside verts to be z=FAR , and your inside verts to be z=NEAR, the depth testing should prevent the overlap from showing. With OpenGL:

```

  // don't forget to clear depth buffer to 1.0f at beginning of frame.
  glClearDepth(1.0f);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  // enable depth testing.
  glEnable(GL_DEPTH_TEST);
  glDepthFunc(GL_LEQUAL);

// draw the Spline2D
  for each segment in spline
    for each vert in segment
      if (vert is an outer vert), set vert.z = 1.0, otherwise set vert.z=0.0

```

Caveat emptor: this won't work if you need translucent strokes.
> 3 votes

# Answer
The "Fix" is going to depend on what you want the resultant output to look like. The problem hasn't reallly been defined well enough here: what's it meant to look like?

I'd suggest you first try making an even more extreme example of the glitch, then using photoshop/paint to fix it you might find inspiration for a solution.

Do you want it to fold up? Overlap with the edge? Pull in until it doesn't overlap?
> 1 votes

---
Tags: algorithm, splines
---


# Question
Title: How different is Java for JRE vs Java for Android?
I'm new to all this game developing, and I'm starting to learn java because I was told it was a great way to start. I want to later on create games for the android market, and want to get a good view from you guys, so I know what I'm dealing with exactly.

I DO realize that Android development has different architectures and whatnot (that a good way to say it?)

Thanks!

# Answer
> 13 votes
To create Android applications you use Java and the extension libraries that Android provides. These aren't extensions in the Java Language sort of way; I mean libraries that are shipped with Android to help you achieve the common things you'd want to do on a cellphone.

For example, Blackberry (*another Java-based mobile OS*) uses Java as the language of choice, and Research In Motion provides a set of libraries in the RIM package that helps me abstract things that I'd commonly do on my phone.

You can use pure Java but most of the time you want to use the RIM libraries provided by RIM.

If you're completely new to programming I would recommend first learning good Java principles - classes, methods, object-oriented programming, etc; then learning the Android API provided by Google. If you learn Android first you'll get confused quick and not follow good programming practices.

I recommend starting with the book Head First Java.

# Answer
> 4 votes
Android uses its own Java like implementation. You write Java syntax code and can use Many Java APIs, but there are many differences:

* Android applications have a special Lifecycle:
    + no main function
    + your applications contains Activities with onCreate, onResume, onPause, onDestroy functions that you must override
* Code is compiled into Dalvik opcodes (not java byte code);
* Many APIs are similars but you don't have all J2SE APIs. You must check on the developper site;
* Many APIs are limited to Android (Contacts, Power Management, Graphics...);
* IHM are android onlys (no Swing, no JavaFX ...). You must use XML to declare you GUI;
* you can use java jars (if they use only compatible APIs) but they are converted into dalvik.

So, it is like a new platform; but, if you know Java, it is very easy to develop on Android. Download the SDK and try to play with provided samples and customize them. You can use good IDE as Eclipse and Idea (Android plugin will arrive in Idea 10 Community editions).

For C/C++ geeks, you can use NDK (Native Development Kit) but you need some Java bootstrap code and JNI knowledge.

---
Tags: java, android
---


title: 3D Particle-Geometry collision

text:
# Question
Title: 3D Particle-Geometry collision
I am programming a particle engine for a 3D game written in XNA. I was wondering if somebody could point me in the right direction or perhaps give me some pointers in making the particles collide with geometry in game. In essence, I want to be able to make a spark emitter that will bounce and collide down say, a cylindrical tube.

# Answer
> 1 votes
For 3d physics, you can use 3D Physics Engines as Bullet, Newton or O.D.E. It is probably at first sight overhead... but you can use it for many great effects or add physic in your gameplay.

You can use PAL to abstract the Physics Engine.

# Answer
> 1 votes
Particle mechanics isn't terribly difficult to understand in general, but there are some messy details.

The single biggest thing to remember is Truesdell's Axiom: "No two distinct masses may occupy the same point in space at the same point in time." Simulating particle dynamics is largely about creatively breaking that axiom, while still preserving physical plausibility.

There's several methods for enforcing non-penetration: measure differential inclusions, displacement based penalties, and velocity based restitution are fairly well developed computationally.

Since you're interested in gaming, I'd recommend focusing on restitution-based methods which produce diagonal systems of equations (i.e., you can solve them explicitly).

A good first reference for details is "D. Baraff, Dynamic Simulation of Non-Penetrating Rigid Bodies, (Ph. D thesis), Technical Report 92-1275, Computer Science Department, Cornell University, 1992."

I would start with Baraff's work and either Bullet or O.D.E. Work in parallel between theory and code.

Also, if you can find papers on Distinct Element Method by Peter Cundall, you might find those an easier entry point.

Particle interaction is very rich. Don't expect overnight success, and you will have a lot of fun.

---
Tags: xna, collision-detection, physics, particles
---


title: Client-side login and password save

text:
# Question
Title: Client-side login and password save
I'm wondering what would be the best way to store password and login in the client. Many people complain that they need to re-enter this every time they log in and they want me to make a way to save it. But how to save it? Saving it as plain text in game folder wouldn't be clever, but neither would encrypting it help so much. It would still be easy to decrypt the data.

How would you do that?

Best regards!

# Answer
I think there are two issues to keep in mind:

* unauthorized access to your server
* learning the password to access other services (because people are lazy and reuse passwords)

## How to prevent abuse of the decrypted password elsewhere?

The second attack vector can be prevented by not storing the real password in any decryptable form at all. But a token generated by the server or a password hash that the server will accept instead of the password.

## How to prevent unauthorized access to your game?

We are assuming here, that the attacker has access to the users computer in order to retrieve the password file. Based on this assumption it is likely that the attacker has write access, too. But if he has write access, he can modify program files and do all sorts of nasty things. So we have lost.

That being said, there is a number of things you can do to make it more difficult for the attacker. Based on my experience with Stendhal most attacks are done by family members, who don't have a deep knowledge. So easy tricks make a difference:

* hiding the password file somewhere outside the game folder
* "bind" it to a specific computer by using the MAC address of the first network card or the serial number of the hard disk to encrypt the authentication information with.
* "bind" it to the username by using it to encrypt the authentication information with.

Note: None of this things give you real security. But they do reduce the number of incidents and thus reduce support costs.

By the way: WoW, which is quite famous, does not allow to save the password.
> 6 votes

---
Tags: c++, mmo, python
---