# Question
Title: When creating quick prototypes, is it better to use the language you are going to use in the end?
I have been working with SFML(C++) and Flash(AS3) and usually creating prototypes for some ideas I have.

Is it better to use the language you are going to use in the end (C++ usually) or use something simple and quick (AS3, Python, etc) to get it working and then start from scratch when you start on the main product?

# Answer
> 31 votes
It heavily depends on what your goals are.

If you're trying to prove gameplay, speed of iteration is probably your most important goal and therefore you should pick a language and environment to suit that.

If you're trying to prove tech (using middleware or otherwise), then your goals would also include choosing what language to use.

# Answer
> 14 votes
The idea of prototyping is to get a quick and dirty working version of your idea **and then to dispose the prototype** in order to create a solid architecture for your final product.

It is important to acknowledge that a Prototype is not meant to be (and should never be) refactored into a product, so it is not necessary to write it in the same language you want to write your final game. It's better to choose a programming language that allows for fast development, like Flash as you mentioned.

> Prototypes by their nature are not designed to be long lasting code. Prototypes are designed to be thrown away. They're one-offs. It is inappropriate to over-engineer a prototype. A prototype is like a town in a western movie. It's all facade. There's nothing behind it. You cannot move in and raise a family in one of those houses.

If you want to build something that you may want to further use, this is not a Prototype but rather a Tracer Bullet as Andy Hunt and Dave Thomas call it in the book The Pragmatic Programmer.

# Answer
> 4 votes
The general advice with prototypes is to use something that's completely throw-away. The goal for a prototype when developing games is to simply make sure you're brining the fun. Does the main game mechanic that your software relies on actually make for a fun game? That's an important question, and one that you want answered as quickly as possible. Use whatever means are necessary to get to that answer.

# Answer
> 1 votes
I think the answer here depends somewhat on how comfortable you are in the various languages, and on the technical needs of the final product. With many small-budget games these days, there really isn't any need to code in C++ - you're never going to need the speed it affords you.

My experience has been that if you are jamming hard to get a prototype to work, you've made all sorts of compromises in your code quality to get there. I like to throw out those prototypes and recode them; with the lessons I've learned from those, coding what I want again (regardless of the language it is in) will be pretty fast & have a much higher code quality.

---
Tags: development-speed, prototyping
---


# Question
Title: What scripting language should I choose for my game?
In what cases are what scripting languages better than others?

All answers are appreciated, please provide a description, and describe in what cases the language excels in.

# Answer
## Lua

It is widely used in the game industry, from independent games (Aquaria) to AAA titles (Civilization V).

The core reason? I would say because it is easy to learn and easy to incorporate into your games. Scripting, in general, isn't difficult. I think the real reason you should go with Lua is because it's proven which results in much more resources out there for you to learn from.

It provides "meta language" features. You can implement object-oriented structures, or pure procedural functions, etc. It has a very simple C interface, and gives the engine developer a lot of flexibility in the language itself.

Artists tend to love Lua too because it's very approachable, with plain and forgiving syntax. If your codebase is C or C++, I would highly recommend it.

It has good runtime performance when compared to other scripting languages like Python. (...and it has full support for closures.)

It has a small memory footprint (approx 150k), it has excellent C/C++ bindings making it easy to add new game specific APIs, it is easy to pick up, it is flexible - i.e Has elements of OO, imperative and functional - none of which are mandatory, it has good buy-in from from mod community from games such as WoW etc.

## Squirrel

Squirrel has an interesting history. It was built after a game architect had issues with Lua's unpredictable garbage collection, and crazy *everything is null even if it doesn't exist*.

Squirrel is the sripting language used in Left 4 Dead 2. The API is very lua-like (Squirrel's author loves Lua's design).

So Squirrel is an awesome language as it's kinda 2nd generation Lua. It took the good ideas and removed the annoying eccentricities.

Same from Lua:

* coroutines
* tables and metatables
* dynamic typed
* lots more

New to Squirrel:

* classes
* arrays
* regexs instead of Lua's match syntax.
* C/C++/Java/C# style language instead of Pascal/Delphi style.
* lots more

Squirrel's primary disadvantage is it's not Lua. Lua is much more widely used. But if that's not an issue Squirrel is an easy win. However, often the language's popularity is useful feature in itself, so the decision is not so clear cut.

## V8 Javascript from google

PRO's

* Quite easy to use
* Constantly getting better
* Powerful and flexible
* Others: As many mentioned , javascript is a common programmer tool. Adding it to my games has opened far more people who feel capable than other languages. It also supports a huge amount of casting and conversion to save on work for the programmer, also makes it really easy to use, works well with STL.

Possible CON's:

* Documentation can be confusing: Its really not the best.
* Examples\** Often a web of weirdness. Lacking in solid simplicity, it comes across as way higher level than it is.
* Templates\** Sometimes these are hated on, or avoided.
* SDK Codebase size\** Generated code size may be consider bloat.

## GameMonkey

This one is used by several teams. It's faster than Lua and better at threading.

## Python

This one has been used in several games (e.g. Civilization IV).

It is very easy to teach to non-programmers/designers. It is even easier to pick up for developers since it essentially reads like pseudocode. Being dynamically typed is just one of the aspects that help to get people with little to no prior coding experience up and running fast with the language.

Possible cons:

* The C bindings for python are much more geared towards extending python with C, than embedding python in C.

## JavaScript

This is a possible option as you can download JavaScript engines. There are more JavaScript programmers than any other type of programmer.

## SCUMM

This specialized language has been used in several adventure games and it is particularly suited to those games.

## mono-script

This allows you to use the Novell implementation of the .NET framework for scripting.

Here's another page about embedding mono in your application.

The Mono framework is faster than most (perhaps all?) of scripting languages out there because it's not interpreted, and because there's a layer between the compiler and the instruction set, it allows you to program in a variety of languages including C# and dialects of Python, Lua and Javascript.

Possible cons:

* If you're doing console development (including iOS), JITing code is apparently out of the question because you can't mark data pages as executable. The IL it has to be pre-compiled to the target platform.
* Mono has license restrictions. You need a commercial license if you want to use it in an environment where the end user is not allowed/able to upgrade the Mono runtime.

## AngelScript

Some find this one much easier to bind to C++ than Lua.

That being said, I suspect Lua has a few advantages that make it compelling for commercial games developers:

* It's more mature and widespread than AngelScript
* Its syntax is easier for non-programmers (AngelScript is very C++-like)
* It has a smaller footprint than AngelScript (at least as far as I recall)

If you're just writing a hobby project, though, I'd say that AngelScript's at least worth a look.

## Scheme

Well, guile specifically.

With guile you can have your own DSL (Domain Specific Language) just for your game. Once you get used to the parentheses and prefix notation, scheme is heaven to work with.

## ActionScript

This is a hybrid dynamic/static typed language used to create Flash games, which can be widely distributed on the web. It is fairly well supported with libraries like Flixel, FlashPunk and Box2d.

## *Roll your own*

Yes, writing a compiler and/or interpreter for a scripting language might take a week or two, but in the long run the flexibility will pay of many times. Just don't go to far astray and reinvent brainfuck.

---

## General tips

You should choose a scripting language that has stable and well-supported bindings to your game's primary development language.

If you are writing your game in C or C++, then there are pretty solid bindings available for Python and Lua. If you are writing your game for the .NET platform (using C# or another language), then I highly recommend using either IronPython or IronRuby. Both are complete language implementations that leverage Microsoft's Dynamic Language Runtime (DLR), which provides excellent performance and very tight integration with the .NET Framework. Interoperability between C# and IronPython/IronRuby is pretty smooth these days, especially with the introduction of dynamic callsite binding in C# 4.0.

Choosing one scripting language over another is dependent on your specific requirements. Some of the options you have to choose between could be:

* Speed of the interpreter - if the feature of scripting is solely used i.e. by developers to script static behaviour, then speed and a fully-fledged and extendable API may be the most important aspect. I had some good experiences with LUA there.
* Easy to learn, accessibility - for a content-/leveldesigner it may be hard to learn more complex scripting languages (depends on the background) to generate dynamic behaviour. In that case, the use of easy to learn (i.e. commonly used) and well documented languages could be more appropriate here. JavaScript or Python could be a good solution here.
* Workflow integration - if you have a specific production pipeline with already existing tools, it could be a bad idea to use a language which seems to work best for a given case if the other tools are working with a completely different one. This is especially valid if you have several programmers working on the different tools. In that case, it could be more efficient to use the "not quite fitting" language.

If you have an existing team that will use the scripting language or a lead (level)designer that will use the scripting, then go with whatever their language of choice is. They will be spending their time with it, so they should be catered to.
> 51 votes

---
Tags: scripting
---


title: What is a texture atlas?

text:
# Question
Title: What is a texture atlas?
I've heard about this concept, but what is it?

# Answer
A texture atlas is simply a way to stuff multiple sprites into a single texture. You also will need an index into the texture so that you can find where each of the sprites are located.

The reason these are used is because it's more efficient to bind a texture once and change the UV values being used than to bind multiple textures for each sprite you draw.

Here is an article from Gamasutra on texture atlases that helped me a lot when I was first getting started
> 15 votes

---
Tags: rendering, textures
---


title: Linux Game Development Resources

text:
# Question
Title: Linux Game Development Resources
Do you have any Linux-specific game development resources?

# Answer
Blender might be worth checking out, both for asset creation and for the game engine it offers.
> 3 votes

# Answer
I'm not much of a Linux guy, but these are my recommendations based on research and experience:

**Programming**

* Eclipse IDE for code editing and project management.
* Java.
* GCC.
* Python.
* OpenGL.

**Programming Libraries**

* Java2D.
* SDL.
* PyGame.
* Allegro.

**Art**

* The Gimp (bitmap).
* Inkscape (vector graphics).
* Blender (3D).

**Sound**

* Audacity.
* LMMS (Linux Multimedia Studio).
> 5 votes

---
Tags: linux
---


# Question
Title: How can I effectively manage a hobby game project?
How can I successfully finish a hobby game project in my free time?

How do I motivate myself to keep it up and drive right through to the finish without losing interest or motivation along the way?

# Answer
These tips apply to any hobby software project, and not just games. Keep in mind that some could be contradictory, and that's ok because we're not all motivated by the same things.

## Planning your project

* **Start by planning** You can do that by writing a Game Design Document (GDD), a Technical Design Document (TDD), and a Feature Backlog.
* **Scale yourself back.** Whatever your grand vision is, try and figure out what the smallest achievable portion is and do that. Making an RPG? Start with one quest and no NPCs. Making a platformer? Start with one level and no enemies.
* **Start by creating a game that is stupidly simple** And get it finished and published online somewhere. Remember that even something seemingly simple like pong could turn out to be quite complex if you're new game development, and starting with a simple game will show you whether you have the patience to take on a bigger project.
* **Set tiny milestones.** Having a goal like "item system works in my RPG game" is all well and good, but that implies a whole lot of under-specified functionality that you probably didn't even know you needed. What about "graphics environment set up"? Or, "A sprite is displayed on the screen."
* **Set deadlines** for your milestones. Keep them realistic and feel free to adjust them when you notice you over- or underestimated your capabilities. But don't just let them pass.
* **Break that down again** "Implement Leaderboard View" is not a sufficient task. What does that involve? Break it down -
* Create background artwork for leaderboard view
* Create class methods that fetch score data
* Create class methods that post score data
* Create a view controller which will display a back button, reload button, and a table view
* Implement the table view to load in the data from the model

Seeing the picture in finer detail will reduce your chances of missing a key element of your implementation and will provide you motivation as you tick off each task.

* **Prototype early.** Before you sink a bunch of your hard-earned hobby hours into a game, figure out if it'd be fun first. There's nothing so dispiriting as working your ass off on something for dozens of hours only to find that the basic concept sucks.
* **Develop something iterable.** My favorite hobby software projects are the ones where the basic concept allows for later tinkering. Is your game like that? Can you ship something and then revisit it later and add cool stuff?
* **Don't build an engine or a framework.** You don't want an engine, you want a game. Don't worry about the framework-y, reusable bits until after your game is shipping. Once you start on the second game, then you can go back to your first and see if there's anything you could bring over. That's not to say that you shouldn't use sound software development praxis, but don't start by writing a Sprite class until you know what you need your sprites to do -- you'd be surprised how little it'll turn out to be. Start with a Hero class, then a Monster class, and then -- oh look! -- there's some common stuff!
* **Organize and track your ideas** You can use a physical notepad, a corkboard, whiteboard with sticky notes, a "To-do" Application (e.g. Things for Mac and ToDoList (free) for Windows.. Alternatively, you can jump onto sourceforge.net or codeproject.com to grab a to-do application.) You will have a lot of sketches, ideas, design information that really needs to be aggregated into one spot. Having an central location with your feature list will help you stay focused.
* **Let your friends and family know about it** You might be starting off your project and you could need a lot of focus for some time, letting people close to you know that you're busy and why might help them not be mad at you if you're not as available as you could.
* **Shipping is a feature.** You're never going to finish your game, you're only going to abandon it. What is the minimum amount you can do before you're not completely embarrassed to show your game to someone else? Chances are, you can do less than that and still have a game to be proud of. Don't get caught up in constant revisit-\>reimplement-\>repeat cycles.

## Working on your project

* **Use a "game jam" approach at the beginning** Get something playable as soon as possible. Forget what it looks like (the code too, I know, it's hard). If the game play is not immediately interesting or fun for you, drop it, take some notes on why you think it sucks/isn't fun, and move on.
* **Do a little bit each day.** Marathon sessions are great and all, but you're trying to squeeze a long-term commitment into an already crowded life. If you do a little bit each day you are making measurable progress and establishing a structure within which you can achieve your milestones.
* **Get something on the screen**. you may be surprised on how big of a jolt to your motivation it will be. I tend to focus on getting artwork early. In addition I also am able to work with a musician who starts showing me stuff relatively early as well.
* **Track your progress**. You can use a version file (or better yet, a version control tool) to log the features that you've added. Seeing the list of what you've completed will help highlight the progress that you've done so far.
* **Keep the project in a state that works**. You'll be able to share it and show it at any time, and you'll be able to test any aspect of it at any moment.
* **Playtest**. Start getting early feedback on your game. I'm talking about right after you finish your initial prototype. Let some of your friends mess around with what you have, get feedback, take notes, and revise your plan if needed. Be sure to test outside of your realm of comfort and cast a net that includes other game developers. Sometimes friends and loved ones are just not critical people.

## Maintaining your work/life balance

* **Take a Break** If your mind isn't into the project at a specific time don't try and force it. Get up and go for a walk or take a quick nap. That is the luxury of being an independent. In the end you'll create a better product for doing so.
* **Disconnect from the Internet (workstation, mobile device)** from time to time. If there's something you need online, write it down to look up later.

It helps to have things like your engine's API reference available available offline, if possible.

An option is to add some particularly distracting sites to your `hosts` file so you just can't access them.

* **Remember that you're working for yourself** and your own entertainment. Don't let your project be hijacked by others expectations and desires, particularly when your interests change over time.
* **Have fun** If you're slaving over your save state system all of this week be sure to follow it up next week with something that is fun. One of my fun moments was redesigning the animation system for my user interface.

## Become a part of the game development community

* **Collaborate** You don't technically need to start adding people to your team, but talk to other people about what you are doing. Jump over to gamedev.net and start networking.
* **Start a Blog** Talking about what you're doing allows you to build a brand for yourself. This is priceless when it comes time to shipping your product. Just look at what Wolfire is doing. They are absolutely pure win at building a brand for themselves.
* **Read other (game dev) blogs** For some people, whenever they read another indie game developer's blog post about their updates, they immediately open their IDE and start working.

Here is a quick list:

## Further Reading

* **Read this blog post** It covers some points that are already listed here. As a quick summary:

1. Code something you like
2. Surround yourself with inspiration
3. Keep a log of what you did each day.
4. Do some shiny
5. Hard lessons in money
6. Stay aware how high the bar is (know your competition)
7. Take short breaks.

* **The 5,1,1 Routine** and why it's important to have a system when approaching development.
> 540 votes

---
Tags: motivation, time-management
---


title: Converting Cube Maps

text:
# Question
Title: Converting Cube Maps
I have cube maps in lat/long format, and i need to convert them to Horizontal/Vertical Cross, and individual cross images, is there an utility to do that?

# Answer
I assume your source image is in equirectangular projection. You might try PTStitcher, part of the Panorama Tools package. It's designed to be controlled via script files, but there's a batch file located here called "Pano2Faces.bat" which is designed to simplify the use of PTStitcher to do an equirectangular-to-rectilinear conversion (although it probably won't work out-of-the-box on any version of Windows more recent than XP).

You can probably find a more user-friendly option somewhere on this page.
> 2 votes

# Answer
The tool we use for this is HDR Shop located here. http://ict.debevec.org/~debevec/HDRShop/

Version 1 of it is free. The option to use is "Panoramic Transformation". I can't say that this is the easiest tool to use in the world but its what we do.
> 0 votes

---
Tags: rendering, cubemap
---


# Question
Title: Changing orientation by applying torques
Suppose you've got an object floating freely in space. You have a vector you want this object to point towards, and a vector representing the direction it's currently facing. From these two, you can get the rotation (matrix, quaternion, whatever) that represents the change in orientation to bring the two vectors into alignment.

If you only have the ability to apply torque (derivative of angular velocity) to your object, what's a good algorithm for applying torque over time that won't over/undershoot the destination?

(In this case, it's a space ship that wants to automatically orient itself in the direction of travel using thrusters. Roll is irrelevant.)

# Answer
> 4 votes
This can be handled like the similar case for linear acceleration.

First fact to note: Because the ship starts off with an angular velocity of zero, an you want it to end up with an angular velocity of zero, this means that the total change in velocity must equal zero.

From this we can see that the integral of the acceleration over time must equal zero -- there must be exactly as "much" positive acceleration as there is negative acceleration.

Therefore, your solution, whatever it is, must be constrained to this property: Equal "total" acceleration forwards and backwards.

Here is what the shape of your acceleration over time graph should follow:

Looking at this, there are so many possible forms and shapes your acceleration could be in! Let us make some assumptions for the shape of acceleration that you want, in order to give an easy/concise answer.

For the sake of a simple answer, I will have acceleration be in one of three states: forwards, backwards, or zero. Forwards and backwards will be at equal magnitude, and the states can be switched instantaneously. (there is no gradual ramping up of acceleration)

You can find the change in distance for a given acceleration over a given period of time with this equation:

```
s = 0.5*a*t^2

```

The simplest solution here would be to accelerate until you reach the halfway point, then decelerate the rest of the way.

We will take `P` as the total distance you want to move:

```
s = P/2
P/2 = 0.5*a*t^2
P = a*t^2
t^2 = P/a
t = sqrt(P/a)

```

So basically:

1. Accelerate at `a` for `sqrt(P/a)` units of time (units based off your units for acceleration)
2. Decelerate at the same magnitude for the same amount of time

---

This is not the only solution. It will get you there in the fastest amount of time (`2*sqrt(P/a)`). But what if you want a more relaxed version?

In this case, you can accelerate 1/3rd of the way, coast for the 1/3rd, and decelerate the rest of the third. Or 1/4th, coast for 1/2, decelerate 1/4th as well.

Or maybe you could accelerate for a fixed amount of time, and then decelerate for a fixed amount of time, but wait until you arrive at the exact position before you start decelerating.

---
Tags: physics, orientation
---


# Question
Title: Which c/c++ model animation library for OpenGL
I'm fairly new to game development, played around with xna before and just learning OpenGL & c now and I'm interested to know which c/c++ based model animation libraries are out there and which you would recommend? I don't have any particular model format in mind yet but probably a format that is supported by a free modelling tool like Blender.

# Answer
Have a look at Open Asset Import Library, see if it has the features you are looking for. There is also Animaded for skeletal animation but it's not been updated in a while
> 7 votes

---
Tags: opengl, c++, models, c
---


# Question
Title: Where can I find legal or business resources for a game production company?
Where can I find information on the legal or business aspects of running a game production company?

# Answer
> 11 votes
Yes, I'm making the Answer a *wiki* \- feel free to update this post rather than start new answers.

And the usual disclaimer: Caveat Emptor

---
Tags: books, legal, business
---


# Question
Title: What's the right way to re-use open source game assets?
This is a hypothetical question, but one I always wanted to know about. Suppose I wanted to create a game in the same fantasy style as Battle for Wesnoth. Having no arts skills myself, I could write the code for the game engine and borrow (steal?) their artwork and use it myself. IIRC, their stuff is licensed under the LGPL, so if my game were LGPL'ed I should be fine legally.

My question is: just because I *can* do that, should I? What's the expected procedure for borrowing some other game's art assets? Do I need to formally ask permission first?

Obviously I would credit their work before making anything public.

# Answer
If an open source game's resources and source code appear to be governed by the same license, I would suggest you contact one of the project leads and verify that this is actually the case. The LGPL, and other open source licenses, are generally intended to govern the use of source code. Many open-source games adopt separate licenses for the source code and the content. In such arrangements, the content is often distributed under one of the many Creative Commons licenses. The CC licenses are relatively short and concise, outlining in plain English exactly how you may or may not reuse the content. Most of the open source projects I have worked with have used CC licenses which allow you to reuse any content you like, as long as you attribute the original author(s). To fulfill this stipulation, simply include the author(s) in your game's credits, along with a description of the borrowed content. Note that some licenses include a *non-commercial* stipulation, which bars reuse or redistribution with any commercial product. In such cases, you can still borrow content for freeware or open source projects. However, if you use the content in an open-source project which you later decide to sell, you will (as I understand it) need to remove/replace that content in the version you sell.

If the assets of an open source game are governed by an open source license, or a license such as the Creative Commons, you generally do not need to ask permission. The only exception would be if you do not fully understand the terms of the license. This shouldn't be the case with a CC license, but some open source licenses are more verbose and filled with legalese. If your redistribution rights are unclear, it never hurts to ask the author(s).

As to whether or not you *should* use open source game assets, I would say "absolutely". If you do not have the talent yourself (or on your team) to produce better assets yourself, using open source assets will enable you to deliver a better game whilst giving the original content author(s) greater exposure.

One last note: if you find that a game's assets *are* licensed under a FOSS license, be wary of stipulations concerning the relationship between your game's license and the source game's license. Some licenses only allow code and assets to be used in other projects that are governed *by the same license* or a similar license (i.e. both licenses are permissive or both licenses are reciprocal). Be careful not to back yourself into a license that you're not completely comfortable using, all for the sake of using someone else's assets. If you detect a possible license conflict, you can always ask the original author(s) for permission to redistribute the assets under a different license.
> 6 votes

# Answer
If the assets are licensed under the LGPL, then you don't have to ask permission, just abide to the license by using the assets under the LGPL in your new project, and of course, provide credit to the original project/author.

About if you should, if you're willing to make your project under the LGPL license, i believe you should do it, it will allow any legal problems in the future, and the Open Source Community encourages this type of collaborative work.
> 2 votes

# Answer
I wouldn't use anything that doesn't come with a license file explaining the license. If it meets your requirements then go ahead, but other than for a hobby project I don't see the point, as you're not going to end up with something unique.
> 0 votes

---
Tags: assets, licensing
---


# Question
Title: What are some known 2D/3D physics engines for XNA?
I'm looking for a physics engine to use in an XNA project (2D or 3D). Because it's for XNA, it needs to fulfill some requirements:

1. Not necessarily free, but close to it is obviously preferred
2. Managed code only (or it won't run on the 360)

# Answer
> 15 votes
2D

* Velcro Physics is based on box2d but has lot of its own improvements and innovations.
* Box2Dx & Box2D.Xna are both ports of box 2D
* I think theres a port of chipmunk physics out there, but i cant find the link

3D

* JigLib one of the earliest 3d physics engines for xna, been used quite a bit
* Jitter Quite a new engine, but more per formant than JigLib
* Henge3D A newer engine to the scene, impressive multi-threading
* BEPU physics has just recently became free for both commercial and non-commerical use.

---
Tags: c#, xna, physics-engine
---


title: Design Document Contents

text:
# Question
Title: Design Document Contents
What is the minimum content that a game design document should have?

# Answer
I come from a different stream of life (TV Production), but it's basically the same. You need a production bible. But, to put it more simply - you need what you need and nothing more.

* Character list
* Levels list with each level set list (areas that need/deserve special attention)
* Prop list

Each list contains layout sheets (or character layouts for characters - front, side, 3/4), notes, mechanics notes for animation, etc. Whatever you need or might need.

Story/Game production sheet.

* Screenplay and X-Sheets for animators if you have a story and dialog/VO
* Run through screenplay which describes game as though linearly progressed (if game is intricate enough to need it and is, of course, linear in nature)
* Game mechanics per game/level/mini game with set goals, obstacles, rewards - you can do this per level list and only a big idea in run through screenplay

In short, whatever works for you and size/scope of your team.
> 7 votes

# Answer
Having just begun studying design documents, I've come to the conclusion that no-one really knows what goes in them.

The design document itself should be what you need to progress from pre-production to production. How do you turn the game design from this nebulous idea to something that can be created and executed? Too little detail and there's too much ambiguity, creating uneven results, too much detail and you limit possible creativity from your team.

It's not easy, and the science of game design documents is woefully under-explored in comparison to other software domains.

A good paper on this is Requirements Engineering and the Creative Process in the Video Game Industry.
> 5 votes

# Answer
The size and scale of the project documentation completely depends on the size of team and the scope of the project.

Typically large games aren't built off monolithic design documents, but a distributed document system. Either a series of smaller targeted docs or a wiki. Personally I prefer the wiki approach as allows readers to quickly jump between related topics which maps well to system designs which are often integrated.

When using a Wiki there are a few guidelines that can help with:

* One Wiki Page per system/character/level/...
* Keep the Wiki highly organized and structured, each content type should have a defined template. You need at least one WikiNazi to keep the site clean.
* Describe the design briefly and with bullet points, a design document is not the place for narrative text
* Keep pages short and focused, the goal being no longer than 1-2x screen height.
* Pictures are indeed worth 1000 words, use diagrams to help get your point across.
> 4 votes

# Answer
There are no minimum / maximum. It should contain everything you need to start work on the game. Nothing more and nothing less.

You should not require yourself to add information that you think you need just because some template has it.
> 2 votes

# Answer
I'd say you should work out what the gameplay is, who your character is, and what the environment is like. But my advice would be to start making playable prototypes as early as possible.
> 1 votes

# Answer
I like to have headings related to what Art, Sound and Storyline I'll need going forward as well as a basic coding design I can follow when I am coding the engine.

However it is a personal thing and everyone varies on how much detail they put in. Mine are fairly short since I like to jump straight into the code rather than dwelling on design.
> 0 votes

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


title: Where should I host my flash games?

text:
# Question
Title: Where should I host my flash games?
I'm looking at hosting my flash game on a site like Kongregate or NewGrounds, but with so many choices, I'm left wondering what are the pros & cons of the various options?

I'm interested in:

* Reaching the biggest audience
* Making some money (eg. I know that Kongregate shares ad revenue)
* Other features/benefits of the site (eg integration APIs for high scores, micro payments, etc)

# Answer
> 19 votes
In the Flash world, one size certainly does not fit all. That's the point, for reaching the biggest audience you should publish it on every site you can.

The best way, I've found, to go is trying to sell your game for the best price on a site like FlashGameLicense. If that doesn't suits your needs or works for you, it's time to go crazy on publishing it. How?

* Add MochiMedia to your game.
* Make a list of the sites you want to publish it on.
* Evaluate the best bet (make it exclusive to one site or not).

In case you choose not to make it exclusive:

* Block MochiMedia ads for sites that already have deals with it or any other ad system.
* Submit your game to those sites.
* Recommend it to family and friends through social networks.

Finally, a list of sites where you can publish it (not the ultimate list, but I think will suffice):

---
Tags: flash, monetization, hosting, publishing, release
---


# Question
Title: What 3d mesh formats usable with DirectX10 are there?
I want to load a mesh into my game (written in C#, if this matters) but am not sure what mesh format to use. What mesh formats are there, how easy/hard it is to load them into DirectX10 and what's the difference between those formats?

Or is it best to write my own mesh format?

# Answer
> 4 votes
Consider your own format only if you can articulate demands that are very unique to your scenario, and even then - (good) mesh formats are extensible and would probably suit your needs.

If you're developing in the MS universe there's DirectX's own .X format, which personally I think is very well designed. It supports animation, optional compression, and is highly flexible - you can define and register your own template and use whatever extra data you can't find in the presets. Since it's fully open, there's even some work on using it without DirectX. It's main shortcoming is the somewhat lacking MSDN documentation - but that's more than compensated by online content similar to the links.

Beyond that there's obj and stl which are portable but rather primitive (stl in particular), 3dstudio's 3ds and really, tons more. What the world needs is *not* another mesh format..

---
Tags: c#, 3d-meshes, .net, directx10
---


# Question
Title: Is it possible to develop a game with Lua/Löve and have the source code compiled?
I've been looking at Lua and Löve for developing simple 2D games. But since Lua is interpreted and I know it can be compiled to some point, but how secure is that to decompiling. Or is there a better way to distribute the game?

# Answer
> 9 votes
You can precompile lua using the luac tool in the standard distribution:

```
luac myluafile.lua -o mycompiledluafile.luac

```

To obfusticate the file, use the `-s` option to remove all the debug info. This won't make you immune to decompiling, but why does that matter?

The `-l` option produces an annotated bytefile, which is really nice for learning how lua works deep down.

The main advantages of compiling are faster loading times and smaller disk space. However you don't get a performance increase after that - the lua compiler does very little optimisations, even to the point of still including `if(false)` branches and the like.

---
Tags: lua
---


# Question
Title: What are typical pitfalls when writing games with a managed Language like C#?
What pitfalls did you encounter when writing games for the PC with a managed Language like C# and how did you solve them?

# Answer
> 73 votes
I don't know much about Java, so this is from the point of view of a .net developer.

The biggest one by far is garbage. The .NET garbage collector on Windows does a fantastic job, and you can get away without baby sitting it for the most part. On the Xbox/Windows Phone 7 that's a different matter. If you get stalls every few frames, garbage collection might be causing you problems. At the moment it triggers after every 1MB allocation.

Here are some tips for dealing with garbage. You shouldn't have to worry about most of these in reality, but they may come in handy one day.

* Draw the contents of `GC.GetTotalMemory()` to the screen. This gives you an approximation of the amount of allocated bytes your game uses. If it hardly moves, you're doing OK. If it's going up fast, you have issues.
* Try to allocate all your *heap* objects up front. If you don't allocate everything before the game starts, every time you hit a meg of allocations, your going to stall. No allocations, no collections. As simple as that.
* After loading, call `GC.Collect()`. If you know most of your big allocations are out the way, it's only nice to let the system know.
* DO NOT CALL `GC.Collect()` every frame. It might seem like a good idea, keeping on top of your garbage and all that, but remember the only with worse than a garbage collection is over garbage collection.
* Look for where your garbage is coming from. There are some common causes like concatenating strings instead of using `StringBuilder` (beware, `StringBuilder` isn't a magic bullet, and can still cause allocations!. This means simple operations like adding a number to the end of a string can create surprising amounts of garbage) or using `foreach` loops over collections that use the `IEnumerable` interface can also create garbage without you knowing (for example, `foreach (EffectPass pass in effect.CurrentTechnique.Passes)` is a common one)
* Use tools like the CLR memory profiler to figure out where memory is being allocated. There are loads of tutorials out there on how to use this tool.
* When you know where your allocating during gameplay, see if you can use tricks like pooling objects to lower that allocation count.
* If all else fails, make your collections run faster! The GC on the compact framework follows every reference in your code to figure out what objects are not in use anymore. Refactor your code use less references!
* Remember to use `IDisposable` on classes that contain unmanaged resources. You can use these to clean up memory the GC cannot free up itself.

The other thing to think about is floating point performance. While the .NET JITer does a fair amount of processor-specific optimizations, it cannot use SSE or any other SIMD instruction sets to speed up your floating point maths. This can cause quite a big speed difference between C++ and C# for games. If your using mono, they have some special SIMD maths libraries you can take advantage of.

# Answer
> 11 votes
A tipical performance pitfall is not considering the garbage collector in the design/development of the game. Producing too much garbage can lead to "hiccups" in the game, which happen when the GC runs for a considerable long time.

For C#, using value objects and the "using" statement can alleviate pressure from the GC.

# Answer
> 10 votes
I'd say the biggest problems I've encountered writing games in C# has been the lack of decent libraries. Most I've found are either direct ports, but incomplete, or wrappers over a C++ library that incur a heavy performance penalty for marshaling. (I'm speaking specifically about MOgre and Axiom for the OGRE library, and BulletSharp for the Bullet physics library)

Managed languages (as distinct from Interpreted - neither Java nor C# are actually interpreted anymore) can be just as fast as native languages if you have a good understanding of what actually makes them slow (marshaling, garbage collection). The real problem, I think, is that library developers haven't realized that yet.

# Answer
> 8 votes
Like others have said, GC collection pauses are the biggest issue. Using object pools is one typical solution.

# Answer
> 4 votes
C# and Java are not interpreted. They're compiled to an intermediate bytecode which, after JIT, becomes just as fast as native code (or near enough to be insignificant)

The biggest pitfall I've found is in freeing resources that directly affect user experience. These languages do not automatically support deterministic finalization like C++ does, which if you're not expecting it can lead to things like meshes floating about the scene after you thought they were destroyed. (C# accomplishes deterministic finalization through IDisposable, I'm not sure what Java does.)

Other than that, managed languages are really quite a lot more capable of handling the kind of performance that games require than they get credit for. Well written managed code is much faster than poorly written native code.

# Answer
> 4 votes
Neither Java nor C# are interpreted. Both of them get compiled into native machine code.

The biggest problem with both of them and games is having to code in such a way that they never garbage collect during game play. The number of hoops you have to jump through to accomplish that nearly outweighs the benefits of using them in the first place. Most of the features that make those language fun to use for application or server programming have to be avoided for game programming otherwise you'll get long pauses during game play as they go off and garbage collect.

# Answer
> 2 votes
One large pitfall I see from making games with languages like these (or using tools like XNA, TorqueX engine, etc.) is that you will be hard pressed to find a team of good people with the expertise needed to create an equivalent game to what would be fairly easy to find people for in C++ and OpenGL/DirectX.

The game dev industry is still very heavily steeped in C++ as most of the tools and pipelines that are used to push out big or just well polished small games were written in C++, and as far as I know ALL of the official dev kits you can get for XBox, PS3, and Wii are released only with compatibility for C++ (XBox toolset may be more managed nowadays, anyone know more?)

If you want to develop games for consoles right now you pretty much get XNA and C# on the XBox and then only in a side part of the games library called XBox Live Indie Games. Some who win contests etc. get picked to port their game to the real XBox Live Arcade. Other than that plan on making a game for PC.

---
Tags: xna, c#
---


# Question
Title: For a 2D game on the iphone would I better using OpenGL or CoreGraphics?
I am planning on developing my first iPhone game, and I was wanting to know whether I should use OpenGL or CoreGraphics for a 2D game. An outline of the benefits would also be helpful.

Edit: Set this for the community wiki as the answer will be too subjective

# Answer
It depends on what you're building. You may even be able to get away with just using Core Animation if it is not graphic intensive (my last two games were based off of taking advantage of Core Animation).

If you do plan to push a lot of graphics, I would highly recommend Cocos2D for your 2D game. It's based off of OpenGL ES and so far I am really enjoying it. The learning curve has been relatively smooth.

* Integrated Box2D or Chipmunk.
* Scene Management
* Quite a few effects built in already (even for transitions)
* Particle System
* High Score Server (CocosLive) that is free for you to use
* Text rendering support

And much more. I'd download it and play with some of the samples they have included that demos much of it's functionality.
> 5 votes

# Answer
From my experience, most 2D games on the iPhone are written in OpenGL ES. Their 2D game demo is also written in OpenGL. I would go with OpenGL, if only because you're more likely to find a lot more resources for game-related problems in OGL instead of CoreGraphics.

There are also some OS level features that make working in OpenGL less painful than on a few other platforms. For example, you can use the NSString class to render to an OpenGL context, and get full, dynamic, Unicode support right off the bat.
> 1 votes

# Answer
In a nutshell, they focus on different purposes.

CoreGraphics: Compositing and vector graphics. If you just need those, CoreGraphics is a good choice.

CoreAnimation: Animate layers of 2D objects.

OpenGL sits below those two (and CoreImage/CoreVideo, too). By virtue of being lower level, it gives you a larger degree of control. And requires you to do more work when implementing things.

So really, it depends on what you need to do. And as soon as you're considering porting that game to other platforms, OpenGL looks much more attractive, since it's supported pretty much everywhere.
> 1 votes

---
Tags: graphics, iphone
---


# Question
Title: Do any 3d engines natively import Google Sketchup models
Google Sketchup is about the only 3d cad program I can use, because I suck. Do any 3d engines natively import Sketchup models? Are there any major caveats when doing so?

# Answer
Sketchup can export to Collada (.dae) which I know is readable by Unity. Sketchup Pro will export to .3ds, .dxf, .fbx, .obj which gives you plenty of options for other engines.

That said the automatic triangulation in Sketchup can sometimes create some weird topography. Not that big a deal if you just want to import some shapes, but if you are doing mesh collision it can lead to unexpected behaviors.
> 8 votes

# Answer
Since SketchUp can export in 3DS format, I'd believe many engines can take that. It's a fairly common data exchange format.
> 2 votes

---
Tags: sketchup
---


title: How to become a Game Artist?

text:
# Question
Title: How to become a Game Artist?
If I understand correctly, there are two major kinds of artists involved in game development - 2D and 3D.

I think I somewhat understand, that if I want to go 3D, I should learn some 3D modeling package really well and that would be it. Please correct me if I am wrong.

With 2D I am completely lost. There are a lot of tutorials on the web describing so many different topics like general drawing, vector graphics, raster graphics, pixel art and a whole lot of other things.

So what tools and techniques are most commonly used by professional 2D artists and if I wanted to become one, exactly were should I start(like tomorrow) and what should my goals be?

# Answer
> 12 votes
> think I somewhat understand, that if I want to go 3D, I should learn some 3D modeling package really well and that would be it. Please correct me if I am wrong.

I'll correct you, since you are wrong. Let's assume you want to become a writer, a good one. Do you just need to learn to read and write and type fast on keyboard and that would be it? Of course not.

If you want to become an artist SERIOUSLY consider going through real, traditional art lessons. Drawing, figure drawing especially, doodle in your notebook, give yourself tasks etc. Constantly draw and paint whatever you want to make. Parallel to that you can teach yourself some poly modeling program along with detailing program - a combo of maya+zbrush or maya+mudbox or 3dsmax+mudbox or modo+zbrush or whatever.

You see, you need only a few weeks at most to learn any of these programs sufficiently to know pretty much everything you need to know. What then? You are an artist all of a sudden? Just like by learning Word you are a writer? You, hopefully, understand what I'm talking about.

I'd suggest a plan:

* pick up a program or two and stick with it. I suggest Maya or Max along with Mudbox or Zbrush. You can't go wrong with either. You can do magic with any of them. See which you like more and stick to it.
* Look at gnomon or digital tutorials or 3dbuzz VMTs (good intro to maya they have) programs and go through basics of program. Doodle with it, play with it. Sing a long with those tutorials
* Next step is give yourself a task and go from start to finish with it. 'I wan't to make a car' and make it. Try to go after original, your own designs (this is more appreciated). Avoid knitting models over blueprints and sketches that are not your own. Unless you want to be a drone later on.
* Specialize in something. Maybe you like robots, maybe you like animals... draw them, design them, make them alive - models, textures, lights. Maybe you like designing environments, make them.
* Work work and work. You WILL suck hard at it first, but you will get better. Ask for criticism around and take it in and work on it more to make it better. Never get criticism as personal insults or any of that, it's not.
* Take a drawing class and life drawing lessons.

# Answer
> 0 votes
As always Tom Sloper has a good article about it: http://www.sloperama.com/advice/lesson53.htm

For 2D art usually artists start with pixel art for 2D games. The guy who does art for my games uses photoshop. This is industry standard and is widely used. 3D modelers use programs like 3DS Max or Maya. Blender is a good free alternative.

This is a good article on Raster/Vector graphics -\> http://www.sketchpad.net/basics1.htm

# Answer
> 0 votes
The different topics are basically different styles of art. Every game will demand its own style, so your best bet is to look into all of them.

However, some common threads will pervade amongst everything. "General drawing", as you say, will probably be something that will be useful wherever you are.

As for vector vs raster, it really does depend on what developers you work with. Many games on the Flash platform will tend to ask for vector art (moreso than other platforms, in my experience). Even still, vector graphics are an important part of modeling and you might be able to get away with doing everything as vector graphics and exporting it to raster (which is much harder to do the other way around). It'll be cleaner.

But yes, it depends a lot on the specific game or developers you will be working with. Until then, there is nothing wrong with looking into a bit of everything.

# Answer
> 0 votes
To start, a website displaying your portfolio and what work you have done for clients.

To get your first clients, you could start by donating artwork to places like OpenGameArt, and then when your art is used, you can add that to your resume. Now that you have some sort of background, in that you can point to say that you have made this and this, you could try to offer your services at a number of game development sites. Just keep going like this, getting a larger and more impressive portfolio.

Otherwise, I can't help you much on the "tools" side, but that seems like what you should do to get started as an artist.

---
Tags: assets, art
---


# Question
Title: Where can I find fonts which I can distribute with an open source game?
I want to be able to release my game as open source, and I need to be able to distribute font files with my game. Where can I find fonts which I can use in this way, and what font licenses should I be looking for?

Are there any further considerations if I want to release my game under GPL rather than a less restrictive open source license such as BSD?

**Edit:** In response to Olie saying that the question is unclear: My main problem is that fonts which I find on the Internet either do not clearly state their licenses, or have licenses which do not make it clear whether I can distribute the font with software. I know very little about font licenses, but I am looking for sources of fonts which guarantee that the fonts are basically open source / creative commons / public domain / some other font license which allows me to distribute it with a game without paying license fees.

# Answer
I've used the BitStream Vera fonts in several open-source game projects, and they're quite nice. The license should be good for just about any game, and the gnome project has already worked out the legal issues and currently ship them. Full unicode support which is very rare for free fonts.
> 5 votes

# Answer
dafont.com is a great site for finding cool fonts. Each font comes with a license, so just make sure that the font you choose is free to use.
> 3 votes

# Answer
Open Font Library seems pretty good now that it's working (last time I looked there it was broken). All its fonts are licensed under the Open Font License or are in the public domain.
> 2 votes

# Answer
Blambot has a nice selection free of fonts that are under it's Free License
> 0 votes

# Answer
Here is a link that you might find useful.

Seriously, though -- what did you try?! Maybe I don't understand your question, but it seems to me that the answer is all-over everywhere.
> -3 votes

---
Tags: assets, licensing, open-source, fonts
---


# Question
Title: OpenGL equivalent of .fx files in GLSL or Cg?
There's a lot of learning material in the DirectX world that uses .fx files to manage shaders, and .fx seems to be well integrated with 3D packages such as Maya and 3D Studio Max

What do larger OpenGL projects use? Do they all have a bespoke format or are there any common standards in use that might have some tools to go with them?

I have found a 404 page on http://www.khronos.org/glfx/ and http://sourceforge.net/projects/glfx/files/ has no files at all in the download section.

Can you use .fx files with Cg as the languages are so close syntactically? I hear that Cg has poor performance on the ATI Linux drivers but at least it my help me get going on my own Nvidia system.

# Answer
> 2 votes
The Cg toolkit supports its own version of effect files, CgFX. These support techniques, states, annotations...

I don't have any experience with them personally, but they are supported by FX Composer, at least.

```
CGeffect cgCreateEffectFromFile( CGcontext context,
                                 const char * filename,
                                 const char ** args );

```

According to the Cg Toolkit 2.2 manual, "cgCreateEffectFromFile was introduced in Cg 1.4."

# Answer
> 0 votes
There is nothing equivalent in the OpenGL world, rolling your own format and loader is fine.

A effect format/library for OpenGL is lacking, and would make a good (FOSS) development.

---
Tags: opengl, shaders, glsl, cg
---


# Question
Title: Effective marketing strategies for independent game projects
I would really like to hear how other independents generally approach marketing their game with limited resources. I know how critical marketing is since I've seen it first hand on several fronts. I've been part of teams that didn't put an ounce of marketing into their project and didn't come close to meeting expectations. I've also poured a lot of time into visiting forums to discuss our previous title which resulted in minor bumps over time.

I really think Wolfire is doing some amazing grass roots marketing with the way they are managing their community around their Blog. They've massed a following that is willing to pay (far in advance) them for their game before they finish it to help support them. That's awesome.

But how many people are really willing to divulge such information that early? Should that be a concern? Should I start talking about my next project before I really have anything implemented?

What has worked for you? I would be particularly interested to hear how people approach Apple's iTunes store. I believe we're looking at around 33,000 games on the store these days.

# Answer
> 29 votes
The Zero Budget Indie Marketing Guide is a great read. Besides that, definitely start building buzz as soon as you have anything to show, and do your best to keep the buzz up. Demos, trailers, articles, blog posts, whatever you can get to drive traffic and interest. From what I've heard, paid advertising is not very effective for indie games, so you may want to avoid it. Focus instead on building organic and genuine interest.

# Answer
> 11 votes
I don't know how effective this idea is (I haven't tried it yet) but for my current project I am going to advertise on Facebook. Let me explain.

Essentially I am going to create a fan page, and run an ad campaign on Facebook. What I figure is I can spend like $30/mo (or what ever you want) for advertising. As people become a "fan" of the page, a lot of other people will see that. So basically, if that $30/mo generates 5 fans *directly*, it could generate 50 fans *indirectly*. I figure I could also do some fun stuff with the fan page such as give away copies, solicit ideas, etc...

Like I said above, I haven't tried this so I don't know if it will work. However, I will let you know in the near future. :)

---
Tags: marketing
---


# Question
Title: How to structure a simple game server for a multiplayer game?
I would like to create a simple multiplayer game server for a simple game:

The game is supposed to be similar to Command & Conquer, you have a few tanks and a few soldiers. You can select one soldier and than click on the map, to where the soldier should go. If the soldier comes to an area where he could not go, he walks around. And soldiers can be shot down by enemies.

How should I structure the game server, and what should be done at the client?

I.e if a soldier moves from X to Y but around building Z, I guess the server has to be able to calculate exactly where the soldier is located (in case an enemy shot at him), and the client also has to know the position for painting the soldier.

What should be done at the server and I think I have to desing a protocol for this. I think the server has to keep track of the game state and the time. Is anyone having suggestions on how to do this? or could recommend some reading?

# Answer
In general that's a very complex subject. You have two conflicting aims (at least if you don't plan on running every single game on a dedicated server):

1. You'll want as much as possible done on the server, both to prevent cheating and to make sure all clients see the same things.
2. But you also want things to be fair, which means if one person has a 0-time ping to the server while others have network lag, when both issue a command to their units at the same time, the "server" player has an advantage.

I can't exactly say how to solve that for an RTS. What we do for our FPS firing is have the server save a complete world state a while back and let the client timestamp every shot. When the network message for "I fired!" reaches the server, the server can roll back the world and do collision tests etc on the world "as it looked for the client when the shot was fired".

If you're planning on having lots of units, you'll also have the problem of potentially having too much processing for the server to handle. If you're not terribly worried about hacking or cheating, I'd suggest doing pathfinding on the clients, and sending the results of that over to the server.

Yet another option might be to go peer2peer on it instead, letting each client deal with the updates for the local teams, but that then opens up the question of how to determines who hits what and so on.

Depending on how complex this project is and how much effort you're willing to spend on it, my best suggestion would be to decide something preliminary and start working on it to test it.
> 12 votes

# Answer
There are basically two approaches:

1. Trusted client
2. Untrusted client

The trusted client is a little bit more complex, but has the advantage that you can offload a lot of your computation from the server. Cost of server operation is one of the biggest problems for multiplayer games and will seriously reduce your scalability.

A good approach (for beginners) is to let each players client handle it's own units. In the next step you can use spare cycles to let players clients verify other clients actions. Server shouldn't need to do more than exchanging messages, keeping sync and ensuring persistence (e.g. database).

If you plan to have some kind of lobby or chat then then handle each of these topics in an extra server. It will make things a lot easier down the road.
> 2 votes

---
Tags: architecture, multiplayer, server, state
---


# Question
Title: What are the most popular software development methodologies used by game studios?
What is the best (as in most used by professional game developers and/or companies) software development methodology used in game development?

I've heard that SCRUM is popular, but i'm not sure.

# Answer
> 14 votes
Honestly, it depends on the size and history of the team.

Most of the large teams I've worked on have utilized an adapted version of Scrum. Often, a studio will bring in Scrum instructors or require producers to get "Scrum Master" certification.

As noted above, Spiral is an option.

Generally, some sort of Agile development is used that involves stand-ups, product owners, etc.

There really isn't a "best methodology." Team size and experience dictate the correct process to use. If you're a believer in Lean, you'll also understand that process is very specific to the tasks at hand.

# Answer
> 3 votes
The Spiral model is very popular for game development. Due to the fast changing development cycle and the size of most game projects.

Since game development is a living project and most game projects are not defined well before the project starts. The spiral model allows for fast changes and flexible development.

# Answer
> 2 votes
While Scrum is fairly popular, in my experience it only works if both the team and the management are willing to stick to the plan.

# Answer
> 2 votes
Cowboy seems to be popular...

# Answer
> 0 votes
Whatever methodology you choose, you need to keep in mind that a game at all stages, needs to be fun. The methodology you use will really come down to the team members involved and how many of them are, but at all points you should be able to "play" the game in some form to evaluate if something is working or not. That great design idea that takes weeks of development and does not add to the fun factor is wasted time. Having an Agile methodology should enable you to evaluate each feature of the game as it is developed.

---
Tags: methodology, management
---


title: Which 3D Engine for iPad development?

text:
# Question
Title: Which 3D Engine for iPad development?
I have built a couple of games on the iPad using core animation, but for my next project I would like to built a 3D game. I am not really comfortable with programming OpenGL directly and would also like the toolset that usually comes with a mature 3D engine project. I have used Ogre3D on the PC before and was very happy with that, but I wasn't sure if it had been ported to the iPad specifically and if there were better alternatives available.

What engines have used and can recommend? Specifically I am interested in:

* Cost
* Tool support
* Data import functionality

# Answer
> 8 votes
Unity 3d \- I've played around with the engine on PC and Mac, but not the iPad/iPhone. I have used games on the iPod touch made with this engine though. Works very well from what I've seen.

Unity iPhone 1.7 works with the iPad. You can use basic Unity3D for free to develop/prototype a game, then upgrade/buy the iPhone version.

---
Tags: ipad
---


# Question
Title: What is a good way to measure game virality?
I have added some social features to an iPhone game (Lexitect if you're curious), such as email, Twitter, and Facebook integration for sharing high scores. Along with these features, I am measuring how many times users make it to each step. The goal of these features are to make the game more viral, and I am trying to get to a measure of game virality.

I would think that a game virality metric would produce a number based on 1.0, where 1.0 = zero viral growth, and 1.01 would represent 1% viral growth over some unit of time.

How is virality normally measured, and in what units? How is time capped on the metric? i.e. if I gave each player a year to determine how many recommendations they make, I wouldn't get any real numbers for a year from the time I start tracking it. Are there any standards for tracking virality in a meaningful way?

# Answer
> 8 votes
Virality is usually measured by it's K-Factor. The two links in the wikipedia article there are helpful as well - the article on viral app objectives lays out things, and Jon Radoff's spreadsheet can be interesting to play with to figure out some of the interconnections between various factors.

K-Factor represents the lifetime number of infections that a single infected person makes. So, if your K-Factor is 1.1, then each infected person will infect 1.1 other people - in other words, you are headed for exponential growth. K-Factor does not include the mean time to infection, that's a separate (but obviously important) item.

Truly measuring virality, from what I understand, can be difficult because it depends on your metrics tracking being in place in the right spots, and then you have to keep and correlate a lot of disparate user data.

# Answer
> 2 votes
So, I'm not sure what you mean by "virality". I'm going to assume you mean, "I want to track how often my players recommend my game to their friends and *track how many of those recommendations turn into conversions*."

Check out Google Analytics and Omniture. They provide a great way to track stats across a variety of platforms and also provide ways to visualize those stats. Really, though, you could roll your own without too much effort.

Let's take one case: Player A downloads your game and starts playing. As part of being run for the first time, your game generates a unique ID.

Now suppose Player A is playing your game and it sends out a "I reached level 12! Play with me!" notification to the social network du jour. But wait! Each link embeds another unique code in the link to your homepage from which players can buy your app -- via an iTunes link or whatever. This second unique code includes the first (which uniquely identifies a player) plus some extra stuff (what level they're at, etc).

Along comes some of Player A's friends imaginatively named B, C, and D. Each one of them clicks this link and is directed to your homepage.

You can then see if this person clicks the link to buy your app. By tracking the "arrived at your homepage with unique code" numbers versus the "bought your app" numbers, you could come up with a rough, continuous measure of how often you're converting random people to game players.

**EDIT**: By the way, if I'm completely misunderstanding your question please comment and I'll pull this answer.

# Answer
> 1 votes
The only way to really test it is to measure the outcome of those messages. Eg is there a way to correlate the number of tweets to the number of new downloads.

Speaking purely about twitter, the easiest way to measure virality is to see how often a tweet gets retweeted.

For example, I have a website whendidyoujointwitter.com - it has a 'tweet this' type of link. Often when someone tweets that link, some of their followers will go the link in their tweet and in turn tweet their own message. We can then measure the virality if we see on average how many followers do this 'retweet'.

Eg if someone with 1000 followers tweets it and then 10 of their followers tweet it as well, this is a success rate of 1%.

Now, this is still not a virality percentage. We have to go a step further by asking how many followers does the average twitter user have? If everyone had 1000 followers, then those 10 retweets would result in 100 retweets which would result in 1000, etc (until it peters out - there are only so many twitter users/people in the world) - ie very viral by most standards.

BUT not all twitter users have 1000 followers. What we can try to calculate is a tipping point. With a success rate of 1%, how many followers would the average user need to have in order for the meme to keep spreading?

If the average is 100, then 1% means a tweet would result in 1 more tweet - ie the meme would be kept alive. If the average is less than that, then the meme is sure to die out.

Now, going in reverse, the latest stats I can find show the average follower count is 70. So a success rate of 1% is not enough to go viral - it would need to be up around 2% or above.

Uhhhhm so thinking about, I guess it's a logarithmic/exponential thing.

* 100% success rate (all retweet) = viral maximum
* 10-99% = extremely viral through this whole range
* 2% success rate = viral minimum
* 1% or less = not viral

---
Tags: social, facebook, twitter, marketing
---


title: What should a main game loop do?

text:
# Question
Title: What should a main game loop do?
*Generally*, what are the core things that one should do in the game loop, and what are some things that one shouldn't do in the game loop?

# Answer
**The main game loop handles three major tasks:**

1. Get user input
2. Update the game state
3. Draw the game

**A simple game loop just mushes these three tasks into one while loop. This has some undesired results:**

1. Game runs at different speeds on different computers.
2. CPU (can be needlessly) pegged at 100% usage.
3. "Game states"/menus are missing or mixed with game code.
4. Main game loop is very long and hard to maintain.
5. Code is difficult to extend/port to other platforms.

**Advanced gamed loops address the issues listed above.** Here are some useful articles:

**For an excellent example game loop, take a look at the Allegro skater demo game:**

Other related resources:

**Game loops often do the same type of work for most games, so I have been thinking of a way to make a generalized game framework.** It is better to write one implementation of a game loop and share it between games. It saves work when creating a new game, and improvements to the shared game loop can be shared by all games (for example, adding a FPS counter or screen capture feature).
> 136 votes

---
Tags: architecture, game-loop
---


title: Which frameworks are system agnostic?

text:
# Question
Title: Which frameworks are system agnostic?
I'd like to have as little portability issues as possible but supports hardware acceleration. The main priority is on PC and having a game run on Windows, Linux and MacOS. Porting to consoles would however be great, too.

# Answer
> 4 votes
I didn't see a language requirement, so I'll throw out something for the Pythonistas. There are also Pygame and Pyglet.

Pygame relies on the SDL under the covers so has some added dependencies when going cross-platform. Pygame is arguable more mature and there are tons of examples online.

Pyglet has no external dependencies and is a breeze to distribute with. Pyglet seems more pythonic and has very clean documentation.

# Answer
> 4 votes
I'm going to give the obvious answer here, which is Ogre3D. It's a feature rich and mature 3D graphics engine/framework, written in C++.

It runs on Windows, Linux and Mac OS X and even on iPhone and other devices. There are also wrappers for Java, .NET and Python out there (see: http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Alternative+Languages), so you are even free to choose your programming language to some degree.

# Answer
> 4 votes
SFML is a great framework written in C++. It currently supports Linux, OS X, and Windows. It has bindings to C, D, Ruby and Python. It's also released under zlib/png license.

In comparison to say, SDL, the only downside it has is using window input on win32, rather than DirectInput. It also is not one large library, but a group of them, which allows a more modular approach to which libraries you use :)

# Answer
> 2 votes
libsdl is very portable and supports openGL

# Answer
> 2 votes
You may want to look into Java solutions. LWJGL is a pretty decent OpenGL binding and was used for a number of commercial games already. There's also the official OpenGL binding called JOGL however afaik it's not as mature as LWJGL. You may also want to look at Jmonkeyengine which is a Scenegraph-API/Game Engine. Obviously since it's based on Java there are very few portability issues and with a decent VM (i.e. Suns 1.6 VM) performance is more than good enough for most cases.

# Answer
> 2 votes
Panda3d is a free game engine that works in Linux, Windows and Mac OS X

# Answer
> 2 votes
Allegro will work on Windows, OS X, Linux, DOS and some others.

---
Tags: cross-platform
---


# Question
Title: Tips for developing 3D games on newer engines targeting old hardware
I see a lot of examples and tutorials for 3D engines like Unity3D, UDK, Source etc. They all seem to be under the assumption that you are making a game for current(ish) hardware.

I would like some tips or tutorials on how to develop a game using UDK, Unity3D or any other modern game engine while targeting what might be considered ancient hardware.

Hardware specs might be as low as

* 1GHz-1.8GHz single core CPU
* 8MB-64MB Video chip
* 512MB-1GB RAM

Thinking along the lines of older laptops or old business class machines that might have, at most, an Intel GMA900 chip or a ATI Radeon 9000 chip onboard.

# Answer
1. Test, test, test! Find someone with or buy an old laptop, if you're looking to sell your creation, the expense is worth it.
2. Keep polygon counts low! Many older Intel devices run vertex shaders on the CPU, which can very quickly become the bottleneck.
3. Use appropriately sized textures! Texture bandwidth on older hardware isn't great, so avoid using more pixels than will be displayed on screen.
4. Avoid complex pixel shaders/materials! Stick to simple blending operations, and reuse them as much as possible.
5. Profile! If possible, provide special development modes to help find bottlenecks like:

* Replacing all textures with a single 1x1 texture
    * Swaping all models with a simple cube
    * Replace all shaders/materials with minimal versions
> 3 votes

# Answer
Well given that unity targets iPhone then iPhone 3G (not S) has pretty ancient fixed function style hardware. You should have no trouble getting software written for an iPhone 3G to run on older hardware.

Beware the driver bugs though!!
> 1 votes

---
Tags: architecture, compatibility
---


title: XNA: How does threading work?

text:
# Question
Title: XNA: How does threading work?
I would like to implement threading in my XNA game but I'm not sure how things work when compiling for the XBOX 360. Could someone elaborate on this?

For example, how many threads does XBOX support? I realize that XNA uses a special version of the Compact Framework. How does this affect the code during development? Do I implement things differently when developing for XBOX than Windows?

Thank you.

# Answer
> 13 votes
Basicly, the xbox 360 has 6 hardware threads, spread over 3 cores. Two of these are reserved for the xna framework and general system use. Threading works the same as it does on the .net framework on windows,except you get an extra methods, SetProcessorAffinity. Unlike windows, the xbox dosnt do any fancy thread scheduling for you, so you have to tell it what hardware thread to run your thread on.

There are some good xbox aware thread pools out there, have a look on google if you need some example code, but if your confident with threading in windows that msdn page should give you all you need.

---
Tags: xna, xbox360, multithreading
---


# Question
Title: Why does Farseer 2.x store temporaries as members and not on the stack? (.NET)
**UPDATE: This question refers to Farseer 2.x. The newer 3.x doesn't seem to do this.**

I'm using Farseer Physics Engine quite extensively at the moment, and I've noticed that it seems to store a lot of temporary *value types* as members of the class, and not on the stack as one might expect.

Here is an example from the `Body` class:

```
private Vector2 _worldPositionTemp = Vector2.Zero;

private Matrix _bodyMatrixTemp = Matrix.Identity;
private Matrix _rotationMatrixTemp = Matrix.Identity;
private Matrix _translationMatrixTemp = Matrix.Identity;

public void GetBodyMatrix(out Matrix bodyMatrix)
{
    Matrix.CreateTranslation(position.X, position.Y, 0, out _translationMatrixTemp);
    Matrix.CreateRotationZ(rotation, out _rotationMatrixTemp);
    Matrix.Multiply(ref _rotationMatrixTemp, ref _translationMatrixTemp, out bodyMatrix);
}

public Vector2 GetWorldPosition(Vector2 localPosition)
{
    GetBodyMatrix(out _bodyMatrixTemp);
    Vector2.Transform(ref localPosition, ref _bodyMatrixTemp, out _worldPositionTemp);
    return _worldPositionTemp;
}

```

It looks like its a by-hand performance optimisation. But I don't see how this could possibly help performance? (If anything I think it would hurt by making objects much larger).

# Answer
Although in .NET value types are stored on the stack, resulting in a minimal allocation cost, it does not however eliminate the cost of initialization.

In this case we have a set of functions using one or two temporary matrices, which would result in the initialization of 16-32 floats per call. While this may seem insignificant, if the methods are used often enough (say, thousands and thousands of times per frame), the total overhead can have a meaningful impact. If such a technique is used systematically across all such methods, the overhead eliminated can be considerable.

While use of such a technique eliminates the ability to provide thread safety at a per-object level, it is generally unwise to provide that guarantee at such a granular level.
> 6 votes

# Answer
Good question. I'm a pretty sharp C#/.NET guy and a bit of a performance nut, and this seems like a rather odd design decision to me. The first thing that jumps out at me is that this code is in no way thread safe. I don't know if that's an issue in a Physics system, but storing temporary data outside the scope of a method is often a recipe for disaster.

Honestly, if I regularly encountered this kind of code in a third-party framework, I would probably try to find another framework.
> -1 votes

# Answer
The GC on the 360 basically only does GEN 2 collections, which are expensive, so temporary variables that get created and removed every frame (like temp objects) cause a whole collections to run, which will kill performance really fast.

I suspect they did it this way to reuse that object and not have it collected.
> -1 votes

---
Tags: xna, c#, .net, farseer-physics-engine
---


# Question
Title: anyone knows any open skeletal/bones 2d animations framework for java?
Some examples could be the animations framework used in Aquaria, or in Crimson Legend.

# Answer
Most developers simply create their own tools; there is no standard format that I know of.

Part of the reason for that is it's a relatively straight-forward task once you have written the code to display such a keyframe. It's a trivial step from that to add some basic functionality to move and rotate each bone, and save the set of transforms as a keyframe. From there, you need only add some controls for the timeline, and you have yourself an editor!

That said, I was able to find this editor, though you'll have to write the loading routines yourself: http://www.allegro.cc/forums/thread/590509
> 2 votes

# Answer
It's probably not what you're looking for but JME has support for skeletal animation: http://www.jmonkeyengine.com/wiki/doku.php/animation.
> 1 votes

---
Tags: java, 2d, animation, skeletal-animation
---


# Question
Title: How can I add a Silverlight menu/hud/interface to an XNA game?
There are some programs that allow you to design some menus/hud/interfaces in flash and then insert them into your game. But is there something similar for making all of this stuff in Silverlight and then mount that content in your XNA game?

# Answer
> 3 votes
Not really, there is no elegent way to make silverlight/wpf and xna live side by side like that. At work we reimplemented some of WPFs basic controls to do in game 2D layout, but thats over most peoples needs. You better off rolling your own game specific UI code.

Might be an idea to keep you eyes on RedBadgers XPF project, but its going to be a long wait :P (the company was founded by the guy who did our wpf/xna implementation at work)

# Answer
> 2 votes
There are some open source UI toolkits for XNA, but none that would give you the richness of Silverlight (or WPF for that matter). WPF is capable of hosting Direct3D content, and I've seen it hacked to support XNA, but the performance isn't great. The screen updates are effectively limited by the frame rate of WPF, as the hosted 3D scene is composited into the WPF scene. The same would go for Silverlight, if it were to support this kind of integration. What you would *really* want is to be able to host the Silverlight content within XNA, and not the other way around. Unfortunately, this capability does not appear to be on the road map.

If you really want to leverage the layout and templating capabilities of Silverlight, you might consider implementing them yourself, as Cubed2D's team did for their project. That may be overkill, though. But if you do decide to go that route, you might want to check out this WPF implementation for C++/Win32. You won't be able to use any of the code, as it's all C++/Direct3D, but it could give you some hints for how the tessellation, rendering, and compositing are done.

# Answer
> 1 votes
Yeah doesn't sound like that would be possible as they're both going to fight over control of directX I think. At least XNA has a decent 2D API for you to work with. You could make some simple components like a numerical display, bar display etc and possibly a little an application to visually drag them around and arrange them, then spit out an XML file with the configuration.

# Answer
> 0 votes
Short answer: it's not doable.

I actually looked into this myself a little while ago, searching for a .NET-friendly equivalent to Scaleform (the toolkit that I think you're thinking of, embedding a Flash display as your UI--Unreal uses it). The Silverlight stuff won't work, but if you're willing to do some work to achieve your goal, the Mono Project's implementation, Moonlight, might be the way to go. Moonlight uses Cairo for rendering and there are both OpenGL and DirectX backends for Cairo to emit to, and it seems like wiring up UI events should not be too difficult. The main issue is that Moonlight does not compile on Win32. I looked into it and it was more trouble than I wanted to deal with, but it didn't seem *that* hard.

(Why Moonlight depends on GLib, I'll never know...)

---
Tags: flash, xna, silverlight
---


# Question
Title: Graphic Engine/Programming/Etc resources?
Posting this question here rather than SO because of it's relevance with game development.

My dilemma is this: It is currently my summer vacation after my first semester of CompSci and I have learned enough C++ to actually get started in a little more advanced stuff.

I don't want to start games programming yet until I teach myself linear algebra, trigonometry, etc. However, I do want to know the fundamentals, the theory and the methods used in game programming!

I thought I had some decent books in the college library, but they were horribly outdated with books on game programming or game engines or game/graphic (topic here) from the early 90s to 2002.

Knowing the volatile state of computer technology, I figured grabbing knowledge on cutting-edge technology from a decade-old book isn't a good idea. Amazon itself leaves me clueless as to what book I want.

What I don't want: A platform-dependent book. I'm not out to learn OpenGL, Direct3D or any specific API. I just want to know things like tessellation, how the GPU handles stuff, what goes on under the hood and what kind of raytracing and radiosity methods there are. The basics, the core concepts- those kinds of things.

I hope that's clear! Books, resources are all welcome. Though I much prefer a book over a website!

# Answer
These are by no means "exhaustive" for games, but they're good books for computer graphics in particular, so here's a start.

# Fundamentals of Computer Graphics

### Peter Shirley, Steve Marschner

Amazon Link (Third edition) | Book Website (Second Edition)

(source: images-amazon.com)

This book covers a ton of information on many areas of computer graphics. "Online" concepts (like real-time) as well as "offline" (like global illumination) are covered, as well as math, shading, the graphics pipeline, textures, data structures, light and color theory, mesh concepts, etc. It's definitely not geared specifically towards games, but rather computer graphics concepts in general. The book isn't written in any specific programming language, but rather the language of math.

# Real-Time Rendering

### Tomas Akenine-Moller, Eric Haines, Naty Hoffman

Amazon Link (Third Edition) | Book Website (Third Edition)

(source: images-amazon.com)

This book is geared primarily towards "online" (real-time) graphics methods. It covers the graphics pipeline and related math, shading and texturing, lighting, screen-space effects, NPR, meshes and curves, and some acceleration techniques. The chapter on intersection test methods is worth the cost of the book alone, as it's a fantastic reference for testing collisions between just about any type of bounding volume you'd ever want to use. It discusses shaders, where they fit into the pipeline, and what they can be used for (which is essential knowledge in modern graphics work) but you certainly couldn't learn shader programming in any language from this book. It's a high level overview of real-time techniques, not a programming book. Again, the language used in this book is math.

# Game Engine Architecture

### Jason Gregory

Amazon Link (First Edition) | Book Website (First Edition)

(source: gameenginebook.com)

I would add this book to your list if you're interested in graphics specifically as they relate to games. Gregory covers large game engine systems from a 10,000 foot view, occasionally giving you code samples in C++ to illustrate his points, but mostly it's an overview of what the major engine subsystems are, how they work, how they fit together, and what things you should think about when designing/building them. 3D math and a C++ refresher (with a specific focus on game programming) is covered, as well as resource managers, simulation loops, input devices, debugging techniques, rendering and animation engines, collisions and rigid body dynamics, and gameplay systems. The only two major engine subsystems missing from this book are audio and networking, which is honest about leaving out because the book is already pushing over 800 pages. It's a great read, I'd highly recommend it.
> 16 votes

# Answer
If you're interested in a round-trip tour of everything rendering, Real-Time Rendering is your best bet.

In terms of math, there are several good introductory books, ranging from the more gentle 3D Math Primer for Graphics and Game Development to the broader Mathematics for 3D Game Programming and Computer Graphics.

I also highly recommend Game Engine Architecture if you're interested in that route; it's not an in-depth book on the matter (nor could it be), but it's a solid foundation across a broad range of topics. For a beginner I would consider it invaluable.
> 3 votes

---
Tags: books, assets
---


# Question
Title: What does everyone like to use for UI elements for their games on the iPhone?
I'm asking this to get everyone's opinion -- I realize there isn't one "right way" to do this. I've tried a few ways myself, including using Cocoa for everything including the game itself (good for simpler games, like card games for example), using Cocoa for the screens outside of the game and using my game engine to present game objects on the screen as UI.

What do people prefer to use for game UI? I'm particularly interested in hearing about why you chose to go that way and if you found that your choice was a good one after implementing it.

# Answer
> 2 votes
We chose to use our own in-game UI for a few reasons, the main one being it enables easy ports to the Android platform (hardware diversity issues aside), as well as windows-based builds (very handy for testing), and it allows a great deal of flexibility in terms of bringing game elements into the UI (for example, our particle system was reused to add a bit of flair to the UI).

Overall I'm very happy with the decision, though it's not without it's caveats. Namely, UI building is much more expensive than it would have been with IB, and the initial time required to build a usable UI system was considerable.

# Answer
> 2 votes
I have taken advantage of what apple has provided with UIKit. My last few projects have abused Core Animation/UIKit instead of OpenGL ES. For my case it worked perfectly well. My next project will use OpenGL ES and I'm not quite sure how I will manage the UI yet. I will likely still abuse UIKit.

I've seen a few developers use OpenGL ES to push their graphics and actually integrate UIKit into the scene to handle the User Interface. If you're interested in hearing a developer talk about the integration check out this article he wrote. Great guy.

# Answer
> 2 votes
For my last iPhone (Dr. Awesome), all the menus before the game started were in UIKit. I didn't even create the OpenGL context until the game was started. In our case, it worked out really well as the menus were created really quickly and with a GUI and didn't require a bunch of game-specific UI code. It's important to note, though, that the design of our game was such that we didn't need to have menus integrated with game art, and the game itself had no buttons (other than a dialog box for the pause menu).

In retrospect, doing everything in GL and rolling our own UI system would've allowed for more flexibility and portability. In our case portability wasn't a concern (and I really wanted to learn/abuse Objective-C), and the cost of adding menu code wasn't really worth the added flexibility. And we weren't in a position to really need to use the code base after that project to amortize the cost of doing our own UI system (since we've switched to Unity as our iPhone engine).

---
Tags: iphone, cocoa
---