Game Development XNA framework
Introduction about game development with Microsoft XNA game studio
Microsoft® XNA™ is composed of industry-leading software, services, resources, and communities focused on enabling game developers to be successful on Microsoft gaming platforms. Microsoft provides advanced technology that allows professional developers to quickly enable games on platforms like Xbox 360 and Windows. Simultaneously it provides authoring, development, debugging, and profiling tools, while the libraries provide superior performance and an amazing depth of features.
Zatun has developed the “The Legend of Vraz”, a 2D action packed adventure arcade game for Windows PC. The legend of Vraz is the first 2D arcade game in India created with Microsoft XNA Game studio. It is also one of the earliest Microsoft XNA games developed in India and one of the first games in India from an Independent developer. It is also the first game ever made on Indian Miniature painting style.
Before starting the actual game development the team prepared the game design document. Two teams were created which worked in parallel. One team worked on the graphics development which looked for the miniature art and the other team, game programming team, was searching for a particular platform and different game engines. During this period the team checked out other game engines but finally decided to work with XNA.
One of the most important phase of the game development was finished; information gathering. After finalization of the platform we started looking on how we can utilize the XNA for the game development with its best. We started from the home page for the XNA and move forward from there looking at different samples and tried to figure out the best optimized solution for that. The learning curve for the XNA seemed to be very low as we had an expertise in C, C++ and C# as well as different graphics library such as Open GL and DirectX.
The following were the base requirements for us to develop a game.
- Game Menus
- A graphics library which would give us direct access to the hardware which is available with XNA.
- A Game world designer, Map Editor, that would help us in faster production of different Levels and Worlds.
- A Character Animation Editor, Character Editor, which would assist in the developing faster animations with better results.
- Ease of development of physics that can be included in the game.
- Ease of implementation of the artificial intelligence inside the game.
- Applicability of the special effects. Game Menu
Now we are on board the ship of hardcore coding and have just started sailing. We are now ready with the GUI of the game-the menu of the game which handles the game parameters.
We started building it from scratch by taking reference from book- Beginning XNA Programming, from Novice to Professional by Alexandre Lobao and others.
We made a general menu initially which gave us the idea about the functioning of menu. We took the approach of Game Components in which every screen was added to the game as a game component. Through this we acquired the knowledge about important features of XNA like Game Components and Game Services.
We also got to know about controlling Sound, display modes and keyboard controls. Dealing with File input/input and mouse was also a part of the learning process so now we were familiar with that also.
Then we began the main programming of our game specific menu but by following the reference as mentioned above we were facing memory issues as every menu screen was added as a game Component which consumed some space in memory and the code would get more and more complex as the number of menu screens would increase. So now we had to think of a very simple way to develop and handle menu because if menu itself would be so complex then mounting the whole game would lead severe memory issues.
We took the approach of a controller which controls the rendering and hiding of menu screen and passing controls to respective screen. The only game component added was the controller which when required to display a screen, would load its contents on run time and would display the screen. This reduced a lot of memory overload as only the visible contents were loaded in game and others are not. This also made our code very simple as in from only a single class – the class of the controller we could manage all the game screens.
Having a simple skeleton ready for the menu, adding the different functionality was not a major task as due to prior knowledge of the audio, display, mouse etc, it was just like fixing the spare parts of the motor engine in proper place. This reduced the development time and effort. Now we will move on to developing the first level of the game.
Map Editor is a utility that allows the faster development of the game levels or the game world. As we have stated in the Introduction section that the game will be a platformer, action and adventure game so obviously we lots of jump and multiple path for the wondering around. We have different layer depths for different images and tiles.
We have even allowed placeholders for different collectibles and the NPCs as well as for the enemies too. This map editor application allows us to draw the collision detection path where player can run on. Bounding boxes are helpful to assign the collision with different objects during the game. We can assign these boxes in the game too.
The NPC characters allow moving during the game into their patrolling area and also able to take appropriate action when the player comes into visibility area. It is more advantageous to assign them in the editor rather than into the game itself. So the Map editor allows us to do this on the fly just on the click on a mouse button.
Once we will finish with one point we can run the application and even check how this thing looks in the real game. Once we found any issues we can straight away go there and sort that issue very easily.
Here it shows different interactive objects which can be directly add into the map editor and then on the fly we can load them into the game.
Game AI (Artifical Intelligence)
Artificial Intelligence is one of the important factor that make the game looks like a real game and the gameplay looks very interactive, the game is engaging the player and make them think.
First of all the game characters should move on the path assign to them and do the patrolling. This means that the character should move on the platform and when they are on the platform they just stand still and play the appropriate animation.
In the other case we have to take appropriate decision when the player character comes in to the visibility of the NPC they have to take appropriate action such as changing the direction, attack the player or dodge if the player is attacking and some other like this. This is a part of the AI. But in this case we have different types of enemies and they have different physic so we can’t take a generic decision. In this case the langur baby can jump as it is light in weight where as the soldier can’t as he has heavy Armour on his body so we have take decision based on this kind of situations.
Even to make the game more realistic we have included different expressions like happy, sad, angry, die and so on. If the NPC can hit the payer twice then they will be happy and miss then sad or angry.
Game Particle System
Particle system is one of the important factor that give realistic look to the game. We have applied particle systems at few many places like in different interactive objects like fire flame, volcano and arrow fire.
For the particle system we have make the particle system manager by our self and use the different objects on them. This manager will take of updating the look and feel of each and particle by make sure that a particular particle requires update. This way we can optimize the thing effectively.
Game development is a dream of team Zatun. The experience with XNA is also good that we have deliver what we want. XNA is good development platform with lots of resources available on the internet with few dedicated site too.