title: How is load balancing achieved in MMOs?

text:
# Question
Title: How is load balancing achieved in MMOs?
I believe it's a common requirement of MMOs that processing for a single shard or realm can be done over several servers to ease the load. I'm curious as to how this can be done whilst maintaining a unified consistent world where all the players, and all the NPCs can interact.

**My question is how is load balancing achieved in MMOs?**

Any links, books or general information on how to improve my knowledge on this subject is also appreciated.

# Answer
Try to keep this **as simple as possible** and interfaces well defined and documented. Maintaining and debugging a complex system in production easily turns into hell. So if there is a simple and a complex approach, think twice before you go with the complex one.

## Defining Services

I think the first step is to **identify services and their dependencies**: Static Content, Authentication, Local Chat, Global Chat Channels, Regional Chat Channels, Friend's List, Guilds, Bag/Inventory, Auction House, Global Map, World, ...

Then for each of these services decided if the **client** may talk to them directly. For example it is pretty easy to let the client talk directly with the servers responsible for Global Chat Channels. The world servers don't have to be involved in chat messages at all. Regional Chat can be implemented in the same way, but the world servers have to tell the chat servers when players change regions. Again, they don't have to care about the messages.

The third step is to think about **load balancing within a service**. For example global and regional chat channels can be split across multiple servers based on their name. It is probably a good idea to not hard code this split into the client, but provide a lookup service.

## World Servers

The most difficult part are usually the **world servers**, so I am starting with a simple approach. It is probably a good idea to let the client talk directly to the server responsible for the region he is in. So on login or region crossing the client has to be told to which server to connect to.

The simple approach is to split the world into **independent regions**. With independent regions I mean that a player cannot look from one part into another and monsters cannot cross parts. Those regions are different from the regions player see based on the landscape and story of the outside world. Usually most monsters are in dungeons and players tend to accept that they have to walk through a gateway to enter a dungeon. Especially if those dungeons are instantiated on a per player group basis. Other examples on the outside world are different continents and valleys enclosed by high mountains.

A **continuous world** approach gets complex really quickly, so it makes sense to plan it well: What information does the client need? Which information do the servers have to share? The player will mostly interact only with the objects (including monsters and NPCs) in the same region. You can cheat by placing objects out of click range from the zone border. This means that the client is mostly interested in read only information for neighboring zones. For these cases the zone servers don't have to coordinate anything except for the permission check that the player is close enough to connect to a neighboring zone.

This leaves only a **very small number of difficult cases** in which objects or actions have to cross a server border. Which is a good thing because those cases such as arrows and spells are performance critical. It may be a good idea to split combat into attacking and defending. So the server of a spell-caster will define the attack parameters including the position of the caster. The server of the defender will get the message about the attack and calculate the impact. The server of the attacker does not need to know about the impact; the client will learn about it using his read only connection.

Depending on how complex your player model is, it may take a couple of seconds to transfer it to another server (Second Life has a huge problem with this). The issue can be mitigated by **preparing the transfer** in advance when the player gets close to a virtual border. So that most of the player data is already cached on the destination server when the actual handover happens.

## Summary

Divide the problem by defining different services that can be split across servers with little dependences. As next step look at how to do load balance within the critical services. Delegate balancing work to the client by instructing it to connect directly to the relevant servers (obviously the servers have to check permissions). Keep it as simple as possible, document the responsibilities of the various services and servers well, provide the option to enable debug output.

PS: Some of these techniques can be used to improve reliability. And you should keep that in mind because using many servers implies a much higher risk of things breaking; not only in the software but also at the hardware level.
> 33 votes

# Answer
Generally the world is divided up into a number of smaller regions. Each of these regions is usually an independent server process (WoW's world servers or Eve's Sol nodes) and can run on any of a number of machines. In some games there are explicit doors between maps (Eve, STO, Guild Wars) while others try to mask this more (WAR, Free Realms). Those that opt for the more seamless approach generally will detect when you are nearing the border between two servers and the two process negotiate a handoff. The best place to probably look for a description of this is in how cell towers do handoffs of moving handsets. If the load of a single map (Jita, Ironforge, Earth Space Dock) gets really big, you can sometimes offload individual functions to other servers (AI, certain parts of player management) but this either has to be built-in from the start or would take some serious retrofitting. It is almost always more cost effective to just buy better hardware to dedicate to those few maps.
> 10 votes

# Answer
> I believe it's a common requirement of MMOs that processing for a single shard or realm can be done over several servers to ease the load. I'm curious as to how this can be done whilst maintaining a unified consistent world where all the players, and all the NPCs can interact.

It's probably not as common as you think; at least, not if you're thinking that one seamless world is managed by several servers simultaneously.

Not counting totally separate shards, there are 2 directions in which you can split up an online game, which could be considered "horizontal" and "vertical":

* Divide the game up into many separate geographical areas. All the functionality for any given geographical area is handled by one server and there is no real interaction between them. (Note that there isn't necessarily just 1 zone per server - a server might handle several zones simultaneously, and zones can perhaps be transferred between servers to handle changing load.)
* Divide the game up into several types of service - eg. login/authorisation, gameplay rules and physics, chat+auctions, persistence, etc. Each of these services can be handled by a different server. nhnb's answer has enumerated other potential services that a developer can partition their game into.

Obviously these approaches are orthogonal and you can combine the two. In fact it's almost mandatory to have a separate database server, very common to push off login/auth onto a separate machine from the gameplay, and increasingly common to farm off chat and other non-critical communications as well, no matter how your game world is divided up.

But on the whole, when there is geographical partitioning, most games avoid letting you interact across those boundaries, because it's difficult to do well. Instead, they resort to other ways of making it *seem* like you're all still in the same shard and on the same server, when actually you're not. eg. \- loading screens or other animations that cover up a server change when transitioning between zones, or from one continent to another. \- separate dungeon or raid instances that are isolated from everybody else. These are like a shard within a shard and can easily be run on a separate server, helping the load balancing.

I can't speak with authority on WoW but I would guess they're doing almost all of the above: instancing, separate geographical areas that can't interact joined by portals of some sort, separate back end and auth servers. I've heard that WoW realms have something between 1000 and 10000 players online in a given realm at once, which is easily manageable with the above schemes.

But, let's assume you have a single massive world and that you do need to allow players one one server to interact with players on an adjacent server. This is easy to do in theory - first, servers must cooperate to share details of objects along the borders (so an object on one server may have a proxy representation on another), and then simply change all your logic to message-passing, with messages being routed from a proxy back to the authoritative source where necessary. Messages can be passed between servers or within a server fairly transparently so one approach fits all systems.

The problem here is that previously simple logic can become very complex when translated to messages - eg. a 2 player trade which can happen safely and atomically when both players are on one server becomes a longer process when messages have to be sent back and forth, reverified on each send, and safeguards put in place to ensure that one player can't exploit the other by changing the trade while a message is travelling. You can't even assume the other player will still exist by the time the message arrives (as they might die, log out, etc), so the code becomes very complex. And this will apply to almost any system where 2 or more entities can interact or cooperate - trade, combat, grouping, auctions, loot-sharing, training, etc.

These problems aren't insurmountable but for most games they're too difficult to be worth attempting when you can share the load via the other means and keep all your game logic on one server. So almost all current games go down that route instead.
> 9 votes

# Answer
There is many methods of load balancing an MMO server, since there is quite a wide range of data to be processed. I prefer the process bin tree method.

A global server passes user connections to a process bin that can handle several users at once. the process bins do all the complex processing and only respond to the global server with data that is globally relevant such as global chat and positioning. This method balances much better than region servers, since regions can vary greatly in population, while overall user processing is varied enough that it should naturally balance itself for the most part.

Just do some basic load balancing via the global server so when a process bin reaches a certain memory/cpu usage, you startup a new process bin server.
> 3 votes

---
Tags: mmo, synchronization, scalability
---


# Question
Title: What are the technical reasons that make it difficult for a game to be maximized in windowed mode?
I am curious as to why most games do not have a mode in which you can easily move your cursor outside the game window to another monitor for example? World of Warcraft maximized window does this really well. Does anyone have any insight on why this would be difficult and/or not worth it for most games to implement?

# Answer
Developer priorities. It's more work to support than a simple windowed/fullscreen toggle, the latter of which is more or less built into DirectX/OpenGL and most windowing systems.

There are subtle bugs that you end up finding when you implement it, like on some OSs the mouse pointer position is reported incorrectly, offset by the height of where the title bar would be if it existed. It also requires more in-game interface, since you need the window close and minimize (or at least de-maximize) buttons built into the game's UI.

Many commodity graphics engines do not support it, because it's only useful for some games. That kind of behavior isn't desired in an FPS, for example.

None of this is insurmountable, or even "a lot of work", but it's a measurable amount of developer time to design/implement/test. A simple window/fullscreen toggle in the graphical options is not.
> 7 votes

# Answer
It's not so much a technical issue as a gameplay issue. Namely, if you try to click on something at the edge of the screen but move the mouse too far you might click outside the game instead, making the game lose focus or possibly even get covered up by a window that *was* partially behind it. It's particularly troublesome for first-person view games.
> 2 votes

---
Tags: windows, screen
---


# Question
Title: Really simple video games, how to design games for the non-gamer market?
With the boom of mobile and social games reaching more and more people and new technologies like the wii, kinect and geolocation hardware and gadgets appealing to a bigger market than the hardcore gamer, the indie game development has a new challenge: **create simple games.**

This might seem easier, but I think its really way harder. **Game developers are usually fans** of RPGs, FPSs, massively **complicated games** with complicated goals, mechanics and stories. That is not what the usual casual player is looking for, and getting into the mind of a unknown market is really hard.

**So, how to design games for the casual, non gamer market?**

I know its a very broad question, but I would love to know how people **design, playtest and deliver** this sort of games.

A very big point for me is that somethings while trying this exercise of designing simple games **I get a feeling that it is TOO simple** or even non challenging when it might be complicated and challenging enough for that market.

# Answer
> 8 votes
I find that most non-gamers want a game that is simple to learn, and immediately rewarding.

For starters, that means that you should be able to explain you game in about 30 seconds, or 1-2 screenshots. If the player can't figure out the core mechanics on the first couple of attempts they'll probably think it's too complicated, **even if it makes it more fun once they *do* figure it**. They want to know how to play right away.

You mention that developers like RPGs, games that are often very complicated. Some RPGs have levelling systems that are games unto themselves! Just trying to figure out the best way to upgrade your characters is very involved(which can be fun), something casual players won't bother with. Make your game simple to figure out, **show the player how fun it is before they ever play the game.** It might be fun to develop your character in an RPG, but it's hard to show a player that with a handful of screenshots or in a game review. One the other hand, when you look at a Tetris or Pac-man screenshot, you can probably tell right away what is fun about the game.

The other thing is immediately rewarding. The game should reward for playing the game well both visually and gameplay-wise. If the player beats a level, they should get something like a powerup or a special bonus level. In addition, there should be cool sound effects and visuals that tell them they succeeded. A simple "High Score" page isn't good enough. In addition, the player should be able to get to the "fun part" very quickly. Again, take a modern RPG, you might have to spend a few minutes setting up your character, choosing a class and creating an avatar before ever getting to the "real" game.

One must not underestimate the importance of presentation. If the game *looks* fun, the player will have more fun. A nice graphical theme can go a long way.

A good example is the iphone game "Flight Control"

If you haven't played the game before, looking at that screenshot you can probably figure it out. Use your finger to draw a path for the planes to follow. Avoid plane crashes. Very simple, and the graphics clearly and pleasantly show what's going on. Red circles show imminent crashes, to avoid guesswork and make it even simpler to understand.

# Answer
> 5 votes
I'm going to concentrate on the 'casual vs hard-core' aspects of your question.

There are several schools of thought on how to design games in general. The 'compulsion-based' one models 'fun' around *compulsions*.

You can think about compulsions like 'mini-goals' that our brains have. When these goals are satisfied, the brain pleasure centers get activated.

They are not the same for every one, but they tend to be equal per demographic group.

The 'hard-core' games you mention tend to favor one 2 specific types of compulsion:

* The *empowering* compulsion, in which you get a system that is gradually better (the player levelling up, getting new weapons, etc)
* The *mastery* compulsion, which creates fun by allowing the player to gradually be better at handling a complex system (statistics, etc)

The empowering compulsion has a tendency to be stronger on males than females. The mastery compulsion usually appeals more to engineers (hence, also males in general).

The 'casual' games focus on a different set of compulsions. Pet society, for example, relies on the 'accumulation' compulsion. Although I get a certain degree of pleasure by accumulating stuff (achievements in games), my girlfriend gets hooked on that pulsion much more than me.

The Wii games tend to favor the social compulsion - relate with others while gaming.

You feel that these games are too simple because you are very used to getting your pleasure from the mastery or empowering compulsions, and these games provide very little on that front.

Another aspect is the 'cute' factor. I would not call it a compulsion, but a necessary design decision. The vast majority of people will like your game if it's 'cute', or will not mind. On the other hand, if you make a game 'serious looking' then a great percentage of people (nearly all casual gamers) will not feel appalled by it. And that's why nearly all casual games tend to play on the 'cute' card.

EDIT1: pulsions are called "compulsions" in proper English.

EDIT2: This article in Gamasutra explains compulsions much better than me.

# Answer
> 2 votes
"Easy to learn, hard to master"

Useful search phrase, brought back this: http://www.gamasutra.com/view/feature/3977/persuasive\_games\_familiarity\_.php

# Answer
> 1 votes
I would play some of those games, and try to get addicted to them. I guess there's no shame to be addicted to Mafia War, Ravenwood Fair, Plants vs. Zombies and some of those Flash games for a while :P (even though I am too a hardcore gamer).

Like designing hardcore games, I believe that casual/'non-gamer' games revolve around presenting challenges. However, those games usually focus on one challenge and slowly scale it up, instead of pushing all of it to the gamer. Then you ask "What is the simplest form of this challenge?" and set it as the first level. After that, you think, "How complex can this challenge be?" and do additional levels.

Second, it is the theme. Most of the time hardcore games deal with themes not accessible by non-gamers, such as fantasy, science-fic, military (which is, however, very accessible to male) and etc. It is possible to take a game, give it another theme, and it appeals to the casual market. There's a game on the iPhone now where you collect candies (or something) and it looks a lot like Sonic. Just a change of theme, and it could be a casual game.

---
Tags: game-design, casual-games
---


# Question
Title: How do you create your levels containing curved slopes in Box2d?
I have just started developing games for iPhone in Cocos2d and am currently working on a Box2D prototype. I know this is not an easy start, but I have experience in the AS3 port of the physics engine. And ... I am stubborn.

**My question is:** How do you implement and create your levels in the project. Is there a good parser out there or maybe a nice approach you guys know of? I am looking for a way to create curved slopes and of course circles and rectangles.

I have read about LevelSVG but it seems to add a lot of functionality that I don't want. I am a Flash game developer and I am used to writing the game logic by myself. Is this product worth the money if all you need is the parser?

Thanks

# Answer
> 3 votes
You could port the Box2D SVG parser implementation from the Box2D forums (you said that you have experience with AS3) .

http://www.box2d.org/forum/viewtopic.php?f=8&t=3073

It doesn't look bloated to me.

---
Tags: iphone, box2d, level-design, cocos2d, cocos2d-iphone
---


# Question
Title: Independent game developer career advice
I recently left my full-time job for an independent game development career. So far things are going well: I've created two games for the iPhone (one has been in the app store for a month or so and the other has been in review for about a week). I'm working on a third game now. Each time the game development life cycle is shorter while the product quality is higher. However I am not yet making a living from my games.

My savings can support me for another year. Here's my general plan:

1. make a few more games
2. in 8-9 months look for a job in the game industry (if my games are not paying the bills yet)

**How would you proceed in this situation?**

Perhaps you would look for a game dev job immediately. Or you would move somewhere with a lower cost of living hence maximizing your time to work independently. Or something else.

# Answer
iPhone development is a bit of a minefield for indie development. Unless you can catch a ride on the hype train, your game is unlikely to get anywhere; there is just too much competition. My advice would be; focus on making a few great games rather than a bunch of decent ones, and talk about your games as much as possible. Send emails to TechCrunch, Engadget, Kotaku...anyone you can think of that might enjoy the game enough to write an article. If you can get your game featured on a major blog you will do well.
> 9 votes

# Answer
Financial planning is outside the scope of this site, and there isn't really enough information to help you with that side of things. That question is something you're going to have to answer yourself.

And on top of that, I would say that in order to really answer that question you would have to provide links to your games so we can look at them and see what you're doing wrong (read: provide constructive criticism).

If you reword your question to be more game specific, i.e. "my iPhone games aren't generating enough revenue to support myself, how can I fix this", *then* it becomes a more interesting problem.

With that question in mind, my suggestion (not knowing what you've done already) would be to specifically target the games you're creating for the "freemium" model. Specifically, free to play with in-app purchases. That paradigm seems to get a significantly higher ROI than the traditional up-front purchase way. You'll probably get more conversions through IAP since free games get easily 100x more downloads than a paid game, even at a .99 price point.
> 10 votes

# Answer
* Advertise. If your game is good enough, then maybe you just need to let more people know that it exists.
* Port your games to other platforms. That increases your potential market with a disproportionately low increase in effort.
* Cross-sell. Make sure that players of one of your games are aware of your other games and become repeat customers.
* Change your monetization methods. If you're currently just getting money from purchases, consider moving to a freemium model.
> 3 votes

# Answer
Consider doing less games but increasing the quality/fun/challenge of it so it will become successful. You need to bring an amazing concept on the table in order to pierce the market. If you just do a quick spin off of another game, that's not good enough.

I agree with Tetrad. Put the link of your games so we could help you in a better way.

Cheers,

Raistx
> 1 votes

# Answer
If you really want to look for a job in the games industry, think about what you want to focus on.

If you code, what aspect of coding?

AI? Do a nice, AI heavy game Graphics? Do a game showing off as many different techniques as you can do/know.

Put all of these in a nice online portfolio as well.

I would also advise you to learn C++ as well if you don't know it. Seeing as Iphone games use Objective C I'm sure it wont be too much of a problem for yourself.
> 1 votes

---
Tags: career
---


# Question
Title: Is there any performance benefit to sharing shaders between programs?
OpenGL allows you to share the same shader between multiple programs. Aside from saving small amounts of memory and a shader handle, are there any GPU-side performance benefits to doing this?

# Answer
> 3 votes
I doubt there is a GPU-side performance benefit.

When you bind a generic shader to a program for example, an efficient implementation should be able to remove unused attributes between that shader and the other shaders in that program and possibly even simplify the shader logic as a result. Of course, this is no real benefit over a hand-tuned shader combination, but it does help manage the complexity/combinatorics, and possibly reduce the number of compiles the driver has to do.

However, there may be drawbacks to doing this in terms of hitting inefficient driver-compiler implementations. And there are some out there, check: http://aras-p.info/blog/2010/09/29/glsl-optimizer/ for just some simple things that some implementations can get wrong.

---
Tags: opengl, graphics-programming, performance
---


# Question
Title: Where to hire graphic designers for mobile games?
I need to find someone talented to create a series of 2D graphics a la cart for my mobile games. My graphics are just not impressive enough, but the game play is solid and fun.

This is sort of a multi-part question:

Where do I start to find someone?

What should I expect to pay for custom sprites and backgrounds?

What kinds of terms should I use so I receive exclusive, royalty-free, ownership of the artwork when it's finished?

# Answer
There are a number of websites around that have places for posting career and freelance opportunities. The most awesome places I know of for Pixel Art are Way of the Pixel and the Spriter's Resource. For any other art, I'd check out Conceptart.org or DeviantArt to find other artists.

This amount will vary based on what you negotiate with your artist and what you are looking for, I couldn't reasonably give you any sort of potential figure without knowing what you are going for. And even then, its highly subject to all kinds of other things.

You need to negotiate a transfer of rights between the artist and yourself. In general, getting a professional artist to sign over rights raises the cost but its necessary to get said rights to reproduce the work. (You could face some serious consequences if you do not)
> 4 votes

# Answer
In addition to Pixelation, mentioned above, there's PixelJoint, home to numerous professional pixel and low-spec artists for hire. You can post job listings in the forum, and you should be able to discuss and negotiate pay on an individual basis. You can get an idea of the skills of various artists by browsing the gallery.

As for pricing, individual sprites and basic animations will tend to run you $50–$100 apiece, while backgrounds are typically more costly. It really depends on the style you want to go for, but I think high-quality low-spec art is generally more time-consuming (since it is so detail-oriented) and hence costlier than other forms of game art.

Edit: Here's a great article all about the business side of pixel art: when and where to use it, what to expect from it, and how much it costs. All of the art in the article is by Fool, one of the most (if not the very most) highly skilled and respected pixel artists around.
> 2 votes

# Answer
One place that is always worth posting is something like the Gamedev Help Wanted forum. It gets a large amount of interest from artists and programmers.

As for terms (basing this off mostly common-sense), you would want to purchase the ownership rather than license the art. Just make sure you nail that point with your artist.
> 2 votes

---
Tags: graphics, graphics-design
---


title: (RPGs) Drop table design

text:
# Question
Title: (RPGs) Drop table design
I guess this question pertains more to games like MMO and Diablo-like games.

What are the usual designs for implementing a drop table, where a monster could drop different type of items depending on a percentage? I guess the simplest way there is to have a dictionary of 'percentage weightage' to item types, but this is hard to extend if we wish to introduce new item types (for example, when D2 expansion includes runes and new class items)

# Answer
> 24 votes
For a roguelike I was working on, I implemented a pretty flexible data-driven system for generating drops. I've documented it here. It's essentially a little DSL for selecting a number of randomly chosen items.

A simple drop looks like:

```
1-10 copper coin

```

It just says to drop a random number of copper coins between 1 and 10. Things get more flexible when you add branches:

```
one of
    turquoise stone (50%)
    onyx stone (25%)
    malachite stone (15%)
    jade stone (10%)

```

A "one of" selects one of its child branches based on the given probabilities and then evaluates that. Drops can drop more than one item:

```
any of
    turquoise stone (50%)
    onyx stone (25%)
    malachite stone (15%)
    jade stone (10%)

```

This will evaluate *all* subbranches and drop them if a roll against their probability passes. There are also some other branches for selecting an item based on dungeon and player level.

Because these can get complex, it also allows you to define named macros, essentially functions that expand a branch expression and can be reused in multiple drops. That way if, for example, all dwarves drop the same kind of loot, you can make a single macro for that and use it across all of those monster types instead of copying and pasting huge drop tables.

An example of one monster's drop:

```
:: ancient dragon
    glyph   = D
    groups  = dragon
    drops
        (coins)
        2-3(1:8) one of
            (any-weapon)
            (any-armor)

```

Here, `(coins)`, `(any-weapon)`, and `(any-armor)` are all macro calls:

```
(any-armor)
    one of
        (shield)
        (helm)
        (boots)
        (gloves)
        (cloak)
        (robe)
        (soft-armor)
        (hard-armor)

```

which in turn calls things like:

```
(cloak)
    one near level
        cloak (10)
        velvet cloak (20)
        fur-lined cloak (50)

```

You can nest drop expressions arbitrarily deeply like a real programming language. This gives you the composability that a simple table-based approach won't give.

Like all data-driven systems, you can overwhelm yourself by building impenetrably complex drops, but it meets my goals:

1. Be able to specify what things are dropped completely outside of code.
2. Simple to implement the core system in code.
3. Be able to tune what specific monsters drop so that the player can do goal-oriented exploration. ("I need a necklace. I'll look for dwarves since they tend to drop them.")

The C# code that implements this is here.

# Answer
> 13 votes
In Stendhal our loot tables are lists. Each entry contains the name of the item, a min and max quantity and the probability. The internal structure is very similar to what we display on the creature's webpage.

It is important for us that game designers who have a great knowledge of the world can define such things. That is, without understanding complex logic at the program code level. So we don't have the definitions of creatures and items in the program code but moved them to .xml files such as elves.xml or club.xml. We do have a gui editor for them, but most game designers modify the .xml file directly.

In order to make creatures and items easily extendable, we use a building block system: There is no program class for "elf" or "archer elf". But there are a number of behavior related classes such as "coward", "patrol", "aggressive", "archer", "healer". Designers can define new creatures be selecting those behaviors without writing program code: For example to create an "archer elf" draw an elf sprite with a bow and define it as "offensive", "archer". Then define level and similar attributes and add some elvish items to the loot table.

For items we have a similar approach, but it is currently limited to one behavior: A designer can add a new item and define a behavior such as "ConsumableItem", "KeyItem" or "AttackItem", "Spell", "Scroll" without having to program logic.

# Answer
> 9 votes
In D&D tabletop gaming there is a concept of loot types. Most monsters will drop from one or more of the tables and these tables would be what you would update in your expansion. The monsters would still drop "65% common, 10% gems, 15% art, 10% tools" but you'd update what was in each of these tables.

e.g. Gems contains slots with random ranges that return "1 gem(25%)2 gems(50%)5 gems(75%)100 gems". and when you want to add special rune gems, update the table to "1 gem(25%)2 gems(50%)5 gems(75%)100 gems(95%)1 runegem".

But, on the other hand, if you've already got percentage weighting, why not just update all the monster tables in your expansion? Surely tables like this are small payload compared to textures and meshes. Also you don't need to keep the percentages tallying up to 100 either, that's just an assumption you made to start with and you can tally up the real total before generating your random value. If the weightings add to up 120, then just generate a value from 1-120 instead of 1-100.

# Answer
> 4 votes
On the surface this seems the same as the "weighted random selection" problem.

Algorithm for determining random events

Allocate relative probabilities to each event, add them up, then pick a random number within that range to decide which event you want.

Even if you prefer to use percentages - which is the same system, just scaled to 100 - you're overestimating how hard it is to add stuff. If you have 100% and then add 20% in an expansion, just divide all the values by (120/100) and you're back down to a total of 100%.

---
Tags: game-design, rpg
---


# Question
Title: Is there a gold standard for touch controls in scrolling shoot-em-ups?
Is there currently a "standard" for touch controls in shooters on platforms such as iPhone or Android? I've noticed that many of them enable auto-fire by default, or control the character via direct touch on the sprite, but don't know if this is something that is emerging as a standard or not.

I've also seen virtual joystick and button solutions, but this seems so wonky.

# Answer
> 3 votes
(I'm assuming you're talking about vertical shooters a la 1942).

The gold standard seems to be what cave did in do-don-pachi resurrection: http://www.youtube.com/watch?v=lm9cOiydk3w

Basically all movement is relative and basic firing is automatic. Special firing (i.e. bombs) is done by a touch button off the side of the screen somewhere (do don pachi had different configurations where you could put it vertically on the left or right or on the bottom from the left or right). Relative movement means that if you drag left X pixels on the screen, your ship moves left X pixels. Or maybe X * some constant pixels.

Some games have some success with sprite-based control, but you have to make sure that the actual sprite is pretty far above where the actual touch control is so you can easily see your ship. If you do it do don pachi style you kind of get that effect if you start your relative movement on the ship itself, but you get the benefit of being able to touch as far away from the ship as you're comfortable with.

---
Tags: game-design, input, touch, shoot-em-up
---


# Question
Title: Lua as a stand-alone for game programming like Python?
I've used Python before with PyGame to make games, but PyGame doesn't seem to be so popular anymore, and there arent that many good resources for it. I hear lots of buzz about Lua as a fast scripting language to be used inside of projects made in other languages.

I work much faster and enjoy the higher-level programming that is Python, so that naturally leads me to Lua, which seems to be getting a lot of attention recently. I know it's been around for a while but I think WoW add-on creation made it more popular..

Can Lua make games on its own as a stand-alone language with any 2D or 3D libraries, or is that not really the Lua domain?

I won't bother asking about 3D in Python here, I'll make a new question for that. Thanks!

# Answer
If you're interested in developing games using Lua, I'd highly recommend checking out LÖVE which is a framework for making 2D games in Lua. Checkout their wiki for lot of resources to get you started. :)
> 14 votes

# Answer
for 3D try shiva
> 1 votes

---
Tags: software-engineering, lua
---


# Question
Title: Sketchup for modelling, Blender for lightmaps, rendering in Xna Reach profile?
This question moved from https://stackoverflow.com/questions/4319183/sketchup-for-modelling-blender-for-lightmaps-rendering-in-xna-reach-profile

Hello. I'm a programmer looking to add some 3D assets to my game. I have played around with both Blender and Sketchup, and for my limited 3D modelling experience I'm finding I can make far more interesting models/scenes in Sketchup than blender, but I couldn't find any free lightmap baking tools for sketchup, whereas my understanding is that this is available in blender for free.

So, my question is, how can I setup a workflow whereby I can do most if not all of my work in Sketchup, and only use Blender to create the lightmaps? Is there any way to define light information in Sketchup, but have blender render the light-maps? Otherwise I'm going to have to do all the modeling in sketchup and then add the lights manually in blender every time I make a change to the scene.

Also, I couldn't find information specifically about blender and the dual texture effect in Xna Reach. Does anyone have information/tutorial/etc.. for getting lightmaps calculated with blender into Xna and rendered using the dual texture effect in xna reach (i.e. on windows phone 7).

# Answer
I imagine you could possibly bake some shadows/lights with plugin, like LightUp in Sketchup, but I haven't tried yet.

Although SketchUp is pretty easy to pickup, it easily makes complicated meshes. Since there are no 'Polygon' tools in Sketchup, there are a lot ways to accidentally add to many additions to the mesh which aren't needed...basically I don't consider Sketchup a good tool for lowpoly/realtime 3D.

I would suggest getting the hang of Blender if you're planning to do more real time 3D in the future. You've got a lot of tools and you've even got a GameEngine inside Blender so you can preview a mesh in realtime, check for potential problems with RigidBody collisions, etc.

I found an old, but comprehensive article on creating lightmaps in Blender.

I must admit, Blender is a bit intimidating first, but as a developer, it's a lot easier to pickup and makes more sense than others.

If you still need a minimal/easy to use Editor, try Wings3D It's very basic, but powerful. Unfortunately, it wouldn't help with lightmaps...but you could easily export an OBJ or something from Wings3D and render your lightmaps from Blender. It should a lot easier, cleaner than importing a Collada from Sketchup.

I know that you mentioned Blender and Sketchup, but on Windows, you might also find **gile\[s\]** as a good option:

HTH
> 3 votes

# Answer
Or wings3d for modeling characters and objects, sketchup for scenery/buildings, Blender for anything else , Giles for Lightmaps. (hey, is freeware now)

Yep, get the hang of Blender.

Tip: Put a tiny box in Sketchup where a light source should be, then can do shift + s, 'move cursor to selected'(selecting the box),then "move selected to cursor", selecting previously the light, with every light in Blender, if you are more comfortable so. If named well or other tricks, you might delete later all boxes in a snap. (maybe putting in a layer which you dont render)
> 0 votes

---
Tags: xna, blender, windows-phone-7
---


# Question
Title: How do you transform a vector to use another objects orientation?
I want to take a vector that is using world coordinates and position it using the orientation of an object. So, if the direction of the object is the z-axis, and the vector is (0,0,1), then the orientated vector would point in the direction of the object. I want to vector to remain in the world coordinate system. All I have for the object is it's up and direction vector. So, I can build a matrix with those by crossing them to create the third axis. Multiplying the vector by this matrix transform the vector into the object coordinate system (right?). But, I want the vector in world coordinate system. Should I use the matrix to find euler angles and then use those angles to create a rotation matrix?

# Answer
> 3 votes
Multiplying the vector by the matrix should give you the vectors orientation in world space. If this isn't the case then it could be that you are building the transformation matrix incorrectly.

# Answer
> 4 votes
In addition to what CiscolPPhone said, make sure that you are crossing properly. `Dir X Up != Up X Dir`. To get the third vector properly, you must first know the handedness of the co-ordinate system. Is it right handed, then it should be `Up X Dir` and for left handed it should be `Dir X Up`.

---
Tags: mathematics, graphics-programming, vector
---


# Question
Title: Where to find designers for independent projects?
Let's say I'm a programmer, I know some artists, we've got a game engine and fun prototype done, and we're ready to enter the indie equivalent of "production".

But the game is full of "programmer design" (and/or "artist design"). We've got a core design concept, but average level design, average AI patterns, average writing, poor balance here and there.

Other questions have covered how to help independent developers find programmers and artists. Where can independent artists and programmers find *designers*? People who can refine and extend the design elements of the game until they really stand out.

# Answer
> 5 votes
http://forums.indiegamer.com is a great forum for finding help. There's a "Help Wanted" section but they allow only paid offers.

# Answer
> 3 votes
The ModDB & IndieDB forums have a Recruiting & Resumes section where you can look for designers, artists, and programmers alike. ModDB and IndieDB have the added benefit of allowing you to create a showcase page for your project, where you can attract fans and potential team members.

# Answer
> 2 votes
ModDB and IndieDB also have an official jobs board which is free to post on.

---
Tags: game-design, project-management, assets, human-resources
---


# Question
Title: Designing the Update system (read very basic game engine) for an XNA game
I am trying to determine the best way to implement the "update" system or engine for a simple XNA game.

## **Description of situation**

I have a few classes, lets call them:

1. Player \[will be an array/list/collection of 1-4 local players\]
2. Enemy \[will consist of all enemy characters in the given "zone"\]
3. Future \[not implemented, may not be implemented for this game, but may be needed in future\]
4. Future

I'm trying to decide what the best way to manage this will be, I'm going back and forth between a couple options.

## **First Approach**

In the `Update()` method of my game, write code like this:

```
void Update(GameTime gameTime)
{
    var ctlInput = GetControllerInput();
    for(int i = 0; i < 4; i++)
    {
        if(Player[i] != null) { Player[i].Update(gameTime, ctlInput); }
    }

    for(int i = 0; i < Enemy.Count; i++)
    {
        Enemy[i].Update(gameTime, Player);
    }
}

```

In this version, I would add "FrameStatus" fields to the Player class, which would look like `bool IsShooting` and `Vector2 TargetedLocation` etc. This also means that each class would be responsible for knowing how to update itself in the game world.

In my eyes, the advantages of this approach are:

1. No new classes.
2. Classes become self-documenting
3. Easy to extend and add additional properties

but the disadvantages are:

1. Order of code in Game.Update is very important
2. Tight coupling of Player and Enemy classes

## **Second Approach**

Implement a type of UpdateManager class, which accepts the user input, and it alone updates the Player and Enemy classes. This would relegate the Player and Enemy classes to simply dumb-data classes, and they wouldn't necessarily have any game logic in them at all.

```
void Update(GameTime gameTime)
{
    var ctlInput = GetcontrollerInput();
    updateManager.Update(gameTime, ctlInput);
}

```

The advantages of this approach, in my eyes, are:

1. Keeps code away from Game.Update()
2. Doesn't require Player and Enemy classes to know about each other at all

Disadvantages as I see it:

* Adds a new class to my game
* The new class, will have a lot of code as time goes on and more types of objects enter the game world

## **Actual Question**

Of the pro/cons I've come up with for my two approaches,

* do you think I've missed any, what are they?
* which makes you lean for or against an approach, why?

Which approach would you take, and also why would you go that route? Would you elect for a third option? What would that option look like?

# Answer
Well there are a couple of assumptions about your first approach that I don't think are entirely accurate.

1) Enemy and Player being tightly coupled.

Why is that, specifically? Could an event system solve some of the coupling issues? Could intermediary classes (i.e. your world/level/whatever container class) handle some of the logic? I mean, sure, if you want your enemies to start behavior X if the player is shooting then the easiest thing to do is just query the player directly, but there are ways around that. There are lots and lots of articles/papers/books on how to decouple classes, so I won't go into too much detail here.

That being said, I don't necessarily think coupling is something to be avoided at all costs. If your *design* is coupled, then having a few coupled classes here and there isn't going to hurt too much. Doing things like having delegates just to avoid having your class "know about" another class to call a function doesn't really help much except compile times.

2) The order of things in Update is very important

This is a similar assumption as the coupling. I've worked with games in the past where my code looked a lot like what you had in your first code. I've also started working with Unity recently where *everything* is a game object, the code you write is all components on those game objects, and the order of updates for everything in the world is non-deterministic. It's entirely possible to write code where order doesn't matter that much, although to be fair Unity does provide a LateUpdate pool for things that need to happen after everything else. This is mainly used for things like moving the camera after the player moves to make sure everything doesn't feel jittery, but in the general case I really don't care which update method is called first.

For both of those assumptions I think you could ask specific questions on "how do I decouple these two classes given this situation" and get some answers. I can't just give you a blanket "here do this" answer.

If you remove those assumptions I think you'll find the first option looks a lot more lucrative.

---

Definitely stay away from option 2 though. That just feels like a blob class if you try to shove everything in some kind of global "world manager". Some data-driven-design people might come to its defense, but object-oriented-design people hate it. I've personally never done it that way but I can imagine it getting pretty out of hand with any amount of complexity if you go into it without proper structure and delegation of responsibilities in one way or another.
> 6 votes

# Answer
I definitely would *not* take the second approach. You can make the first approach a little less tightly coupled by doing this:

```
void Update(GameTime gameTime)
{
    var ctlInput = GetControllerInput();
    foreach (var updateable in Updateables) {
        updateable.Update(gameTime, ctlInput);
    }
}

```

Here, `Updateables` is a collection of objects that implement this:

```
interface IUpdateable
{
    void Update(GameTime gameTime, ControllerInput ctlInput);
}

```

Then have `Player` and `Enemy` both implement that interface. This way, your game loop isn't bound to updating certain things in a specific order and isn't coupled directly to your game entity classes.
> 6 votes

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


# Question
Title: How do I find rotation in 3D based on a vector/normal?
I've been playing with Blender and Python, doing basic things like accessing vertices/normals,etc.

I can get the normal of each face of a mesh. I was wondering, how can I get the rotation of a face based on it's normal ? Can I 'decompose' the normal's rotation into rotation x,y,z ? If so how ?

I remember 3dsmax had something that allowed you to easily place objects on another object's faces/surface. Haven't seen that in Blender, might be handy.

# Answer
> 9 votes
There are a few things to consider here. The first is that a face is not necessarily rotated just because its normal is not aligned with an axis. The second is that you can't obtain Euler angles (x,y,z rotations) from just a normal. You would need to know at least 2 non collinear vectors to do that as you need three perpendicular vectors (a basis in R3) to derive them.

However, I believe you are asking how to find the angles needed to rotate an axis vector so that it is collinear with the normal. This is possible to do with just a normal, and only requires two rotations. You can pick which two axises to rotate from as it doesn't really matter, but for an example I will use rotation about the +Z axis (pointing up) and the +X axis (pointing right).

First we have the normal N = (Xn,Yn,Zn). The best way to think about it is to project the vector onto two of the 2D planes made by the basis vectors. In this case it would be the YZ plane and XY plane. In the YZ plane, the X coordinate of the normal essentially disappears and we are left with a 2D trig problem. Similarly in the XY plane, the Z coordinate of the normal disappears. Just solve for the angle between the axis vector you will be rotating and the projected normal vector.

Be careful of the domains of the inverse trig functions, they do not cover all 360 degrees of rotations uniquely. Also, if the normal is on one of the planes (XY, YZ, XZ) make sure you use that plane in your calculations. Otherwise you will get two angles of 0 which is not useful.

The second part is done by changing the basis for the new object from the basis of the original object to one that has its origin at the point on the face where you clicked, one of the basis vectors as the normal of that face (or a normalized version if the normal is not of length 1), and two other perpendicular vectors. Note that if you wanted to, you could do the calculations from the first part to determine the angle between the up axis in the original basis and the normal, then rotate all three axises of the original basis by those angles to obtain the basis for the new object.

This can also be done using matrix math and would avoid the calculation of trig function values.

---
Tags: mathematics, blender, vector, geometry
---


# Question
Title: What do I need to change in Box2D to work in pixels?
Box2D seems to be set up in such a way that you cannot work in pixels (i.e. physics scale = 1). It produces very strange results as it hits maximum speed limits at low speeds and looks very strange. It only seems to work well at a physics scale of around 15 or 30. For me, working in pixels is the logical way to handle physics and movement in a game, as you are already using that measurement for lots of other things. I don't want to have postionX/30 all over my code, so what variables do I need to hack in the box2d source in order to make physics scale 1 work as if it was physics scale 30? I'm using the latest version from box2dflash.org.

# Answer
I would advice against changing it, for a couple of reasons:

1) It might not be a trivial task; it's been a while since I last used Box2D, but I don't think it has changed much regarding that.

2) Using pixels can lead to very (I mean, VERY) large numbers, and to some computation errors.

Instead of having posX/30 all over your code, as you said, ¿why not try something like a static method *ToPixelUnits* (or whatever), which returns the pixels, so that you can use it when displaying things on the screen?
> 5 votes

# Answer
I have implemented a ratio variable on items/entities/objects. So whenever you need to update the sprite position for an "item" you use the ratio to determine the visual position in pixels. Then you don´t need to convert the units in box2d.

```
private function updateSpritePosition() : void
{
    _sprite.x = _body.GetPosition().x * _ratio;
    _sprite.y = _body.GetPosition().y * _ratio;
}

```
> 1 votes

# Answer
You can try what Gaston suggested or design a very simple class that takes care of the conversion implicitly\** when you pass in the position values from Box2D (the class can also have overloaded operators to make the conversion even simpler). All your 'pixels' can then inherit from this class (or use it directly if they are not doing anything special). This will make your code look less cluttered as compared to function calls and also more scalable.

> \** by implicit I mean you will have to perform the conversion manually and in such a way that when a function such as `SetPosition()` is called, it performs the conversion which is then transparent to the client who is using the new 'pixel box 2D object'
> 0 votes

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


# Question
Title: When constructing an orientation matrix, are the rows of the matrix the axis?
When constructing an orientation matrix, are the rows of the matrix the axis?

The matrix is row-major and I'm multiplying vectors on the right (Mv). So, the matrix looks like

```
r0c0 r0c1 r0c2
r1c0 r1c1 r1c2
r2c0 r2c1 r2c2

```

# Answer
> 9 votes
From a mathematical point of view, it depends on in which order you are multiplying the vectors with the matrix.

* Using a row-vector (`v`) and multiplying it with a matrix (`A`) as `v∙A`, then the rows will act as the axes.
* Using a column-vector (`v`) and multiplying a matrix (`A`) with it as `A∙v`, then the columns will act as the axes.

# Answer
> 2 votes
That depends, if it is in row major form then yes, for column major form no.

Where does this matrix come from?

---
Tags: mathematics, graphics-programming, matrix
---


# Question
Title: Is it worth it to use Bullet for 2D physics instead of Box2D for the sake of learning Bullet?
There isn't much more to the question. I'm not concerned about overhead, as I'm sure they are both fine for my purposes. Basically, I am familiar with Box2D concepts because of the Farseer Physics Engine, but I want to use Bullet when I make the jump to 3D stuff. Perhaps Bullet has some educational value for me even in the 2D realm?

The generalized version of the question is: should I use a 3D physics engine for a 2D game if I plan to utilize a 3D physics engine in the future? Or is this a waste of time which would not provide educational value?

# Answer
Why not treat them separately?

You have a 2D game; use the right engine/tools to make that game the best it can be.

You want to mess around with a 3D engine to learn it; then mess around with it, make some simple 3D games or apps, but keep that separate from the other game you're working on.
> 6 votes

# Answer
My generally feeling is always that learning to use something in the wrong context is not a valuable exercise.
> 17 votes

---
Tags: c++, physics, box2d, bullet-physics
---


# Question
Title: What Game Development books should my partner/myself read?
My partner and I are starting to get into game development on the iPhone. I'm a programmer and he's not. We are looking for some good **language agnostic** game programming books. Hopefully things that will explain basic game development principles without focusing too much on the particulars of a language and more on the concepts needed to build and design games.

We will probably focus on 2D games (at the beginning anyways) so no need for books on in depth 3D math, complex AI, etc.

Any suggestions?

# Answer
For game DESIGN, I highly recommend Jesse Schell: link text

Hope that helps!

\[EDIT\] Stupid StackExchange... I had more links for you, but I need higher rep before I can link them. I'll try to put them in as comments...
> 4 votes

# Answer
While a couple of the chapters are grossly outdated (the book was written in 1982), The Art of Computer Game Design has some great ideas and principles.

http://library.vancouver.wsu.edu/art-computer-game-design
> 2 votes

# Answer
Keep in mind the differences between game **development** (the all-inclusive process of making a game), game **programming** (writing the code that makes a game happen), and game **design** (designing the game: plot, characters, mechanics, etc.). You seem to be using them interchangeably.

But it appears you are looking for iPhone Game development/programming, not game design. The major book at the moment appears to be Beginning iPhone Games Development.

There is also iPhone Game Development: Developing 2D & 3D games in Objective-C which has a wide range of reviews, good and bad; I'd give it a second thought before purchasing.

The problem is, if you're looking into iPhone development, Objective-C is your only language option as far as I know, and development for the iPhone is considerably different than PC development. I think in this case you'd do best to try one of these two books, rather than starting with a PC game development book.
> 1 votes

# Answer
Just my $0.02, but you should always start with the fundamentals - FUN. Raph Koster's "A Theory of Fun" is a great read. Here's a review: http://www.runawaycreations.com/home/2010/11/21/book-review-a-theory-of-fun-for-game-design.html
> 1 votes

# Answer
Must read: Steve Swink - Game Feel
> 0 votes

---
Tags: iphone, books
---


# Question
Title: What programming language was Super Mario Bros. written in?
Super Mario Bros. is definitely the most famous videogame created yet, selling a scorching 40.23 million copies. http://en.wikipedia.org/wiki/List\_of\_best-selling\_video\_games

What programming language was it written in? Does anyone have some original code reference?

# Answer
# 6502 Assembly

Here is a forum page about hacking the ROM. http://forums.selectbutton.net/viewtopic.php?t=26956&sid=1a883209e1ba63877bcd58c007bb63ae

**It should contain any code references you need as well.**

A few posts down there is a link to a zip file that contains these items needed to edit/hack the game.

* ca65 - a **6502 assembly compiler** from https://www.cc65.org/
* ld65 - a **6502 linker** from https://www.cc65.org/
* smbdis.asm - a comprehensive Super Mario Bros. disassembly
* smb.chr - Super Mario Bros. graphics (Character ROM Data)
* smb.hdr - Super Mario Bros. ROM header (iNES header)
* MAKESMB.BAT - a batch file I made that automates the compilation process.
* 6502jsm.doc - a summary of 6502 instructions.
> 84 votes

# Answer
Almost all NES games were hand-written in 6502 assembly, the same as used in the Commodore 64, the Apple \]\[e, etc. The very few which were written in C had a reputation for being terribly slow because the NES is only 2Mhz and has 2Kb of onboard RAM (with an 8Kb window for the cartridge to patch more in). Careful assembly designed to take full advantage of the NES's peculiar architecture was much more effective.

Stop and think about that... games like Super Mario Bros 3 and Kirby's Adventure ran on 2Mhz. Compare how rich they are to today's games which swallow gigahertz and hundreds of megabytes of RAM...
> 56 votes

---
Tags: nintendo
---


# Question
Title: Examples of TIN-based terrain formats in FPS games
Do you know of any terrain formats for FPS games that use a triangulated irregular network (TIN) instead of a grid for elevation representation? Or at least a game whose development tools accept a TIN as input for terrain elevation?

The only example I have is the ASCII Scene Export (ASE) format that can be used as input in the terrain editor for the Unreal engine (UnrealEd). I am mainly looking for formats that support terrain holes (both visually and in collision detection) and allow underground models. I want to avoid having to carve and cover gridded terrain elevation grids to place underground models.

# Answer
> 1 votes
Perhaps your best bet is to stop considering it a terrain in the usual sense, and rather just treat the ground as any other 3D model. Depending on the style of game you are making you may want to slice it into reasonably sized chunks so that you can load and unload parts dynamically and/or switch between high and low detail versions depending on camera proximity.

# Answer
> 0 votes
Are you talking about something like this?

http://www.panda3d.org/forums/viewtopic.php?t=2340

---
Tags: first-person-shooter, file-format
---


title: How to make Snake Body in Snake Game?

text:
# Question
Title: How to make Snake Body in Snake Game?
I'm new in cocos2d and game dev. I'm still learning in game dev. My goal is to make one game like Doodle Grub. But problem is snake body. I wrote like following

```
-(void)update:(ccTime)delta
{
    //NSLog(@"%f",[GameScence sharedGameScence].playerVelocity.y);

    CGPoint tmp=self.position;
    float tmprotation;
    self.position=[GameScence sharedGameScence].WormHeadPos;

    [GameScence sharedGameScence].WormHeadPos=tmp;
    tmprotation=self.rotation;

    [self setRotation:[GameScence sharedGameScence].Headrotation];

    [GameScence sharedGameScence].Headrotation=tmprotation;

}

```

snake is moving but problem is all of the body segments are same position when snake stop. And all of the body segments is so close and can't see segments like Doodle Grub. Any idea or Any suggestion ?

# Answer
> 10 votes
The Snake game is one of the most simplest yet addicting games built ever. I'll show you its implementation idea without code.

Consider an array containing n elements as in snake\[n\], where snake\[0\] is the head of the snake. Each element in the array snake i.e. for every snake\[i\] there should exist some mechanism to store its x and y coordinates.(I preferred arrays).We also need two variables which holds the x and y coordinates of the snake\[0\]. When the game loop begins, according to the desired direction, the snake\[0\] is moved accordingly.So since the snake\[0\] has moved to a different location what we have to do is 1.) assign into snake\[1\] the previous value(which we stored temporarily) of snake\[0\]. 2.) Iterate within a loop and change the values of snake\[i\] to snake\[i-1\] till snake\[i\] becomes equal to snake\[n\]. Feel free to ask me if you have more doubts. But I would recommend you first try these before asking someone a question.

1. Google
2. Read articles
3. Try try try doing as in trial and error
4. Read forums

That is all, **Best wishes**.

# Answer
> 0 votes
There is a 2D implementation of snake logic for one of the "enemy" entities in Grid Wars, a clone of the great hit Geometry Wars. Source code isn't the greatest readability (imho), but nice that it's available at that link, the game is written in BlitzMax. If you read through it, you'll want to look at the "Type nme6" in the main "gridwars.bmx" file.

That snake moves randomly, but it will help you see how you iteratively position each segment and move segments to the position of the segment in front of it, using a linked list. The head determines the direction of travel. Even just playing the game and using pause / step (P and O in F7 debug mode), and then watching it can help you see how the drawing mechanics is approached.

---
Tags: cocos2d-iphone
---


# Question
Title: PacMan character AI suggestions for optimal next direction
Firstly, this is **AI for PacMan and not the ghosts**.

I am writing an Android live wallpaper which plays PacMan around your icons. While it supports user suggestions via screen touches, the majority of the game will be played by an AI. I am 99% done with all of the programming for the game but the AI for PacMan himself is still extremely weak. I'm looking for help in developing a good AI for determining PacMan's next direction of travel.

My initial plan was this:

1. Initialize a score counter for each direction with a value of zero.
2. Start at the current position and use a BFS to traverse outward in the four possible initial directions by adding them to the queue.
3. Pop an element off of the queue, ensure it hasn't been already "seen", ensure it is a valid board position, and add to the corresponding initial directions score a value for the current cell based on:

1. Has a dot: plus 10
    2. Has a power up: plus 50
    3. Has a fruit: plus fruit value (varies by level)
    4. Has a ghost that is frightened: plus 200
    5. Has a ghost travelling toward PacMan: subtract 200
    6. Has a ghost travelling away from PacMan: do nothing
    7. Has a ghost travelling perpendicular: subtract 50
    8. Multiply the cell's value times a pecentage based on the number of steps to the cell, the more steps from the initial direction, the closer the value of the cell gets to zero.

and enqueue the three possible directions from the current cell.
4. Once the queue is empty, find the highest score for each of the four possible initial directions and choose that.

It sounded good to me on paper but the ghosts surround PacMan extremely rapidly and he twitches back and forth in the same two or three cells until one reaches him. Adjusting the values for the ghost presence doesn't help either. My nearest dot BFS can at least get to level 2 or 3 before the game ends.

I'm looking for code, thoughts, and/or links to resources for developing a proper AI--preferably the former two. I'd like to release this on the Market sometime this weekend so I'm in a bit of a hurry. Any help is greatly appreciated.

---

*FYI, this was originally posted on StackOverflow*

# Answer
> 3 votes
Tandem's idea of hill-climbing algorithm is good. Another is: some variation on A\* to see how far you can go to see how you can get the highest score over the next N turns, where N is tuned to give the desire result.

The scoring values you give can be thought of as "cost to move" -- you're basically on the right track, but you'll have to tweak the values until you get the result you want.

In general (not PacMan specific) terms, you need to allocate appropriate values for

* Wounded the to other guy.
* Killed another guy.
* Achieved some other goal (other than killing)
* Got wounded.
* Got killed.

and then look for the move that will lead to the maximum score N turns in the future. You may also want to avoid moves that lead to any score below X (say, the cost of dying) N turns into the future.

Once you've scored all the possible moves, added bonuses for how well it might turn out in the future and deducted for how poorly it might turn out in the future, then you just sort the array and take the best move.

Let us know how it turns out!

# Answer
> 2 votes
Definitly take a look at this video: http://www.youtube.com/watch?v=2XjzjAfGWzY

You will probably want some sort of **hill-climbing** path-finding algorithm.

# Answer
> 0 votes
You're going to perform a search.

* Node/State: Pacman location, Ghost locations, Pellet locations, Total score, Total lives.
* Transition: Pacman moves up, down, left, or right. If Pacman moves into a wall and does change locations that is totally fine (it might lead to some really interesting stalling strategies). If Pacman hits a ghost, remove a life and move him and ghosts to the origin.
* Cost: If Pacman moves onto a pellet 1, if he moves onto an empty space 2.
The cost is a bit tricky, as it's non-obvious. The cost function I described will encourage Pacman to finish the level. This preclude a possible strategy and just camping out waiting for bonus fruit to appear. But I think we want the AI Pacman to finish the maze even if it yields a lower score.
* Goal: maximum score reached. That means all the pellets, fruit, and power pellets are eaten.

A\* or UCS are great when seeking a goal. The way I've described the State/Transition/Goal will find a great walk path for Pacman the AI doesn't need to specifically consider avoiding death or seeking fruit. It will do that on it's own. Since the game is completely deterministic you could "search" from Pacman's starting location and find the optimal walk path to end (all pellets consumed) as a pre-computation and just have AI Pacman walk that path, no on the fly AI. The major drawback this approach is this could easily get out of hand in the cpu time and memory consumption.

Instead of dedicating the CPU and memory to performing a complete search you could perform partial search on the fly.

You can still use UCS/A\* but stop searching after inspecting `N` nodes have been inspected and just use the best path found so far. This approach is nice in that you can tune `N` to find the balance between speed and precision.

Another method I'm particularly fond of is Monte-Carlo Tree search. In this method you let Pacman perform a random walk of `N` moves. After each random walk you record his initial move and final score. Perform `M` random walks (or just keep doing them until you're out of time or what ever). Pick the initial move with the best average of the random walks.

These partial searches have a serious drawback. If searching with UCS and Pacman doesn't score at all in the first `N` nodes inspected he'll get stuck and as all moves are equally bad.
A\* wouldn't have this issue as long as the heuristic was careful to move Pacman closer to uneaten pellets.
MCTS might be able to avoid this issue if random walk is biased to move towards uneaten pellets and random walk never stops before scoring (ie the random walk keeps going if Pacman has 0 score.

---
Tags: java, ai, path-finding
---


# Question
Title: BlitzMax - generating 2D neon glowing line effect to png file
Originally asked on StackOverflow, but it became tumbleweed.

I'm looking to create a glowing line effect in BlitzMax, something like a Star Wars lightsaber or laserbeam. Doesn't have to be realtime, but just to TImage objects and then maybe saved to PNG for later use in animation. I'm happy to use 3D features, but it will be for use in a 2D game.

Since it will be on black/space background, my strategy is to draw a series of white blurred lines with color and high transparency, then eventually central lines less blurred and more white. What I want to draw is actually bezier curved lines. Drawing curved lines is easy enough, but I can't use the technique above to create a good laser/neon effect because it comes out looking very segmented. So, I think it may be better to use a blur effect/shader on what does render well, which is a 1-pixel bezier curve.

The problems I've been having are:

* Applying a shader to just a certain area of the screen where lines are drawn. If there's a way to do draw lines to a texture and then blur that texture and save the png, that would be great to hear about. There's got to be a way to do this, but I just haven't gotten the right elements working together yet. Any help from someone familiar with this stuff would be greatly appreciated.
* Using just 2D calls could be advantageous, simpler to understand and re-use.
* It would be very nice to know how to save a PNG that preserves the transparency/alpha stuff.

p.s. I've reviewed this post (and many many others on the Blitz site), have samples working, and even developed my own 5x5 frag shaders. But, it's 3D and a scene-wide thing that doesn't seem to convert to 2D or just a certain area very well. I'd rather understand how to apply shading to a 2D scene, especially using the specifics of BlitzMax.

# Answer
> 2 votes
Let's get the easy stuff sorted first, making and saving an alpha mapped png using BlitzMax:

```
x=64
y=64
pxm:TPixmap = CreatePixmap(x,y,PF_BGRA8888)

For a=0 To x-1
For b=0 To y-1
    WritePixel(pxm,a,b,$e0ffffff)
Next
Next
SavePixmapPNG(pxm,"glass.png",9)

```

But you might not need this at all since the best glow effect is achieved using additive transparency. wkerslake gave you the answer you need as his V3, he just did a really poor job at explaining that this is the exact lightsaber look.

# Answer
> 1 votes
Do you need to generate them? It seems like you want to generate them and store them in image files for use in the game.

**I think it might be easier, faster, and better looking if you created the lasers in some kind of image editing software such as Photoshop, GIMP, or your favorite editor.** Export the graphics as PNG and use it in your game.

It will have better performance than some kind of live shader effect and it will be easier to tweak.

# Answer
> 0 votes
There are lots of ways to do this without going down the complicated shader route.

**Version 1 - Fixed size**

If the glowing objects are always the same size, like a Star Wars style laser gun blast then just bake the glow into the texture. Use PNG for full 8-bit transparency and be done with it.

**Version 2 - Variable size**

If the objects change in length, more like Star Trek phasers then you can still do this with a pre-baked texture that just tiles along the length of the laser. You can either have it end harshly, or have a texture cap that you apply to a quad at each end of the variable length beam.

**Version 3 - Faked lighting**

If you want the glow to affect the environment then consider making two texture. One that is the center of the beam that you draw normally so it always appears. The second texture is just the pre-baked glowing elements which you draw as additively transparent. This will make the glow appear to cast light on whatever is underneath it.

It's a low tech effect and isn't correct lighting, but for something moving fast enough in 2D it looks close enough to correct to fool you if it isn't too large an area.

---
Tags: opengl, shaders, blitzmax
---


# Question
Title: Game architecture for someone with a background in LOB Apps
I've got a background that is almost entirely based around business applications - Web services, schedulers, desktop and web front-ends to CRM systems, etc...

Now with almost all of the above projects, the basic principles are the same:

Some sort of data access layer, business logic layer and a UI.

Obviously some scenario require something a little unique but in general it's N-Tier all the way.

I'd like to do some game development as a hobby. I'm not expecting anything impressive as I don't have the resources to dedicate to it, but something to challenge me a bit would be good.

What lessons (if any) should I be taking from my current experience and what do I need to learn again?

I'm assuming that as with all my experience, different types of games will have different architectures but are they all based around the same core principles? For the sake of argument, let's say I'm building a simple MUD (maybe a top-down UI like the older Zelda games) - This seemed like something that I could have my 3-Tier logic for - A server with the BLL and DAL and a client UI - But I'm not quite sure if this is right - certainly using the Entity Framework doesn't seem appropriate as there's an awful lot of overhead in accessing lots of stuff in the Db and I'd imagine performance will be an issue - eg I'm assuming I wouldn't want to constantly use the Db to store player locations if they're changing 20+ times/second...

Are there patterns and practices specifically for game scenarios?

Is it feasible to develop the back-end system before creating a UI (eg plugging a console app in instead to allow me to develop the functionality I'd like before adding the UI). Is this good/bad practice?

In short, I don't know where to start and would appreciate some advice - especially from those with experience.

About the only thing that's set in stone is that I'd like a multi-user game with a central server. Game suggestions welcome.

*\[This was originally asked on SO but it was suggested that this would be a better forum. Apologies if this breaks any rules but I don't know how to link across sites. If someone can advise me of the appropriate action, I'll take it. Many thanks\]*

# Answer
> 4 votes
I don't think there really is a way to answer your questions. Personally I think it's too broad a topic to really talk about.

> What lessons (if any) should I be taking from my current experience and what do I need to learn again?

Well if you can think like a programmer and have learned to problem solve then great. Maybe you'll have an understanding of what makes a good end-user UI. Database knowledge might be a good foundation for... something... The rest of it (other than probably the web communication layer) you can throw away. Real time game programming is almost totally different than application programming. Maybe there might be a little bit of convergence when you start throwing multiplayer and server communication in the mix, but it's a significantly harder problem than just a local-only game.

> Are there patterns and practices specifically for game scenarios?

Yes. But most of them are subjective.

There is a huge gamut of different patterns in making a game. Some related to 3D graphics (and all its various subgenres like lighting, filtering, shaders, etc. etc. etc.). Some for features like streaming in level content. Lots of books on collision paradigms. There's a battle for OO vs. data-driven design. Components vs inheritance hierarchies. People can't even agree on what is the best way to pump updates to entities in a world (fixed rate or passing in per frame deltas, for one part of the argument). People have different opinions about whether or not generic programming is a good thing. There's no way to really answer that question as stated (other than "yes"), it's too broad.

---

I mean, if you have *specific* questions on how to do certain things, that is what this site is designed for. For example, maybe you want to know about how to sync up client side movement with a server and have it not be choppy. Maybe you want to ask if the client should be authoritative on movement or the server should be.

My advice to new people starting games is just to *do it*. Nobody can help you make your decisions. You can be spinning your wheels forever trying to do research on the "best way" to do things. But that really isn't important. What's important is building up experience on your own in order to get to the point where when you need to make a decision you can make an informed decision, and to keep an analytical mind open when you're working on things to see what problems and solutions crop up.

For your example, talking about pushing updates to a database. Just do it. Then profile it. If it's slow, think about ways around it. If it isn't fast enough, start thinking about ways to handle it. If you need direction, then come to us for help.

# Answer
> 1 votes
You dont tell us what languages you are used to from your work with websites/CMS/CRM etc. but as being one of these "business people" myself, I also do gameprogramming in my sparetime.

I've found that Unity3D is a great game-engine, if you know how to write Javscript or C#.

Have a look at www.unity3D.com for more info. There is a "almost full" edition for free, which you MAY use for publishing games. And you are allowed to charge money for your games, eventhough you use the free edition, as long as your total income in the company using it isnt earning above $100.000 a year.

Ofcause you might need to team up with some others for 3D objects, sounds, music, leveldesigns, but for a start this is great stuff.

Check out my latest "test" http://3d.d9.dk/pills/?crm

Its a PacMan kinda clone, as I've been educating many people for years on how to make PacMan games, but never actually done one myself as I found it too "simple". Well, dont tell it - show it! :o)

So my answer is: if you want to develop gams for crossplatform (PC/MAC) and perhaps later on move on to smartphones, then Unity3D is surely one of the better choices.

IF I want to move my little game onto lets say iPhone, I could buy the small iPhone licens, which is only $400 + I would need an Apple developer license ($99) + some hardware (Mac Mini perhaps) to run the Unity editor on a Mac (as Apple dont allow programs for their iOS to be compiled on nothing but Mac, but thats another storry) + an iPhone or iPod or iPad, depending on what platform you wanted to target.

The point is, that you can EASILY transfer the game from PC platform to mobile with Unity3D, so thats my goal.

Ohh and btw. I am also an experienced Flash/Actionscript 3.0 developer, but as Flash currently isnt supported on iOS and I kinda liked this real-3D engine for my semi 2.5D games, I think its great that there even is a free edition to train and get used to it first.

---
Tags: game-design, architecture
---


title: Useful resources for beginning AI

text:
# Question
Title: Useful resources for beginning AI
What resources are available, including both free articles/ebooks and physical books and things, for game developers looking to begin simple AI programming/design?

*Note: I know of this question, but that's more asking about where to start on a specific topic; I'm more asking about resources in general.*

# Answer
Programming Game AI By Example by Mat Buckland is an excellent resource to get started. He starts right from the basics of state machines and moves on to steering behaviours and graph theory for pathfinding. Probably one of the best resources I've found, especially when starting out.

The AI Game Wisdom books are also very good, but a lot of the articles are pretty advanced.

A good link for steering behaviours is this site: http://www.red3d.com/cwr/steer/

And as has been mentioned, http://aigamedev.com has amazing content, right from the frontlines.

Amit's Game Programming site is pretty decent at getting an overview (although admittedly, I haven't used it much): http://www-cs-students.stanford.edu/~amitp/gameprog.html#ai

I'd thoroughly recommended Buckland's book though. Very easy to follow and the source code actually works :)

Ray
> 10 votes

# Answer
I'm a really big fan of this book in terms of 'simple',

AI for Game Developers

You can find it for about $5.00 on Amazon if you factor in shipping from a 3rd party. It talks about basics and good material for tile based games, which are great starting points for developing.
> 4 votes

# Answer
http://aigamedev.com/

Half their content is behind a paywall, and it's practically impossible to find anything specific (like if you're trying to find their articles on behavior trees), but the content is second to none.
> 1 votes

---
Tags: ai, assets, books
---


title: Learning to write a solitaire game

text:
# Question
Title: Learning to write a solitaire game
Many years ago I did some programming in TurboPascal (on DOS!), but have not programmed since. Since retiring, I have "invented" a few solitaire games that I have given to people who sell solitaire collections. Recently I've invented a game that is different enough from existing solitaires that it does not "fit" into these collection packages. I would have no difficulty writing a simple program to do the job in TP, but that is no longer an option. I purchased BlitzPlus, but would like some help getting started. I hate the idea of reinventing the wheel; ie, learning from scratch how to shuffle decks, assign graphic files to cards in the program, etc, so, ideally, I'd like some basic source code from a very basic (ie, nothing fancy required) solitaire program, but, if necessary, would start from just tutorials on some of the procedures likely to be required. As I said, I've already purchased BlitzPlus, but would be willing to use some other language if that would be better or offer more tutorial assistance. Any help greatly appreciated.

# Answer
I've never coded a card-game but I feel like encouraging a beginning game programmer. So I just accumulated little bit of resources from the internet.

This is a solitaire game in java and since I thought you might not be familiar with concepts like svn i am including a link to the source code directory which you might find useful.The site above I mentioned uses the Java programming language.I think the only things you might need to do will be

1. Modifying the art assets in the above project
2. Changing the game-play to suit your ai.

Best Wishes.
> 2 votes

# Answer
Here's a few links that might help. One is C++ and the other is in Visual Basic, but you may be able to glean something from them and get started. The C++ site is a project assignment from a college and is pretty much just an outline.
Visual Basic
C++
> 0 votes

# Answer
You could try using Actionscript 3.0 (flash) to build 2D card games. Here are a couple of tutorials: 1)http://www.emanueleferonato.com/2007/12/30/guessnext-complete-flash-game-with-highscores/ 2)http://www.developphp.com/Flash\_tutorials/show\_tutorial.php?tid=221 3)you could check out: http://www.gotoandplay.it/ (it has a lot of tutorials)
> 0 votes

---
Tags: 2d, card-game, source-code
---


# Question
Title: High Performance Vector Graphics Solutions
**I'm looking for a high performance vector graphics library I can use in my games.**

I'm thinking along the lines of vector graphics such as those that can be made with SVG.

I'll consider any language at the moment (but must run on Windows). A solution that takes advantage of GPU hardware would be great.

Thanks in advance.

# Answer
> 7 votes
If Windows (Vista and beyond) is your only platform you should look into Direct2D, which provides GPU accelerated 2D vector graphics rendering with software fallback. For a more x-platform solution look into Cairo, which I believe to have a GPU accelerated rasterizer.

# Answer
> 3 votes
OpenVG is a standard for hardware accelerated vector graphics. It is supported by GPUs targetted for handheld devices, such as Mali / PowerVR / Vivante. Qt and Cairo can use OpenVG as a rendering backed. There are software libraries that implement OpenVG using OpenGL hardware (MonkVG, AmanithVG GLE) or software only (AmanithVG SRE, ShivaVG, AlexVG).

# Answer
> 2 votes
Scaleform GFx is a commercial middleware library for integrating Adobe Flash movies (optimized rendering, ActionScript, and more) into your engine.

In a past life, Scaleform GFx's codebase was that of GameSWF. GameSWF is open source.

I planned to add more to this answer, but by the time I got back to it, most of main points I wanted to hit on were mentioned in other answers.

The only other thing I can think to mention that's relevant to the Flash-based approach is the fact that Adobe has released the source code to their ActionScript virtual machine, which now lives at the Tamarin Project at Mozilla.

# Answer
> 1 votes
If you are using windows XP or want something that works on most versions of windows, you should check out DirectDraw (even though it's a little old now) or GDI+, or you could use Flash, which seems pretty good for vector rendering, and is cross platform.

# Answer
> 1 votes
There's some discussion here and there on how to work SVG graphics into the XNA game engine. One here: http://wam-games.com/2010/04/svg-in-xna/ and here's a post on this very site: Rendering SVG art directly in XNA

XNA pipes pretty much everything through Direct3D as I understand it, so it's all GPU accelerated. You basically must program in C# to use it (you can kind of use other languages, but you have to hack at it.) Using XNA gets you Windows for sure, but also the possibility of porting to XBox360 and a couple of portable platforms.

---
Tags: graphics, svg, vector-art
---


# Question
Title: 'Zoning' up areas on a large tile map, as well as dungeons
My game is having a map like that of Minecraft, in the way it's pseudoinfinite and randomly generated. And big. Say the user has explored a 1000x1000 zone (2D here), so that's 1,000,000 tiles.

Obviously I'm not going to be able to store it all in memory. Nor do I just want to ignore everything out of a 10 tile or whatever radius - both will nothing update (all the NPCs, perhaps reactive tiles) and I would have to work with awkward positions like 1382,12918.

So if I was to split it down into chunks or zones or whatever of say 64x64 tiles, I would have to store each tile and object's position like:

> Chunk a,b. Position x, y.

But what if I wanted dungeons and the like in my map? So a single tile that leads to maybe a 40 floor dungeon, each with an area of 40x40. I can't exactly store those in the same map.

And there's the memory side; how much could I potentially store in memory at the same time reasonably? I could do tiles by ID quite easily, and have the normal 2D array there. **Or again, is there a more effective solution than having a data file of tile types**? So for a 64x64..that's only going to be 20K or whatever. I'd like as much as possible surrounding to be loaded for the most realistic update. But I don't know what sort of limits I can hit without becoming memory hogging.

# Answer
> 9 votes
While I agree with the sentiment: "don't worry about it unless it's a proven issue", I do think it's worth thinking about early on: retro-fitting a solution is much more painful. And yes, only updating 'nearby' tiles is they way to go. But storage and addressability of items in your game world efficiently is very important for performance reasons.

What you're really thinking about here is a sparse data-set: something where the potential indexes are large (or unlimited), but only a small proportion are actually used. The key point is that you do not know exactly which proportion will be used.

The standard solution to a sparse data-set problem is to separate the index/addressability from the actual data storage. So if the tile object is expensive, then store it in a compact form (e.g. a flat array). But allow it to be indexed through a cheaper object. In its simplest form, this can be a 2D (or 3D) matrix which you can easily index by coordinate, but each item in the matrix is simply an index. You then use that index to look up the actual tile contents in a separate, compact array. If the tile contents do not yet exist, then add them to the end of the array, and store the index in the 3D matrix.

The solution gets more complex if you wish to support deletion of contents (as it leads to fragmentation of the contents array), and if your tile contents are cheap, then the extra weight of the index (32-bit or 64-bit indices) will probably overwhelm the savings from not storing every single potential tile. It's also an extra lookup, which will hurt your cache performance.

You can get even more storage efficiency by introducing extra layers of indirection. Let's say you organise your tiles into chunks, and chunks have a granularity of 64x64x64. Given a tile at 125, 1, 132, you know it belongs in chunk (1,0,2). So you have a world, which consists of a compact chunk array, and a matrix of chunk indices (-1 if the chunk doesn't exist). The contents of each chunk (if present) are a 64x64x64 matrix of tile indices (-1 if the tile doesn't exist yet), and a compact array of used tiles. This way, you don't burn a massive amount of tile indices for chunks which are never used. By following this sort of approach, and picking sensible numbers for the chunk granularity, you can scale up your universe massively, and keep your memory usage under control. Actually, if you make your chunks 32x32x32, you can even make your tile indices 16-bit.

You can also do sneaky tricks as well, like using the high order bit of your chunk or tile indices to mean something special. So if an entry in the tile matrix has the top bit set, then the lower 31 bits don't mean a tile index, instead they mean a 'warp index' or something similar, and you can look that up in a separately maintained list to find out the coordinates it leads to.

# Answer
> 6 votes
Why can't you store one million tiles in memory? Even my phone has 256MB RAM; a million empty tiles is going to be what, 4-32MB?

---
Tags: tiles, maps, memory-efficiency
---


# Question
Title: Are there any game engines in C# or Java that are cross-platform and support multitouch input?
I'm looking for game engines (particularly 2D) that can run/create games for Windows, Mac, and Linux, and support multitouch inputs and gestures. I'm able to find many that meet the first two criteria, but don't mention anything about multitouch.

I know that Qt is an existing non-game framework that supports multitouch and is cross-platform. Unfortunately it doesn't seem to be geared for hardware-accelerated games.

# Answer
> 0 votes
You could try Unity iOS Pro but as MrCranky said what is the point of having multi-touch support for a platform that doesn't support multi-touch (at the time being?

# Answer
> 2 votes
Well, the answer would probably be: because Windows, Mac and Linux are not primarily touch screen platforms, and multi-touch inputs is a concept that only makes any sense on touch screen platforms.

Why would engines support an input mechanism if the platform doesn't? In some cases (e.g. iOS from Mac OS) there's a common framework because the platforms have evolved their existing OS to support touch screen devices (I'm not sure if Windows and Windows Mobile have gone the same route), but that's rather a side effect than a design decision I'm sure.

As pointed out in the comments, the newest revisions of the desktop OSs are starting to embrace touch screen support, a fact of which I was unaware. But still, additional hardware is needed for everything except tablet PCs. And while Wacom input tablets are nice, they are really no substitute for touch input on the same device as the display is rendering.

So we are talking a currently miniscule proportion of the market. That's not likely to change either, until new systems start shipping with multi-touch capable input devices as standard. And since engine creators, like everyone else, only prosper by supporting targets with decent user numbers, I'd still be surprised if there were any engines which fit your criteria. I'd imagine though, if it's a popular input mechanism, demand for the hardware will grow, and existing engines will start to integrate multi-touch support. I'd be wary of any implementations that didn't have multi-touch in as a core design concept though, since it does affect the interfaces all across the UI part of an engine.

---
Tags: c#, java, cross-platform, multitouch
---


# Question
Title: Places to Test Player Interest In Storyline
I am working on an iPad game, and have a few different intro story lines. I would like to get gamer feedback on the intros.

What websites or techniques have others used to get such feedback?

# Answer
If you can break it down into just text, one of the common things some companies do is send out surveys to a bunch of people asking them to rate it.

So basically just make a surveymonkey survey (or some online equivalent) and ask the user to rate the intro text on some kind of scale to see what sticks.

Generally speaking, though, these companies would have systems in place for beta testing lists so they already have a large pool of people they can spam who opted in to getting these kinds of things.
> 1 votes

# Answer
Invite only beta. Find about 5-10 main beta testers and give them each 5-10 invites to give to their friends, on the condition that they will give feedback.

Oh, and *anyone* can be a beta tester. Your grandma, your next door neighbour kid, anyone you see as a target audience for your game.
> 0 votes

---
Tags: community-management
---


# Question
Title: 2d Pixel Shader literature, algorithms, etc. for Pixel Bender for flash
I am looking for some literature about pixel shaders algorithms or how would you call it.
It's for 2d top down space shooter kind of game.

I was thinking effects like halos, slow time, trails, fast speed feeling..

I'm not looking for a guide how to code in Pixel Bender but for something that will teach me how to move pixels around to get expected effect.

# Answer
> 1 votes
If you want to go for the basics with examples, then I guess this is where I would start:

Also there is a ton of other books considering shaders (with examples):

You could also take a look at: Modern Shader Book?

---
Tags: flash, shaders
---