# Question
Title: TitleSafeRegion isn't available on XNA 4?
I'm following the book Microsoft XNA Game Studio Creators Guide v2. and there is a snippet in the book that is used to return a Rectangle that represents the safe area you can draw without the fear of 'drawing' outside the screen.

Except in my IDE Visual Studio 2010, that method doesn't show up in intellisense and in fact doesn't show up anywhere.

Here is the snippet:

```
private void UpdateAsteroid(GameTime gameTime)
{
    // time between frames
    float timeLapse = (float)gameTime.ElapsedGameTime.Milliseconds;
    if (move == true)
    { // asteroid centered at the middle of the image
        Rectangle safeArea = TitleSafeRegion(rockWidth/2, rockHeight/2);

      // asteroid right edge exceeds right window edge
    if (rockPosition.X > safeArea.Right){
        rockPosition.X = safeArea.Right; // move it back
        rockSpeed *= -1.0f; // reverse direction
    }
// asteroid left edge precedes the left window edge
else if (rockPosition.X - rockCenter.X < 0){
rockPosition.X = rockCenter.X; // move it back
rockSpeed *= -1.0f; // reverse direction
}
// asteroid within window bounds so update rockPosition
else
rockPosition.X += rockSpeed * timeLapse;
// Scale radians by time between frames so rotation is uniform
// rate on all systems. Cap between 0 & 2PI for full rotation.
const float SCALE = 50.0f;
rockRotation += rockRotationSpeed * timeLapse/SCALE;
rockRotation = rockRotation % (MathHelper.Pi * 2.0f);
}
}

```

# Answer
> 2 votes
Hey guys, I am also reading the same book, and that method is defined as a procedure in the game class ( File Game1.cs) as

```
Rectangle TitleSafeRegion( int spriteWidth, int spriteHeight )
{
    #if XBOX
    // some televisions only show 80% of the window
    [... code here ...]
    // ensure image drawn in safe region on all sides
    return new Rectangle( [... code here ...] );
    #endif

    // show entire region on the PC or Zune
    return new Rectangle( 0, 0, [... Code here ...] );
}

```

It isn't part of Viewport, the author implemented his own method to show compatibility with XBOX, PC, and Zune. It is found on Chapter 4, page 44. Hope this answered your question. Sorry, for the late post.

# Answer
> 1 votes
Are you sure that method isn't defined earlier in the book? From your calling code example it's an instance/static method of the class that UpdateAsteroid is a member of - it doesn't appear in MSDN as a member of the `Game` class (for 4.0 or 3.1).

Alternatively, Viewport.TitleSafeArea property might help.

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


# Question
Title: How to create a simple "spot light" effect with Sdl or Sdl.Net?
i'm wondering: how to create a simple "car headlight" (for i.e) or a torch spotlight in Sdl or Sdl.NET ? Does anyone know how ? Thanks

# Answer
> 1 votes
You can implement the light as a translucent image, e.g. a .png with an alpha channel. Then you just rotate it to point to your looking direction.

---
Tags: lighting, sdl
---


# Question
Title: Is there any opensource game frameworks in browser?
I have been looking for and found any.

# Answer
> 1 votes
There are many, some of most famous:

http://gamequery.onaluf.org/

http://www.sean.co.uk/a/webdesign/javascript\_gamelib/javascript\_gamelib.shtm

http://www.effectgames.com/effect/

http://mccormick.cx/projects/jsGameSoup/

http://rocketpack.fi/engine/

---
Tags: javascript
---


# Question
Title: Questions to answer and heuristics to use when selecting a new project?
Say I have a list of (in my case, indie) game ideas, from which I need to select a new project to work on.

What are the questions/heuristics that you would use - and ideally have already used successfully in the past - to narrow down such a list to a single idea to work on?

# Answer
If I had to come up with a system, it would be similar to this:

* Ask "Would working on the idea break any legal agreements/contracts I signed?"
    + Cross out all the projects that you answer "yes" to. Highlight any "maybe" or "idk" projects
* For each of the projects that are not crossed out, assign an estimated "time to complete" value
* Ask "How much time do I foresee myself having to work on any project?"
    + Cross out all the projects with estimates over your answer
* For each of the projects that are not crossed out, assign a value between 1 and 4 (inclusive) that indicates how fun/exciting the idea is to you
* Select the idea that has the highest fun/excitement value, and the lowest "time to complete" value

In reality though, I tend to prototype the ideas that I'm most excited about, and more often then not, the idea I end up choosing is the prototype I'm working on when I look up at my clock and realize it's 4am...on a work day.
> 4 votes

---
Tags: business, project-management, planning
---


# Question
Title: How to Divide Responsibilities Between a Two-Man Group?
A partner and I are in the midst of creating a (not so) simple game via C++ and SFML (2D). We have both created some simple games (not together) and would like to start work on a more serious, larger project that challenges our abilities to program, interact with large code as well as working together without getting in each other's way.

The problem is the getting in each other's way- well, not yet at least.

We had our first group session today (us two working on the project, one to-be tester and a friend of ours) and wrote down some ideas. It's going to be a birds-eye perspective zelda-like (from SNES) game with a streamlined map and quasi-linear gameplay like Gothic (open world, but you'll likely get yourself killed if you wander around too much).

Needless to say, I'm not sure if we're aiming too high for the moment, but our biggest concern is the division of responsibilities. Our first impulse was to work on aspects of the game that had nothing in relation to the other (I would work on the menu, he would work on the map, for example).

Our next impulse was to work on closely-related things in a list-manner. (First the menu, then a map, then the character, then the monster, etc) so we can, piece-by-piece, see our code coming to life in an orderly fashion.

We haven't picked a VCS yet, but I'm thinking it's going to be Mercurial for the simple reason that I have heard good things of it (neither of us have yet to use a VCS).

Question: What would be the proper way to divy up the responsibilities between the two of us? How should we start, how should we continue and how do we do it together with maximum efficiency? Any other tips would be greatly appreciated!

# Answer
> 4 votes
I have found that it's best to **have something to start with**. Then it's easier to list the things that need to be added or fixed, and divvy those out. So you might consider pair programming at first, just to get some basic stuff running and some organized code laid out.

Just schedule a few hours one day, both of you sit down, one of you be the coder (or switch off), and start from scratch. Create the project, import the libraries, write some basic code, get something on screen. Maybe develop another couple features, to have something working. And then check it into the repository. From that point forward, split so that both of you are working on different things. Make a list, based on what you now have working, of what should be the logical next things to add. There are bound to be features that can be added simultaneously and don't conflict or rely on each other. Then each of you start owning a feature, coding it, and pushing it into the repository once it's stable (and between stable, push it to a branch repository for backup). Rinse, repeat.

Also when working with version control systems, it's very important to **commit and push often**. Similarly, you then also need to pull and update (and test!) often. When you pull & update a lot of code and something breaks, you're going to be relieved that you can just revert to where you were and update one change at a time until you find the breaking change.

Another thing, possibly even more important, is to **keep a working copy of your game at all times**. It's like a foundation, something to show friends when they ask how the game is coming and something to inspire you when you're so deep in code that you don't think you'll ever finish and have the game running again.

But I think I'm getting off topic. Basically, once you get started together, you'll find it's not as hard as you think! You just need to get off the ground.

# Answer
> 2 votes
Personally, I think you NEED a server for managing files, assets, versions, etc. Yet for a 2-man project, SVN can be tricky to learn when you never used it (for making merges for exemple), but still it's a good tool and completely free.

For dividing tasks, it highly depends on the time you two will need to complete tasks. In video games, tasks are really often binded to other tasks (Need to map editor to place units, need the inventory to choose object to use...). Game industries usually use a project management tool called SCRUM. It is tricky to understand and need time to use correctly so I don't think you should use this method, but there actually is some concepts that could be quite interesting for you.

For exemple, Scrum method says to divide a project in small iterations. Each iteration should give you a functionnal game (yet not complete). Using this will allow you to get a demo of your game every 3 - 4 weeks to see where you guys are and make adjustment of project scope. Next interesting feature is, in each iterations, write a set of game features that should be implemented. Theses features are not from the programmer view, but from the player's. For exemple if you want to give the ability to jump, do not write "Add physic module to Player class to push upward acceleration" anyway the way you think it should be implemented will change. The task should be "Make the hero jump". Using this method, you will choose what you are working on when it's the time. When a feature is finished, choose another one.

Another advantage of using such methods is that none of you will be the "Hero of map editor" or "Hero of physic module". If you guys are approximatively the same level, you should work on every modules of the game. Code quality is a thing you want to make sure to respect and a double check is always good. So you should work on all module to assure the quality of work, but to make your brain work on other types of problems to, it's good for the motivation! Finally I would suggest you to make your friend check every features you finish before you make the final commit in the game. Like this, you guys will learn about each others, you will help each other out and you will know about how the other modules of the game are coded. The latter will help you creating new modules.

I suggest you to check this http://www.agile42.com/cms/pages/agilo/ it's a free Scrum tool that you can use with SVN. I used it in a project with friends and it work quite well for small projects.

Good luck ! :)

---
Tags: 2d, project-management, dev-groups
---


title: Save File sharing over Mobile Networks

text:
# Question
Title: Save File sharing over Mobile Networks
I'm looking to have people share game content, save files, or characters on a mobile game platform. That means they need to be able to upload and download from their phone, other iOS device, or computer.

What's the best way to do this?

Does Apple have a history of allowing games to download 'content' (incl. graphics) that hasn't been approved?

Are there any apps that do this, that I can try out?

Thanks,

---

\[EDIT\]

The files I want to share will be simple \*.plist files, probably in binary format.

# Answer
> 1 votes
You'll want to use something like Amazon S3 or Azure Blob storage. Both of these services will charge you for data transfer both IN and OUT; as well as the average storage amount you are using on their servers.

They both offer a simple API to read and write data to and from, you can write iOS, Android, BlackBerry, Windows, Mac, Linux, etc versions of your application, which would all consume the same web service API. This gives you the ability to have users interact with data on any platform, and have those changes immediatly available on any other platform.

Optionally, you could write a simple web-service which handles your data conversion between platforms, you could use something like Amazon EC2 to host a service like this. Depending on the complexity of the data you are storing this might be over-kill.

---
Tags: iphone
---


# Question
Title: Will multi-touch become an important/standard method of input for PC games in the future?
We've seen that multi-touch on smartphones has been wildly successful. On the iPhone, in fact, it's the only tactile input the user can provide! However, I'm wondering how likely it'll be for multi-touch to take off on desktop PCs (and PC gaming) in the future. Right now, it's mostly a lack of good multi-touch monitors on the market, but the fact that there's not much of a push by manufacturers is disconcerting. It'd be really nice to have multi-touch gestures to navigate in an RTS, for instance, and music games would be really fun with multi-touch input (think Elite Beat Agents or DJ Max Technika, but on the PC). An example.

Do you think that multi-touch for PCs will eventually take foot and become popular, or will it stagnate?

P.S. I'm guessing this would be best suited for CW, so if a mod feels like it's appropriate, feel free to mark it as such.

# Answer
> 1 votes
I can say multi-touch games will be a different genre, not another standard method of input for pc games. There are games people will still prefer to use on controllers. (Imagine street fighter using multi-touch)

Multi-touch might only just be useful for entertainment and future homes or even educational game purposes.

# Answer
> 3 votes
I don't think that Multi-Touch will ever be big on the PC. One big reason: Just try pushing your monitor. If you are like 99% of all users who have their monitor on a feet or arm, the monitor will now be pushed back.

Multitouch works on the iPhone because you hold it in your other hand and provide resistance.

But on a PC, finding the right balance between proper placement of the screen for working AND ergonomic usage just won't happen. Either you tire out too easily or you can't see properly or you have stuff in your way on the desktop, e.g. keyboard and mouse. Trying to move the monitor then results in cables being in the way.

Sure, you can solve that by mounting it on a flexible arm and moving between work and play modes - welcome to the \<1% of users who have such a setup.

Multitouch is a nice idea, but the ergonomics are simply too horrible and there is no viable solution anywhere near.

# Answer
> 1 votes
Ergonomics of multi-touch vertical monitors just doesn't work, not to mention that having your hands in front of the screen isn't ideal for visibility.

The idea of multi-touch pads for desktops is interesting, but they have issues. Wacom and similar tablets work well because they can sense the pen when it hovers over the tablet. This allows the user to move a cursor around the screen without committing to a button press. You can't do that with multi-touch, so either the user is always pressing a button, or you need some other indicator for clicking. Neither option there is ideal.

# Answer
> 0 votes
If multitouch becomes more popular and supported in games, it'll more than likely be due to multitouch trackpads on gaming-capable laptops becoming more and more pervasive and not due to touch monitors.

For desktop work, I don't see multitouch monitors being that popular. I don't think the ergonomics support it.

# Answer
> 0 votes
PC doesn't have to take all "good" interfaces. Even if we have multi-touch monitors right now, I think it would be very inconvenient. I would not use it! Even iPhone game plying is painful if you play long. (not too long for PC/Console Game)

I think new devices for multi-touch screen(for PC, but not main monitor) will become available.(for designer for example?) But I don't think such devices are greatly concerned in game development.

---
Tags: input, multitouch
---


title: Independent Arcade Game Development

text:
# Question
Title: Independent Arcade Game Development
So I've been looking around, but it seems that information on this is scarce.

If one wants to develop an arcade game (as in, coin operated), ignoring the software side, where does one start on the hardware side?

I mean, is there some kind of company that sells arcade systems with some kind of spec for you to develop things on, etc?

I suppose this question is asking a lot more about the entrepreneurial side of stuff, but it's probably still related to game development..

# Answer
While Sparr is correct that there is no single standard platform, there are some hardware standards you need to know about.

If you want to sell games (i.e. a PC and hard drive) rather than entire cabinets, you'll need to make sure your hardware of choice supports JAMMA, which is the input/video port used on arcade machines.

If you don't want to spend a lot of time developing your own hardware platform or learning a new one, you might want to consider the Taito Type X series of arcade boards. These boards run hardware similar to a standard PC, and porting PC games to them is generally easy.

Note that the arcade market is dead in most countries, very competitive, and very expensive to enter. Your best bet is to get a company already in the arcade market to buy your game, and they'll probably dictate their hardware platform based on what they have experience in.
> 5 votes

# Answer
You can purchase a cabinet from any number of cabinet manufacturers. I can recommend NorthCoast Custom Arcades. Then you need a screen, which is just a monitor, and an input device, which is usually a set of panel-mounted joysticks and buttons and can be had from many manufacturers (I think mameroom's controller offerings are very overkill). Finally you need a coin/token/bill/card acceptor, which is also available from numerous sources depending on exactly how you want to take payment. Once you have all that, you can just connect it to a PC installed inside the case.

Which is to say, in response to what you might have been trying to ask... No, there is no "standard" arcade cabinet "platform" that you would design for. Most companies use their own mix of hardware and software.
> 2 votes

# Answer
Just to toss this out there, you can build your own and simply stuff a standard PC inside it, Scott Hanselman did this with his Hanselcade -- http://www.hanselman.com/blog/CategoryView.aspx?category=Arcade very labor intensive, but if its for a pet-project this may be what you (or some googler down the road) is looking for.
> 0 votes

---
Tags: business, hardware
---


# Question
Title: What tools are available for collaborative game development?
Are there any tools that would let multiple people edit things like sprites or code at the same time? Perhaps something that works with services that host code.

# Answer
> 6 votes
Surely a source control system is what you need? Check-ins, check-outs, version history, that sort of thing.

# Answer
> 4 votes
**Version Control:**

Try GitHub for version control. It's fantastic -- you can use git or svn (whichever you're more comfortable with) and your repositories get free issue tracking, wikis and cool visual graphs. The only downside is that if you want your project hosted privately, you have to pay. (It's as low as $7/month as of this writing; we pay and find it well worth the cost.)

**File Sharing:**

We also love and use Dropbox. It supports Windows, Mac and Linux and features automatic file syncing across multiple machines. You can even hook it into Growl to see what your collaborators are doing realtime! Best of all, the basic plan is free and gives you a very generous 2GB of storage. *(Note: should be mentioned to be careful with Dropbox files, as your collaborators could inadvertently destroy your changes. Luckily Dropbox provides some versioning but extra precautions on your end are recommended!)*

# Answer
> 3 votes
For a text-editor which supports multi-user-editing, try Gobby, also there is a project from mozilla labs called Skywriter, which allows you to to embed a multi-user-editor on your website.

# Answer
> 2 votes
Google Docs is one way you can share and edit design documents.

# Answer
> 1 votes
## Alienbrain

Alienbrain is one of the only version control systems made for art assets.

Refer to **SO**: Version Control for Graphics

---
Tags: tools
---


# Question
Title: What are the networking possibilities with XNA and Xbox 360?
I know that XNA for Xbox 360 has limited access to networking, rumored to only allow communication via a propitiatory Microsoft protocol to other Xbox 360 units.

What are the networking possibilities XNA offers? How many Xbox 360 units can be connected to the same subnet? 16 maximum? Can any Xbox send data to any other Xbox on the subnet like Peer-to-peer communication? Can an Xbox communicate with XNA on Windows PC's as well? Are there any other devices you can communicate with?

And what about game servers? Can you setup your own multiplayer game server and have Xbox's connect to it and communicate freely? What platform would you write the game server code in? C++ on Unix? How many Xbox units can connect to a server at a time? If you cannot setup your own game server are there unofficial 'hacks' that enable indie developers to develop and run a game server?

Since I'm no Xbox developer (ie. I don't own a $10000 devkit) I cannot use C++ libraries like Zoidcom.

# Answer
**Data transfer over LAN or Internet**

There are two types of online multiplayer games available when you create a networked game with XNA Game Studio:

1. System link game sessions (LAN)
2. LIVE sessions. (Internet)

Session types available:

1. Use System Link for Local Area Network gameplay
2. Sign in to Xbox LIVE and Games for Windows - LIVE Servers
3. Use LIVE to connect to other machines over the Internet while the game is in development

Data transfer between connected Xbox and PC units is implemented using the LocalNetworkGamer class (supported on Xbox 360) and data is written using a PacketWriter as follows:

```
foreach (LocalNetworkGamer gamer in session.LocalGamers)
{
    // Get the tank associated with this player.
    Tank myTank = gamer.Tag as Tank;
    // Write the data.
    packetWriter.Write(myTank.Position);
    packetWriter.Write(myTank.TankRotation);
    packetWriter.Write(myTank.TurretRotation);
    packetWriter.Write(myTank.IsFiring);
    packetWriter.Write(myTank.Health);

    // Send it to everyone.
    gamer.SendData(packetWriter, SendDataOptions.None);

}

```

**Network topologies**

For a system link game, you can use any one of the following hardware configurations to test a networked game:

* *One development computer and one Xbox 360*
(running one instance of the game on the development computer and one on the Xbox 360). The creator needs one Xbox LIVE Silver and one Creators Club membership to run code on the Xbox 360.
* *One development computer and one client computer*
(running one instance of the game on each computer). Creators cannot run two networked XNA Framework games at the same time on the same computer. Creators need a second machine to run a second game instance for testing purposes. No Xbox LIVE memberships or Creators Club memberships are required for this scenario.
* *One development computer and two Xbox 360 consoles*
(running one instance of the game on each Xbox 360). Here a creator deploys and debugs the game on two Xbox 360s. The creator needs at least two Xbox LIVE Silver memberships and two Creators Club memberships (one pair for each Xbox 360) for this scenario.

**Voice transfer over network**

Voice data is automatically transmitted and replayed without any title effort whatsoever. Titles can use this to implement team chat or proximity voice.

The XNA Framework does not expose direct program access to the voice data stream.

* Do they have voice access? - NetworkGamer.HasVoice
* Are they currently talking? - NetworkGamer.IsTalking
* Are they muted? - NetworkGamer.IsMutedByLocalUser
> 10 votes

# Answer
XNA Games on 360 use and are required to use `Live` -- which as I recall means max users per "game" is 32, and you can not connect to any outside services at all.

---

**Update 1:** Form post confirming the 32 player max -- http://forums.create.msdn.com/forums/t/27446.aspx

---

**Update 2:** It should be noted that `XNA on Windows != (XNA on Xbox | XNA on Windows Phone)` that is to say that on Windows, XNA can do anything any other .NET application can do; on Xbox and WP7 XNA is restricted to using the Xbox Live Gaming Services.

MSDN Documentation on Xbox Live and XNA -- http://msdn.microsoft.com/en-us/library/bb975642.aspx
> 4 votes

---
Tags: xna, networking, xbox360
---


title: What AI modding is possible in Civ 5?

text:
# Question
Title: What AI modding is possible in Civ 5?
I'm interested in tinkering with the AI in Civ 5. I know there are XML files that can adjust the AI's strategies, but are there other easily moddable AI components? The XML files contain comments that reference some CPP files, are those available to end users or are those comments just aimed at internals?

# Answer
> 3 votes
The Civ 5 SDK has been released, which should include the source code for the core game library, including all of the AI code (including those files referenced in the XML comments). You should be able to change the AI to any extent you like, even going so far as to rewrite it completely if you so desired. Have fun! :)

**EDIT:** My apologies, but it seems I was a bit premature. It was my understanding that the sources would be included in the SDK as they were for Civ 4. Further inspection of the SDK reveals that those sources are *not* included. I suspect the sources will be made available eventually, and that they were excluded from the initial SDK release in order to get *something* into the hands of anxious mod creators. It's possible that Firaxis reconsidered their SDK strategy and decided not to release the sources at all, but I imagine that would invite quite a backlash from the community. I guess we'll just have to wait and see.

---
Tags: ai, modding
---


# Question
Title: Resolving Diplomatic actions in a RISK-style board game
I'm working on a board game called Farlanthia: Lords of War. And I need some help with resolving diplomacy during play.

My original idea was to have Diplomacy be a form of "attack" like in RISK. This would force another player to perform an action (like a trade, or peace treaty, etc.) The idea is that each "season" you would send a diplomat to court, and politics would play out. Sometimes things go your way, sometimes they don't. This would allow me to use modifier cards (say, you have as prisoner a general from the other player, this would give you +2 in diplomacy with them).

However, as was pointed out on BoardGameGeek this isn't optimal for everyone. So I'm considering adding in a voluntary portion where if both parties agree to the treaty at hand, it goes into place without die rolling.

Thoughts? I'm just not sure how to arbitrate the rules of diplomacy during an otherwise concrete game if the diplomatic actions aren't just as concrete.

Thanks,

(Cross-posted to Board and Card Games)

# Answer
new to the site, so don't know how to "comment" as I've seen done on other questions. Do you have to worry about populace? i.e. How much micro-management does the player engage in during gameplay? In large part, the complexity of the game can influence the amount of control you (as game designer) have over individual aspects of gameplay and consequently, the more strange player-generated outcomes are possible.

My thoughts so far based on what I'm hearing:

* The card idea is good.
* Diplomacy is by nature based on human interaction, so the only random element (in the form of dice, RISK-attack style) would be the populace's reaction to whatever policy was being decided on. As a result, it is not necessary to "force" the other player to react. Instead, you could have a heavy incentive (for instance, the negative effects on public opinion are doubled if the player does nothing). In some situations, this negative penalty could be waived, leading to diplomatic situations which are ignored because the penalty for not acting would be less than the potential trouble involved in acting.
* If you are going for realism in all its complexity, you'll have to post some more info on how gameplay works.

A rule of thumb is: If you are intentionally simplifying things (e.g. soldiers "cancel out", populace mindlessly works) simply take into account how much you are simplifying and try to modify the game mechanics to reflect that simplification. (A good example would be Sid Meier's *Civilization* games. Very simplified representation, but very interdependent as far as game balance, resulting in highly complex gameplay.)
> 3 votes

# Answer
Interesting game. The one thing I would change is the way leadership works. Instead of lowest to highest why not make it the other way around (highest to lowest). The you can use the sum as a sort of currency to do actions. ie. action points. This allows more flexibility than just spending die.

For instance, you roll the 3D6 and get the sum. That represents how many action points (AP) you have that turn. Certain actions then cost AP to perform. For instance, scouting a tile might cost 4AP. The player then removes that from his sum represented by the dice in front of him.

This allows for more actions per turn. Cards to modify this sum (negatively or positively) to provide some added strategy and to supplement the diplomacy.

Personally, I would not want to resolve diplomacy directly with the roll of a die. Free-form diplomacy always works the best (and is the most fun). You could allow people a number of diplomacy options then set the number of AP it costs to propose the action and offer player a chance to "sweeten" the deal. The player being propositioned can then propose a counter-offer which is then accepted or not.

For example, if I roll a 2, 4, 6 on my turn I would have 12 AP to spend. Imagine I really want a 2 season truce with my neighbour (Tommy). So I consult the chart and see that it costs 4 AP to make the proposal. So I remove this from my dice total immediately (2,6 = 8) that is my risk since I dont know if Tommy will agree. I look through the chart to see what I can offer, ie. troops, AP, die, territory, etc. So I make an offer for 6 AP this turn for 2 season truce. He makes a counter offer, which cannot change the term (2 season truce) but can change the incentives. So Tommy offers the 2 turn truce for 6 AP now and 1 die next turn. If I refuse the initial AP is lost. If I accept the agreement goes into effect immediately.

Diplomacy would have to occur earlier in the action list (likely first).

Hope I explained that properly :S Once you get the game finished let me know I can help produce it for you :)

Aaron Field Marshal Games
> 1 votes

---
Tags: game-design
---


# Question
Title: Managing multiple references of the same game entity in different places using IDs
I've seen great questions on similar topics, but none that addressed this particular method:

Given that I have multiple collections of game entities in my \[XNA Game Studio\] game, with many entities belonging to multiple lists, I'm considering ways I could keep track of whenever an entity is destroyed and remove it from the lists it belongs to.

A lot of potential methods seem sloppy/convoluted, but I'm reminded of a way I've seen before in which, instead of having multiple collections of game entities, you have collections of game entity *IDs* instead. These IDs map to game entities via a central "database" (perhaps just a hash table).

So, whenever any bit of code wants to access a game entity's members, it first checks to see if it's even in the database still. If not, it can react accordingly.

Is this a sound approach? It seems that it would eliminate many of the risks/hassles of storing multiple lists, with the tradeoff being the cost of the lookup every time you want to access an object.

# Answer
> 3 votes
> Is this a sound approach? It seems that it would eliminate many of the risks/hassles of storing multiple lists, with the tradeoff being the cost of the lookup every time you want to access an object.

All you've done is move the burden of performing the check from the time of destruction to the time of use. I wouldn't claim I've never done this before, but I don't consider it 'sound'.

I suggest using one of several more robust alternatives. If the number of lists is known, you can get away with simply removing the object from all lists. That is harmless if the object is not in a given list, and you're guaranteed to have removed it correctly.

If the number of lists is unknown or impractical then store back-references to them on the object. The typical implementation of this is the observer pattern, but you can probably achieve a similar effect with delegates, which call back to remove the item from any containing lists when necessary.

Or sometimes you don't really need multiple lists at all. Often you can keep an object in just one list and use dynamic queries to generate other transient collections when you need them. eg. Instead of having a separate list for a character's inventory, you can just pull out all objects where "carried-by" equals the current character. This might sound fairly inefficient, but it's good enough for relational databases and can be optimised by clever indexing.

# Answer
> 2 votes
Short answer: yes.

Long answer: Actually, all games I've seen worked in this way. Hash-table lookup is fast enough; and if you don't care about actual ID values (i.e. they're not used anywhere else) you can use a vector instead of a hash-table. Which is even faster.

As an added bonus, this setup makes it possible to *re-use* your game objects, reducing your memory allocation rate. When a game object is destroyed, instead of "freeing" it, you just clean up its fields, and put in some "object pool". Then, when you need a new object, just take an existing one from the pool. If new objects spawn constantly, this can noticeably improve performance.

# Answer
> 1 votes
This seems to just be a more specific instance of the "how to remove objects from a list, while iterating through it" problem, which is easy to solve (iterating in reverse order is probably the simplest way for a array-style list like C#'s `List`).

If an entity is going to be referenced from multiple places, then **it should be a reference type** anyway. So you don't have to go through a convoluted ID system - a class in C# already provides the necessary indirection.

And finally - why bother "checking the database"? Just give each entity an `IsDead` flag and check that.

# Answer
> 1 votes
I often use this approach in my own C#/.NET game. Aside from the other benefits (and hazards!) described here, it can also help avoid serialization issues.

If you want to leverage the .NET Framework's built-in binary serialization facilities, then using entity IDs can help minimize the size of the object graph that gets written out. By default, .NET's binary formatter will serialize out an entire object graph at the field level. Let's say I want to serialize a `Ship` instance. If `Ship` has an `_owner` field referencing the `Player` who owns it, then that `Player` instance would get serialized out too. If `Player` contains a `_ships` field (of, say, `ICollection<Ship>`), then *all* of the player's ships will also get written out, along with any other objects referenced at the field level (recursively). It's easy to accidentally serialize a huge object graph when you only want serialize one small part of it.

If, instead, I have an `_ownerId` field, then I can use that value to resolve the `Player` reference on demand. My public API can even remain unchanged, with the `Owner` property simply performing the lookup.

While hash-based lookups are generally very fast, the added overhead could become a problem for very large entity sets with frequent lookups. If it becomes a problem for you, you can cache the reference using a field that does not get serialized. For example, you could do something like this:

```
public class Ship
{
    private int _ownerId;
    [NonSerialized] private Lazy<Player> _owner;

    public Player Owner
    {
        get { return _owner.Value; }
    }

    public Ship(Player owner)
    {
        _ownerId = owner.PlayerID;
        EnsureCache();
    }

    private void EnsureCache()
    {
        if (_owner == null)
            _owner = new Lazy<Player>(() => Game.Current.Players[_ownerId]);
    }

    [OnDeserialized]
    private void OnDeserialized(StreamingContext context)
    {
        EnsureCache();
    }
}

```

Of course, this approach can also make serialization *harder* when you actually *want* to serialize out a large object graph. In those cases, you would need devise some sort of 'container' to ensure that all the necessary objects are included.

# Answer
> 0 votes
Another way to handle your cleanup is to invert control and use a Disposable object. You probably have a factor allocating your entities, so pass the factory all lists that it should be added to. The entity keeps a reference to all lists that it is a part of, and implements IDisposable. In the dispose method, it removes itself from all the lists. Now you only have to be concerned with list management in two places: factory (creation) and dispose. Deleting in the object is as simple as entity.Dispose().

The issue of names vs references in C# is really only important for managing components or value types. If you have lists of components that are linked to one entity, using an ID field as a hashmap key can be useful. If you just have lists of entities though, just use lists with a reference. C# references are safe and simple to work with.

To remove or add items from the list, you can use a Queue or any number of other solutions to dealing with adding and deleting from lists.

---
Tags: xna, architecture, entity-system
---


# Question
Title: How do I handle my collision resolution using a delegate scheme?
My physics engine is coming along quite nicely, and I'm ready to start working on some more advanced features. I'm trying to set up my collision engine so that an arbitrary delegate can be notified when a collision occurs.

Say we have object A, object B, and object C in the physics simulation. I want to be able to inform a delegate about a collision between A and B, and also inform a potentially different delegate about a collision between A and C.

I have a known interface for the delegate, I have the potential of storing a state for my collision detector, although I currently do not, and have the ability to store states in the objects, themselves. Similarly, I use this delegate model to handle collision resolution, simply setting the physics engine as the delegate for all objects by default, and allowing the user to change the delegate if desired.

I have already tried having each object store it's own collision delegate, that would be informed when a collision occurred. This didn't work, because when the objects had the same collision delegate, the same collision was handled twice. When I switched to only using the delegate of the first object (however that was decided), the order of simulation became an issue. I want to use a dictionary, but that introduces a significant amount of overhead. However, that seems like the direction I need to be heading.

How do I handle my collision resolution using a delegate scheme?

# Answer
I'm not sure I completely understand your problem, but it seems easy. When your engine is handling a collision, you must have a list of colliding objects. And that list is probably only 2 objects 99% of the time. So, you can simply compare all of the objects' delegates right here. For example: (pseudocode)

```
// When ObjA and ObjB collide
ObjA.OnCollision(ObjA, ObjB);
if(ObjA.OnCollision!=ObjB.OnCollision)
    ObjB.OnCollision(ObjA, ObjB);

```

Order of the simulation shouldn't matter here, because either the delegates are the same anyway, or both will be called.
> 3 votes

# Answer
For my answer I'll assume you are managing lists of objects.

```
list<Object> objects;

```

It sounds to me like you are checking for collision by checking if each object has collided with any other object, for example if you have three objects in the list it would do nine comparisons - if you had four objects (A,B,C,D) you would check for collisions with the following combinations:

```
AB, AC, AD,
BA, BC, BD,
CA, CB, CD
DA, DB, DC

```

This isn't required, you only need to check for collisions that haven't already been compared - in the above algorithm AB *and* BA is being compared, which isn't necessary.

In the case of four objects ABCD you need to check for collisions with the following combinations:

```
AB, AC, AD
BC, BD
CD

```

Pseudocode for the above algorithm:

```
for(objectIterator i=list.begin; i!= list.end; i++)
{
  objectIterator n=i;
  n++;
  for(; n!=list.end; n++)
  {
     // check for collision here between i and n and call the delegate of either.
  }
}

```
> 2 votes

---
Tags: collision-detection
---


title: How do I get XNA Game Studio 4.0?

text:
# Question
Title: How do I get XNA Game Studio 4.0?
I want to get started with XNA game development, and I have bought the Pro edition of Visual Studio 2010 so I have the required software to run XNA Game Studio.

How do I get it? Is it released yet?
Is it a free download on some Microsoft site?
Do I have to pay anything? Where?

**Edit:** Is this it?

# Answer
> 2 votes
I found the whole XNA Game Studio 4.0 as a part of the Windows 7 Phone Devkit

(and here's the ISO download if you need to install it on multiple PCs)

# Answer
> 1 votes
Yep that's the one, just download and install it.

# Answer
> 1 votes
For XNA 4.0 you have two different downloads. One for users in Windows XP that only includes the XNA 4.0 Framework and another for users in Vista/W7 that includes XNA 4.0 and the WP7 Dev Tools. You can get both from here:

http://create.msdn.com/en-us/resources/downloads

In the XNA Game Studio 4.0 section.

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


# Question
Title: 2D game engine for UI - suggestion needed
I am planning on making a simple real-time strategy game from the series Stargate Universe. For those who don't know, in the series' center is a spaceship called Destiny. It has a nice control room, with a control interface, what has a holographic control screen. The game basically would run on this. That's what I want to do, easily.

Can you suggest me ANY free 2D engine, what has: \- A top-view area for combat and ship management

* Many UI elements what can be used easily
* a top-on GUI part, where the actual GUI can be put
* a nice GUI for putting all together (a game development framework or workbench)

And written in:

* C#
* ActionScript (Flash)

It is a bit reverse-like, as at the bottom of the layers would be the UI, over it the buttons, and over them would be the actual playground (battlefields, ship elements, etc).

Can you please help me?

# Answer
> 2 votes
There are already some similar questions to this. I'll just point you to them.

recommend-a-game-engine-with-2d-gui-for-a-ui-intensive-strategy-game

recommended-2d-game-engine-for-prototyping

---
Tags: 2d, gui
---


# Question
Title: How much memory does a texture take up on the GPU?
A large png on disk may only take up a couple megabytes but I imagine that on the gpu the same png is stored in an uncompressed format which takes up much more space. Is this true? If it is true, how much space?

# Answer
JPG and PNG files will almost always be smaller on-disk than in memory; they need to be decompressed on-the-fly to acquire raw RGB data, thus requiring more processing power for the loading and more RAM afterwards. So many modern engines opt to store the same format on disk as they do in memory, leading to files that are the same size as the texture's memory requirements (but also larger than a PNG or JPG). RGB/RGBA and S3TC/DXTn/BCn are the most widely used formats, because they are read straight into memory without any processing (DXT textures are precompressed).

So, these are the sizes for different common texture formats:

* L (luminance, e.g. greyscale): width * height * 1 byte.
* LA (luminance and alpha, common for fonts): width * height * 2 bytes.
* RGB (color, no alpha): width * height * 3 bytes.
* RGBA (color with alpha): width * height * 4 bytes.
* DXT1/BC1 (color, binary alpha): (width * height * 4 bytes) / 8 (8:1 compression ratio).
* DXT3/BC2 (color, sharp alpha)/DXT5/BC3 (color, gradient alpha): (width * height * 4 bytes) / 4 (4:1 compression ratio).

If you use a image with mipmaps, the texture will require 4/3 as much memory. Additionally, the texture width and height may be rounded up internally to be a power of two on old or less capable hardware, and on some very limited hardware, also forced to be a square.

More info on DXT: it's a lossy compression; this means, some color data is lost when compressing the texture. This has a negative impact on your texture, distorting sharp borders and creating "blocks" on gradients; but the benefits are far better than the disadvantages (if you have a texture that looks horribly bad in DXT, just keep it uncompressed; the other ones will make up for the size loss). Also, since the pixels are compressed by fixed-size blocks, the texture width and height must be a multiple of four.
> 19 votes

# Answer
Obviously: **It depends on the format.**

Let's take a 256 by 256 pixel square texture. If it's uncompressed 32-bit with an alpha channel (`Color` in XNA) then it takes **256KB** (`256*256*4` bytes).

16-bit formats (eg: `Bgr565`) will obviously be half the size - **128KB**.

Then you get onto the compressed formats. In XNA you have DXT1, DXT3 and DXT5 (also known as S3 Compression). This is a lossy compression format. It is also a block-based format - which means that you *can* sample from it (because you know which block a pixel is in). It's also faster, because you use less bandwidth.

The compression ratio of DXT1 is 8:1 and for DXT3 and DXT5 is 4:1.

So a DXT1 image of 256x256 is **32KB**. And DXT3 or DXT5 is **64KB**.

And then there's **mipmapping**. If this is enabled, this creates a series of images in graphics memory each half the size of the previous. So for our 256x256 image: 128x128, 64x64, 32x32, 16x16, 8x8, 4x4, 2x2, 1x1. A texture with mipmapping is approximately **133%** the size of the original.
> 10 votes

# Answer
Most GPUs can only read a very specific compression format. eg. BC\*, DXT\*, not formats like png. So yes, it is true for the most part that a .png will take more space in video memory than on disk.

Textures can be stored compressed or uncompressed in both video memory and system memory.

For uncompressed textures, the general rule of thumb is that it will take the same amount of space in video memory as it does in uncompressed form in system memory.

For DXT1 compressed textures. the GPU stores 8 bytes for each 4x4 tile in your texture. The uncompressed data (at 8-bits per RGB channel) would ordinarily be 4x4x3 = 48 bytes, so that's a compression ratio of 6:1. For DXT3/DXT5 compressed textures, the GPU stores 16 bytes for each 4x4 tile in your texture. That's a slightly lower compression ratio of 3:1.

There are some caveats with both uncompressed and compressed textures:

* Most memory is allocated in pages (the size of which varies between GPUs) of a fixed size. eg. 4KB and often that is not sub-allocated and shared with other gpu data. Ie. if your texture footprint is smaller than the page size, the footprint in vid mem will often still be the page size.
* Some gpus have very specific alignment requirements. In the past, some GPUs had the requirement that textures be a power of 2 in size. This was often required to support a swizzled representation (see Morton Ordering: http://en.wikipedia.org/wiki/Z-order\_(curve)) to improve access locality when sampling from the texture. This meant that textures of odd sizes would be padded in order to preserve these requirements (typically this padding is handled by the driver). While morton-order is not necessarily used in modern gpus, there may still be bloating to support the specific requirements of the gpu.
* Multiple representations of your texture may exist in memory at any point in time, especially if you're using discard locks on them. This can bloat your memory usage until representations are no longer used by the gpu (which is typically a few frames behind CPU rendering)
* If you enable mipmapping, the additional mips will consume on average around a third of the base mip level. YMMV based on the above caveats.
> 4 votes

# Answer
AFAIK it's the images width * height * BPP, independent if it's a PNG, JPG or BMP. I don't know how DDS or other compressable formats are layed out.

Mip-mapping will increase the need for video memory to.

My knowledge in this topic may be a little outdated. I've abandoned 3D a while ago.
> 0 votes

---
Tags: xna, textures, gpu
---


# Question
Title: Applications programmer - Where to start?
So far I've done web design/development and applications programming and of course video games has always been one of those things that I've wanted to take a stab at but never tried outside of a few minor and failed incursions. The only notable game programming I can say I have done was a little puzzle-ish game for the NES written in 6502 assembly so that doesn't exactly count for much.

Basically, what would be a good jumping off point for me? I do know C++ and Java if that gets me anywhere.

# Answer
> The only notable game programming I can say I have done was a little puzzle-ish game for the NES written in 6502 assembly so that doesn't exactly count for much.

Don't say so, if you had had to make one game, then you know "how" game programming is different from conventional programming. And i guess, it might be the reason you want to make more. Cheers!! In my opinion nobody was born as a game programmer, everybody started with some application programming language like c, c++ or java.And I feel becoming a game programmer is like getting a promotion from your current designation called programmer. So if you know these languages thoroughly , you can make a great start by first learning the distinctions of a Game versus an Application.

You should read this, it is a really good fundamental guide page. And this is one page i just completely adore.It provides you with the inspiration and tells you to start with what. Best Wishes
> 6 votes

# Answer
It sounds like you're in the same boat that I was in a few years back. I wanted to dabble in game development, but my professional experience was mostly with enterprise/line-of-business applications. I decided to ease my way in by choosing a game of a familiar genre could be built using similar architectural principles to what I was used to.

I ultimately decided on a "simultaneous" turn-based strategy game (similar to *Master or Orion* or *Birth of the Federation*) for the following reasons:

1. TBS games are highly stateful, and there is very little "ambient" processing. Almost all logic executes either in direct response to player commands or as part of the "turn processing" phase following each turn.
2. The synchronous, turn-based nature of the game lends itself well to a client/server system in which all logic/processing takes place on the server, with the changes later pushed back to the clients. There is no real-time interaction between players, so clients can issue orders locally and then transmit those orders in a single batch at the end of a turn. Since the turns are synchronous, the server will not process the turn until all clients have transmitted their orders. It becomes almost trivial to avoid synchronization/currency issues between clients: do all processing on the server and have each client download a new game state at the beginning of each turn.
3. Most network communication occurs at the beginning and end of each turn, with clients downloading the game state and transmitting orders, respectively. There is very little network traffic in between. Thus, there is no need for the kind of high throughput, low latency networking system that realtime games often require. A service-based design built with WCF would be sufficient, and it would also free me from having to do any low-level network programming.
4. My design called for a detailed and highly interactive UI not unlike those required by many enterprise applications. The design was also heavily 2D and was not very demanding in terms of graphics capabilities. I built my client using WPF (then code-named "Avalon"), which enabled me to create a highly stylized UI (something that *looked* like a game) while leveraging a very rich set of controls and APIs for input processing, eventing, and commanding. I followed the same UI architectural patterns that I would use for any other application (MVP or some derivation thereof).
5. Since I would be building the game using the same language and framework that I use for my day job (C#/.NET), the project could double as a sort of "sandbox" for trying out new development tools and frameworks in a "real world" application that was not also a "mission critical" application.

Long story short, my decision worked out very well. I've been working on the project for a few years now (in my spare time), and I'm pretty happy with what I've come up with. Moreover, I learned a ***lot***, and not just about game development--I took every opportunity to get hands-on time with new development tech, and I've become more effective at my day job as a result. A lot of code originally written for my game has evolved and found its way into some of our enterprise applications.

So I guess my advice would be to choose a project relevant to your existing skill set, and then use that project as a vehicle to dive deeper into game development.
> 6 votes

# Answer
Since this is a hobby project, pick something you **want to do**. If you are motivated, it will be easier to pick up the skill you will need.

Beware of projects that require **a lot of art and content**. Things like adventure games etc. consist for a disproportionate amount of artwork and level design. Especially for a developer starting out, these can be the kiss of burn-out death.

Pick something with a **defined scope** and **measurable goals** in between. The sense of accomplishment you get from finishing every little milestone along the way will go a long way in keeping you motivated throughout the project and into the next.

For me, this advice led to re-creating a 3D version of a popular 1980s game. But your interests are different, so you will most likely end up somewhere else.

I would say, think about it for a while and come up with the simplest possible project that you still find compelling. If you need assistance figuring out what technology/platforms to use to make it, just post another question. We love arguing about technology around here ;)
> 1 votes

# Answer
As other told you, my advice is to start from something simple. For example a 2d scroll based game, maybe using pre-done art found with Google Images, or OpenGameArt.org. Use a framework/library. **XNA** for Windows or **SDL** for cross platform development. Look also at **SDL.NET** if you want to do your game in managed **C#**.
> 0 votes

---
Tags: game-design
---


# Question
Title: Mental Image of the engine behind an RTS like SimCity/Settlers, what is it?
Disclaimer: I'm first a programmer and then an RTS gamer. This means I'm a complete and utter newb in terms of patterns, best practices and glossary of technical terms on the game dev world.

Since I was a kid that most of my electric/electronic toys were always taken apart to learn how they were made and most of the pieces were stored for future use.
This gave me a VERY curious mind in terms of: How does it work?

I've started planning/scribbling for more RTS games than the market has dished out, but never got around to implement any of them due to the lack of basic knowledge about Game Devel.

So what I'm asking is that someone could point me in the direction of the engine schematics of an RTS game like SimCity/Civ/Settlers. Something that will assume a bit of programming background but will introduce the terms used for programming a RTS base game.

* How do they do the Unit Manager? Is it called this way?
* Is creating a complex multi threading system wise?
* Should I use multi-threading just for groups of units?

Well, I think you get the picture of how newb I am ;)

Many thanks in advance.

# Answer
> 8 votes
A google search for "rts engine schematics" turns up a few relevant hits.

ORTS:

Stratagus:

These might not necessarily be the best examples of code design (I haven't looked in detail), but by looking at them you should be able to pick up a few ideas - both on how to structure your code and how NOT to structure your code. Lessons on structuring code will also come with more experience.

To answer your questions:

* The name of the logic that manages units is basically irrelevant; there are multiple ways to do this, and often this kind of logic transcends the genre of the game.
* In general, the simpler the multithreading system, the better. If it helps you to reach your target frame-rate on your target platform, then thread your systems.
* Yes, if you're targeting multi-core systems as your min spec. Most modern PCs and consoles will benefit from task-level parallelism, but often that can introduce latencies depending on how granular and dependent your tasks are.

Most RTS game engines will have similar structure to other game engines, both in terms of unit management and multithreading. The difference in engine would be reflected based on the specific differences in the RTS genre versus other genres.

There is too much information to cover here, but here are only a small number of characteristics of an RTS that would reflect the engine and content evolution:

1\] RTS games are played from top-down view. This means a visibility system (occlusion and/or sector/portal) is unlikely to be worthwhile. Artists can spend more time adding detail to the top and sides of objects than the bottom.

2\] RTS games are mostly played from a fixed height. Firstly, this typically means you have a limited range in which action is happening. In other words, a Level of Detail (LOD) system based on distance from camera is also probably not worthwhile. The artists should be able to produce assets that are optimally detailed for the camera height.

3\] Units in RTS games are not controlled directly, but are controlled by sending commands to them. A higher latency between when the command is received and when the unit is executed is more tolerable to the user in an RTS game than in an action game. This is a desirable property because most RTS games operate in a networked environment which often has to handle the inherent latencies of the network.

4\] Often, there are many units of the same type on the screen at the same time. This means that a system for batching/instancing for objects is likely to have benefit.

5\] Often commands are dispatched to groups of many units at the same time. This means that any path-finding, navigation and obstacle avoidance logic, and acceleration data structures can be shared between individual units within the group.

---
Tags: game-design, game-mechanics, rts
---


title: What makes Minecraft so great?

text:
# Question
Title: What makes Minecraft so great?
I believe everybody has heard of Minecraft. It is a deceptively simple game, that was made by a single indie developer, and sold more than 500k copies - despite having no active marketing and being technically a buggy alpha-version.

That is really great success for an indie game. And I think we can all learn much from it. So I want to examine Minecraft's game design: what, in your opinion, makes it so great? What choices work well, how they combine together to make a great game? And what design decision are bad (I don't think *everything* is ideal in Minecraft)

What do you think?

# Answer
The game works well because (in part) it appeals to many different types of play. It allows for exploration, construction, combat, socialization, optimization, and creativity. Its graphics are quite cute, while it often becomes very tense due to the player's fragility.

The game also provides an excellent feeling of accomplishment and increasing power. At the start of the game, the player is quite vulnerable and weak, and nearly every player gets the "huddling in a dirt hut" experience. As the player gets more resources and learns to build a more effective base, she is conquering the world around her. By late-game, the player has mined down to the core of the earth, has an expansive castle network, controls elaborate monster-traps, is wearing clothes made of diamonds, and no longer has quite the same fear of a lone skeleton.
> 23 votes

# Answer
One of the key components to it's virality (and therefore success), is how varied and *personal* the user stories are. There are certain games that you can't just help talk about them when you're in a group. Blizzard games are a perfect example, WoW players and SC2 players will talk about their respective games with other people who care every chance they get. I find that to be very similar to the behavior of people who play minecraft.

Why is that? Judging from the stories I've heard, a lot of it is due to the content creation. People are *proud* of their bases/traps/other emergent gameplay elements. The fact that the game isn't hyper realistic at all leads to some very interesting side effects. And the ease of death (like the point Gregory Weir made), means that the game isn't one of those games where you're just going through the motions to get to the next cutscene or see the next level. Smart players will come up with interesting ideas on how to better survive the world (like placing a chest near the spawn point filled with backup weapons and laying down some construction pointing to their home base, or maybe take advantage of the infinite fire bug of previous versions to have a scorched-earth-style breadcrumb system) and enjoy *sharing* that with other people.
> 15 votes

# Answer
It's full of emergent gameplay!

Empower the player to be able to build and break anything, give them a loose goal (survive the night) and the means to do it any way they see fit, and everyone's experience is different. This is in stark contrast to the majority of games today.

I think it also helps that it can be played in the browser as an applet. You can tell someone about Minecraft, and then show them just by going to minecraft.net and clicking a link, from any computer (with Java installed). Don't underestimate the power of ease of access. I think this is what helped get it started, but now of course everywhere you turn there's an article or a YouTube video about it and it might not be as important any more.
> 11 votes

# Answer
I've think about this every time I play the game.

What bug me is that someone made a open-source clone of the game: Manic Digger. The clone, for some reason, doesn't have the same feel as MineCraft does, and I do not know why.

One of the reasons I think MineCraft is popular even though there's a lot of bugs, is because Markus is very close to his fans/gamers/customers. It gives you the feeling that you know him.

When I create something, even tough it isn't finished, and I show it to my closest friends, they tend to be impressed. They're impressed even though theres a lot much better working projects out here - but because they know me, they think it's more well done.

I think this goes for MineCraft as well. Because we sort of know Markus, we tend to like what he does better.
> 7 votes

# Answer
Also, this:

http://www.penny-arcade.com/comic/2010/9/17/

It's like getting to be on the "staff picks" of the App Store.
> 3 votes

# Answer
It's fun without being a chore to play.

Personally, (and this question is going to be subjective anyway) I find the whole remove-build blocks mechanic to be a compelling reminder of playing with lego when I was a kid, except now the things I make are required to survive the zombie hordes.
> 1 votes

# Answer
People have built things with clay, brick, wood, stone and paint for years. They have loved doing so and often create just for the joy of creating.

To be able to do so online in collaboration with friends is even more awesome.

Add being able to sit in your own house/bed while you do so... I'm there.

Seriously though, A lot of it for me was the potential. This guy is willing to work with developers (enough to provide an API) and intends to Open Source it. If it weren't for those two things and the alpha price, I'd have skipped it.
> 1 votes

---
Tags: game-design
---


# Question
Title: What is the story of game programmers beside gaming history?
Nowadays, game programming is like a big business-ish, technological, academical, programming havoc. There are dozen of engines, free or not, don't-reinvent-the-wheel dos and don't, plenty of different platform, plenty of game genres, and a lot of languages.

The video game economy boomed around the 90's (I guess, with the NES etc), and just before that, I wonder how game programmers were doing their job, what languages they used, what was the equivalent of the current "dev kit", anyways what were those few guys technics and tools to achieve a working game on such tiny computer power ?

I read that the playstation had only 3MB memory total: besides CD-swapping, how could they achieve to build an executable to hold on 2mb or ram, for complex games like Metal Gear Solid or Vagrant Story ?

Since I'm young and I missed all that, I have some questions...

Were game makers only or most programmers ? Why do I think a game programmer who has played a lot, has a more important role that game designers, 3D artists, because they know how a game is really made ? Since C was invented in the 70, did all programmers use it, or were they forced to use ASM to get the best optimisation ? Is being a game programmer a safe job (I mean in the job market) ? Since computers are so freaking fast today, how has the optimisation task changed ? Do we use computer/console power to their maximum, or do we waste it because we can't come up with complex enough gameplay ?

# Answer
> 3 votes
Remember a lot of memory is blown by resources. On the PSX you had much less vertex throughput so models were smaller by default, no shaders so vertex data was smaller, and also the killer resource - textures, were smaller as they were not 32 bits but generally 8 bit palettized. Audio was either streamed from CD or in a mod/midi like format - no MP3 or wav eating memory like there's no tomorrow. On generations before that, there was no textures, and audio was a table of note pitch/note length mostly
As for assembly vs C, yes there was a C compiler for the PSX but it was relatively immature, we recoded our 3d engine in assembly in order to squeeze out performance, and it paid off. I guess it's also a mindset thingy, if you know you code in assembly you keep performance in mind, if you code in C (let alone C++) you might not think about it continuously.

# Answer
> 5 votes
You may find the Tonc Tutorials, which cover the GBA, quite interesting from a hardware history standpoint. I can also highly recommend the iPhone apps 2600 Magic and Dragster Magic for a look back even further toward the dawn of consoles.

I can also recommend Steven Levy's book Hackers: Heroes of the Computer Revolution, which covers a lot of the game industry's formative years.

To address one specific question:

Most computers/consoles, old or new, are not used even close "to their maximum" until they've been around for several years; as the developers get used to them and learn (and sometimes share) tips and tricks, the games come closer to utilizing the "full potential" of the hardware. (However, even on "ancient" systems, it's going to be hard to say if you ever really reach 100% potential -- there are always crafty ways remaining to use these complex systems which may eek out more performance or new behaviors, and I'm sure there are a few centuries worth of computer science advances left in humanity.)

# Answer
> 5 votes
> Were game makers only or most programmers?

In the earliest days of arcade games, and later Atari home systems, Spectrums, and C64's you would often have 1-2 man teams where people all had multiple hats and nearly everyone could program. By the time you hit the NES and later the art requirements for games required people dedicated to that role full time, and audio also had full time individuals who were often shared between multiple concurrent projects. Design was often someones part-time role, and not a dedicated field.

> Old games, how the F&%K did they work?

You look at the power of machines in the past with the ability to compare them to machines today. At the time those things were pretty fast, even if every machine has it's specific weaknesses. 20 years from now people will look back at x360/ps3 and wonder how we dealt with them.

You just learn to deal with the issues, no different than using any other tool.

> Do we use computer/console power to their maximum, or do we waste it because we can't come up with complex enough gameplay?

Actually it's the opposite. The more simple the gameplay the more power you can utilize from the machine. If all you want to do is throw polygons at the screen you can easily optimize that. As games get more complex we start throwing more and more systems together and being able to predict what's going to be on screen at any moment becomes more difficult. So everything has to be more general purpose and thus less efficient.

# Answer
> 4 votes
As far as I know, all Atari 2600 games (released in 1983?) were programmed entirely in assembler. The Atari Jaguar had a compiler, but my understanding is that it never actually worked reliably enough to use.

The Sony PlayStation had a C compiler that worked well, so by that time we were coding in C. (This is when I joined the industry.) This machine had 2M RAM and 1M VRAM. So how did you do it? Well- the first game I shipped on it had a separate executable for each level, with all of the assets baked into the executable itself. After that though we went to a setup that allowed us to stream everything; our levels were 10+ megabytes so we had to come up with some way to bring it in bits at a time. When streaming off of the disc, we streamed in terrain chunks and the textures that went with them. Some modern PSP games on the other hand stream almost everything; area-specific animations for the player, enemies, and whatever else isn't necessary throughout the whole game. I.e. we wouldn't stream the player character because he's needed everywhere.

Remember, the PlayStation was CD-based. CDs could hold 660 megs of stuff, so you could fill memory 300 times over just with what was on one disc. The PSP's 1.8Gb UMD relative to its 24M RAM isn't quite that ridiculous, but still you can put a lot of stuff on the disc, the trick is getting it off at the right time without presenting the user with a "loading" screen.

# Answer
> 2 votes
You may find this interesting: Llamasoft History

It's all about how Jeff Minter (Yak) got into both programming and game development, which led him to start Llamasoft in the early 80s.

# Answer
> 2 votes
I know the question is already answered but there is a great book by Steven L. Kent called The Ultimate History of Video Games it actually starts off with coin-operated games like pinball and works into the video games beginnings. I would recommend you check it out if you are looking to read about the history of games.

It really gets into details about how certain things were done and Mr. Kent interviewed a lot of people involved in the industry from the past and present.

---
Tags: game-design, c
---


# Question
Title: What type of dashboard should I create to understand how my game is performing?
This is a two part question. Let's say I release a new Flash game to the web. Once players start playing I want to understand how it is performing:

1. What common performance criteria do people track? (e.g. viral coefficient, play length, returning players.)
2. How should I go about measuring and monitoring these attributes? Are there any off the shelf tools?

# Answer
> 3 votes
In my opinion the best is to store the information from the application in a mysql database (google analytics is too limited), and if you want to handle things really professional, then you should translate the mysql data to a vertica database and conect it with tableau which is an excelent tool that allows doing tons of analysis, graphs, anything you need for BI. Regarding what to measure, well there are mainly the following things:

-Churn rates are familiar to anyone who has analyzed a subscription-based business like cable television or phones: the churn rate is the percentage of customers who will stop using the product in a given month

-The viral coefficient is in some ways the opposite of the churn rate: it’s average organic growth rate in users in a given month.

-user aquisitions:new registered users

-ARPU: average money earned by users

-DAU: daily active users

-Engagement: We are going to measure it by taking the amount of time the user plays each day (dough there are other things that can be taken in account such as the amount of features the user access)

-MAU: monthly active users

-DAU/MAU: Comparing Daily Active Users to Monthly Active Users shows roughly how many days per month your average user engages with your game

# Answer
> 6 votes
If you don't mind providing your data to Google, then Google Analytics is a great tool for that too. Rather than tracking classical *page-visits* (which you could use for different Game-screens), you can use the Event-Tracking feature to track/gather all sorts of data.

Implementation in Flash should be trivial. Either use the ExternalInterface to invoke JS from Flash, or use the tracking-classes provided by Google.

Using *ExternalInterface* has the advantage, that you decouple your game from the actual tracking implementation. So you basically just send *messages* from inside Flash to a JavaScript callback. There you would invoke the actual tracking, be it Google Analytics or any other tracking mechanism. That makes it easy to swap/modify/remove the tracking at some other time without recompiling the Game.

The advantage of tracking directly from flash is that your tracking will also work if somebody hosts the Game on a different website, without the necessary JS wrapper code.

So I guess both ways of tracking are valid options to consider. The easiest route would probably be Google Analytics in combination with the ActionScript tracking implementation provided by Google.

# Answer
> 4 votes
For the flash game I made recently I needed to track the play of every level, since balancing of each level was very important.

It was as simple as creating a static class that holds all the info I need to collect and then do a URLRequest (POST) to a PHP script that receives the info and posts it to a MySQL database.

What I tracked was specialization data, current level, where in the level the player was (used to track deaths), abilities used and their values (heals / damage etc)

# Answer
> 1 votes
If you want to track online time, there are two pitfalls:

* Some people might play with multiple accounts at the same time but you most likely only want to track them ones.
* It is important to tell bots and real users apart. Linden Lab used a nice trick for that: They split the users into four groups based on the amount of online time per week. And then count the number of players per group. The groups could be:
    + 0 hours to 7 hours
    + 7 hours to 14 hours (two hours per day)
    + 14 hours to 35 hours (five hours per day)
    + more 35 hours

There is another measurement that I consider really important: How may minutes stay new players online? In the early days of Stendhal only 20% of players stayed online more than 5 minutes. We put a lot of work into the first few seconds of the new player experience and got it up to 50%. (Which I consider really good for a game people have not payed for).

---
Tags: flash, analytics
---


# Question
Title: Can you download the XNA Connect app in US so I can deploy to Xbox 360?
I've got an XNA Creators Club trial membership via DreamSpark, but I cannot download the XNA Game Studio Connect app due to a bug in the site. Users from Finland and US experienced this before and MS fixed something in the Marketplace configuration that enabled them to download this. You need this app to deploy apps to Xbox 360 during development.

Can someone with a Creators Club account please download this app for me and upload it someplace?

I'm legal since my account on App Hub shows Registered, Student, and Premium Member.

# Answer
> 2 votes
I only see a button to download to my Xbox 360. When I clicked it, it said it was added to my "queue", and I guess it will magically show up on my Xbox? But there is nothing I saw to download...

Here is a screenshot of the page I see: (notice the "Download to Xbox 360" button in the bottom right)

---

Edit: I found the queue. And it is as I suspected. My Xbox hasn't recognized the download yet, but I think I already have the XNA Game Studio Connect app on my Xbox, so I'm not sure if it will ever (re-)download.

# Answer
> 2 votes
According to the XNA team's blog today (Fri Nov 5) the connect application will be updated to accept XNA4.0 deployments. I'm guessing you are seeing transients related to the upgrade process.

If I were you I would try again later today, once the new connect app has been fielded in all markets.

---
Tags: xna, xbox360, pc
---


title: Online board game engines

text:
# Question
Title: Online board game engines
I would like to create an online implementation of a board game. What engines could I use to write the game and make it easily accessible to as many people as possible?

I would like it to be as widely accessible as possible, so it would be best if the user interface would run in a browser, not in a separately downloaded app. Likewise, it should be cross platform, not limited to a single platform; pure JavaScript/HTML would be best, as that would allow it to be usable on the iPad as well, though Flash or Java may be acceptable. Silverlight doesn't have the market penetration (I don't have it installed, for instance) and XNA is far too limited.

Other features that would be nice would be good chat and social features (or integration with other chat or social network systems), leaderderboard or tournament systems, and easy integration of bots to provide AI opponents in case there aren't enough human players around. Game timers, to keep people moving at a reasonable rate, would also be good. Saving game records, and allowing people to replay and review records for study, would be nice too, though I'm not expecting much as those types of features tend to only show up in purpose-built engines for games like chess or Go.

Being free/open-source software would be a big plus, so I could extend it myself, though closed or hosted solutions might be acceptable if they provide enough of the above features or provide some means for extending them.

Are there any such systems that meet my needs? Or any that are close even if not exactly matching?

Some similar systems, that don't quite meet my needs, would include:

* Yahoo Games, which is web based, but I can't write my own games for it (or any of many similar servers in that category).
* Volity, which is built on SVG and XMPP. It's open source, designed to be an open standard, has support for bots, etc, but it requires a separate client download, and seems not to be actively developed or used any more.
* SuperDuperGames, which is an open source, online system for doing turn-based (play-by-mail style) games. That is, it's not live or real time, but instead you submit your moves, and wait for someone to submit theirs, within the next day or so. It's an active community, but I want something where I can play games live, not over the course of weeks or months.

# Answer
I sincerely doubt that such a game engine exists. A.I. for example, is very domain specific and you probably won't find an engine that provides the A.I. you need out of the box.

Also: The interest in JavaScript by game-developers just started to increase with HTML5 and the iOS platform. Don't expect to find any mature game-engines implemented in JavaScript yet. If you want to go the JavaScript route, your best bet would probably be to implement most of the game-logic server-side and program a thin-client in JavaScript.

As already mentioned, online-games also require a client-server model in most cases. This makes it even more difficult to find an engine (one that covers both client and server software). My experience with game-engines is, that they usually cover the client-side very well but you'll have to implement most of the server-side stuff yourself. Of course you'll find software/scripts for leaderboards or online data-storage but these are usually not part of a game-engine.
> 2 votes

# Answer
Vassal is an open-source Java engine, I believe. Might not be too difficult to port to JS/HTML5.

Aves is put out by Dextrose, but that just got acquired by Zynga, so I don't know any availability for it.
> 2 votes

# Answer
I have developed and sponsored (the flash game version of selling) an online board game which I made in 5 days. It is called Quintarow Online.

My method was to use the development tool called Multimedia Fusion 2 which allows you to very speedily prototype game ideas. A working engine of Quintarow Online was developed in about three hours. The software has an extension which implements the quite wonderful Lacewing Networking Protocol and the server was something I custom wrote in Python using the Lacewing-Python implementation\[pyLacewing. It was all a very painless experience.

That's just how I did it, you might find getting the software too expensive, or it doesnt
> 1 votes

---
Tags: javascript, online, social
---


title: How to Make A Fast Graphics Engine?

text:
# Question
Title: How to Make A Fast Graphics Engine?
**Assuming I were to develop a graphics engine for a modern PC game that used only DirectX or OpenGL, which techniques could I use to make sure it ran quickly?**

Edit:

I'm looking for any approaches that I could take that would result in a speed increase.

By *graphics engine* I mean general purpose graphics engine - such as the one used in Unity or Ogre3D.

# Answer
> 4 votes
That question is quite the rabbit hole, as stated in another answer don't just make an engine. That's your first mistake you're generalizing something that is inherently specific, performance is all about specifics you have to write code tailored to a specific platform to run a specific type of game.

These optimizing tend to go as low level as possible, writing custom memory allocators, optimizing cache use, making good use of parallelism, having good algorithms, etc. and like I said a lot of these topics are a big rabbit hole full of "black magic", that will take months to learn much less master.

Unless you have a concrete game idea and a platform you will dedicate yourself to for a while, just don't bother you'll be better of with good enough performance and more time on the actual important thing, a good game. Besides hardware is always getting faster so speed won't be an issue for long anyway.

# Answer
> 3 votes
Use an existing engine.

There is no "general purpose" in gaming.

---
Tags: opengl, directx, graphics-programming
---


title: Ways to earn money through Flash games

text:
# Question
Title: Ways to earn money through Flash games
If you like developing flash games just for fun, why not make money through them? There are different ways you can monetize your flash game:

* **In Game Ads:** Some common examples:
* You can make money by **helping online gaming companies test and evaluate new games**. Many of those companies are seeking feedback and reviews of their newest games.
* **Find a sponsor and license your game.** One of the quickest yet hardest ways to make money from the flash games you create is to find a website who is willing to sponsor them. With a single sponsorship, an individual can make anywhere from $1000-$7000 for a game.

What are the best ads from these sites?

If the game will be in social websites like Facebook and MySpace, will it still be useful to try other sites?

Are there any other ways to earn money from a Flash game?

# Answer
> 5 votes
To answer question 3, check this out: http://flashgamelicense.com/

This site hosts developers and sponsors. Developers submit a tender for offers from sponsors and sponsors in turn bid on your game. At the end of bidding, you choose the offer that best matches your desired terms (cash vs. terms of offer). Sponsors typically then get a license to use your game on their advertising website.

The author of Steambirds used this model pretty effectively, and describes his experiences with the process here: http://www.andymoore.ca/2010/03/steambirds-by-the-numbers/

# Answer
> 4 votes
Here's two methods not yet discussed:

Microtransactions! These are the cheap extras that people can buy from within a game. These can be extra weapons, more maps or even just the other half of the game itself (treating the free offering as a demo version). There are three 'big' companies that make this easy for developers. Mochi's Coins make it very easy, but they take 40% and that is *before* 'costs'. FlashGameLicense do GamerSafe which has the same 40/60 split between them and the developer, *but* they have far, far less branding than Mochi. Mochi also forces the player to go to their site to buy Coins. Better, however, than both of these is Jambool's Social Gold which comes straight out of the Facebook microtransaction goldrush. There is no branding, users can buy your virtual currency straight in your game and you keep 90% of the profits. I'd use Social Gold if I were you. A few other notes, Sponsors hate microtransactions, so unless you have an awesome game, don't expect to get a good sponsorship while microtransactions are within your game. I think microtransactions work at their best when there is a multiplayer, or at least social, aspect to the game.

Self-publishing is a risky move, but it can pay off in the long term. This is where you host your games yourself. You are basically running a portal and revenue comes not just from in-game ads but from the ads scattered round the design of the site. Not a particularly *nice* option because you may have to spend a year or two just building an audience and having people return to your arcade daily. It's a massively competitive market too. On top of all that, administering that website really is a full time job and you'll probably do less game development as a result.

---
Tags: flash, monetization, facebook, free-to-play
---


# Question
Title: How to make the button rollover by a keyboardEvent
I'm designing a game calculator . My problem is how to link between the keyboard event and the button. \**When I click no.2 button on my Keyboard the button doesn't roolover . I want the exact button roolover wen I use the keyboard .

## Note

every button have it's instance name ex: the button of number one : one\_mc

my code is

```
switch (event.keyCode)
    {
    case 97 :
     res[1].appendText("1");
    break;
    case 98 :
     res[1].appendText("2");
    break;
    case 99 :
     res[1].appendText("3");
    break;
    case 100 :
     res[1].appendText("4");
    break;
    case 101 :
     res[1].appendText("5");
    break;
    case 102 :
     res[1].appendText("6");
    break;
    case 103 :
     res[1].appendText("7");
    break;
    case 104 :
     res[1].appendText("8");
    break;
    case 105 :
     res[1].appendText("9");
    break;
    case 96 :
     res[1].appendText("0");
    break;
    case 8 :
      res[1].replaceText(res[1].text.length-1,res[1].text.length,'');
    break;
    }

```

# Answer
Don't use Buttons, use MovieClip instances (different states on different frames) instead. That gives some more work to do since you'll have to switch states manually, but gives more flexibility.

Here's an example with 3 different states (normal, hover, click): http://pastie.org/1276725

As you can see, it has public methods to trigger all states. The mouse-events are triggered automatically, but you can use these public methods to change states externally (eg. from keyboard input).
> 3 votes

# Answer
Well, the keyboard doesn't exactly have a "rollover" since it's not a mouse. But you can use the keydown event to change the image to the rollover image, and the keyup event to change it back to the normal image. Then put your code (which you pasted in the question) into either keyup or keypress. This should make the behavior you're looking for.

By the way, what happens when you press backspace before entering any numbers? I suspect a JavaScript error will occur; look at your `case 8`.
> 1 votes

# Answer
Depending on the language, you could do this:

```
switch (Event.keyCode)
{
  case (int)'0':
    myButton0.click();
    res[1].appendText("0");
  break;
  ...
}

```

It's hard to answer specifics if you don't provide a language.

---

\[Edit\]

I don't know anything about `actions script3` sorry. Some languages allow you to set the depressed button status.

```
myButton.setDepressed = true;
wait(100);
myButton.setDepressed = false;

```
> -1 votes

---
Tags: game-design, flash, flex
---


# Question
Title: Usage of standardized syntaxes in gaming: yea or nay?
**TL;DR:** Using CSS as an element in defining rulesets in Civ-style turn-based strategy games: Madness or just plain old insanity?

**Real question:**

Designing ruleset parse rules is a pain. Every single game out there seems to define its own ruleset for how rulesets are to be parsed (insofar as the game features customizable rulesets, of course).

Is it time for the game dev. community to embrace standardized synatxes for rulesets?

Is CSS a viable option for customizable games?

**Example:** Consider a Civ-like with customizable rulesets; how nice would it not be to be able to design rulesets as follows:

```
artillery:era(modern) {
  range: 2;
  sprite: url(/isophex/artillery.png);
}

artillery:era(classical) {
  range: 1;
  sprite: url(/isophex/cannon.png);
}

```

# Answer
> 7 votes
I agree with Michael Stum's suggestion to keep with XML, to avoid writing your own CSS-like parser. If you can find an existing CSS parsing library that's cool, but otherwise, KISS.

Here's how your example might look in XML:

```
<artillery era="modern">
    <range>2</range>
    <sprite>/isophex/artillery.png</sprite>
</artillery>

<artillery era="classical">
    <range>1</range>
    <sprite>/isophex/cannon.png</sprite>
</artillery>

```

Not too different, eh? And with one of the many XML parsing libraries out there, I guarantee it'll be a piece of cake to load such a file.

# Answer
> 4 votes
Personally, I would also use XML for rulesets or other config-files.

There are some other alternatives like YAML or JSON though. These are usually smaller in file-size than XML files (if that's a concern) and there are robust parsers out there to read these files. Their syntax is also closer to CSS if that's important to you :-)

# Answer
> 3 votes
What you're proposing isn't a standard syntax. It *looks like* a standard syntax, but it's not really CSS, and the CSS model doesn't fit what you're trying to do. The syntax is good at selecting structures, but not describing them.

Screw XML. It's verbose, noisy, annoying to parse, lots of tricky edge cases, and for all its claims of validation, no one really does that. I suggest YAML. It's a standard data description format, with parsing libraries available for any practical programming language.

So here's what your code would look like in YAML - first as a bare untyped variant, then with optional type tags for people who are too pedantic to actually get work done.

```
artillery:
    modern:
        range: 2
        sprite: /isophex/artillery.png
    classical:
        range: 1
        sprite: /isophex/cannon.png

--
artillery:
    !Era modern: !Artillery
        range: 2
        sprite: !URI /isophex/artillery.png
    !Era classical: !Artillery
        range: 1
        sprite: !URI /isophex/cannon.png

```

The second format sucks. In practice, you don't really care if someone puts an !Era or a !Period or just a plain untyped dictionary there, as long as it has the keys you want - range and sprite. It's analogous to duck typing in programming languages, and it makes things a lot more readable. If it doesn't have the keys you want, it's easy to detect that at load-time even without a schema. Which is great, because you need the code anyway, so why repeat yourself? (It also means as long as the application knows how to resolve URIs, you don't run the risk of someone accidentally calling them URLs and failing to validate for stupid reasons, as you've already done.)

If you really need to have a parsable description of the data files - like, you want to automatically generate property sheets for editors and for some reason doing it in the same codebase as your engine is not acceptable - you can use something like Kwalify schemas.

# Answer
> 2 votes
As I understand your proposal, you are speaking about creating an external Domain Specific Language (DSL) for your game rules, that adheres to a precise and standard syntax.

From my experience in building DSLs for game rulesets and my reading of Martin Fowler's recent book on DSLs, I gather that two main parts are required to build something like your idea :

* A Semantic model (or Business model) for what your DSL represents. If you do OOP that would be a class to hold the units with attributes like era, range, strength, etc. (Yet OOP is not compulsory)
* A Parser to populate that model from text files that use your chosen syntax.

I think that the larger effort is actually in building the model and not the parser, but choosing a standard syntax will make the parser much faster and easier to build. Moreover if the syntax is simple and/or known to the people who write the rules it will be that much easier for them to do that.

So yes, by all means build a rich business model for your rulesets and then write them using a standard syntax. XML is indeed very often used in that capacity in games and elsewhere, but it's generally thought to be too verbose and is increasingly replaced with leaner formats such as Json or Yaml (and why not CSS).

Hope that helps put your idea in a different light.

# Answer
> 2 votes
Your language looks like CSS, but it isn't. It's your own Domain Specific Language.

Ask yourself this: Do you really want to create your own file format, for which you need to write a parser. This parser needs to be fast and robust. You also need to document your file format and teach people how it works - after all, it's a customized language. You then need to be aware that you may run into issues you never thought of - maybe someone thought it's a great idea to create a 50 MB file and your parser crashes, corrupting a savegame or so. Or you decide you need to add a feature that can only be implemented with a breaking syntax change, thus breaking all the existing files.

The reason why formats like XML are so popular is because XML has these problems solved. You can find many great XML parsers that are proven to be robust, fast and leak-free. Also, many people know XML files and how to edit them, and because it's such a generic but well defined syntax you can be sure that you can extend later.

Your motivation seems to be easy editing by hand, which is common in community SDKs. Now, the reason people edit those files by hand is that they don't have the tools the Game Devs use. You can assume that a company developing a game for several years has some graphical tools for editing such files - they may not be great and bugfree, but they edit the files for you and developers only rarely edit them by hand in order to tweak something. Those tools are rarely released in 'Modding SDKs', so most modders edit by hand.

So my initial reaction would be: Instead of spending time developing a new, unproven format that is easy to edit by hand, I'd rather use a battle-proven format and spend the time writing tools that make editing easy.

But blanket statements don't work like that. It always depends. If you spend 3 or more years writing a big game with a sizable dev team, then you can spend a lot of time developing, testing and finetuning your system. If you have 15000 files to parse, then finding ways to reduce memory usage becomes important.

But for small/medium/indie games, I'd go with a known and well-supported format like XML and a nice tool to edit it.

# Answer
> 1 votes
I'm not sure that is really CSS syntax, so this is more of "$selector { $rules; }" format than CSS itself. My gut reaction is that the "cascading" part of CSS would end up being overly complicated to work with and it would end up looking too much like code at that point.

---
Tags: game-design, configuration
---