Jump to content


Photo

Beginners Guide


  • Please log in to reply
4 replies to this topic

#1 hcf

hcf

    X-S Senior Member

  • Members
  • PipPip
  • 202 posts

Posted 27 February 2012 - 02:38 PM

When I released my first Xbox game (Arcadian Tactics), I was suggested to create a Beginner Guide to start developing Xbox games. Well, I am not the most experienced Xbox developer, in fact I think that I am one of the LEAST experienced Xbox developers today wink.gif But anyways I am going to make a mini-guide explaining what I learnt in this time. My goal is to make things easier to anybody who wants to start developing games for the Xbox, explaining my own experience. Also, this thread could be used to ask beginner questions about how to start Xbox development.

First of all, I will say that if you want to make Xbox games, the best option is using the C or C++ programming language, so I am going to focus in this. Anyways, if you don't know anything about C or C++ don't be discouraged, you have other methods to create games. For example, you can use OpenBOR to make a Beat'm-up game, and play it with the marvelous "Beats of Rage" port for Xbox (it can play any BOR game, not only "Beats of Rage"). I saw a game based in the Asterix characters made with this technique, which was pretty good!!. The same can be applied to Mugen (you can create a Mugen game and play it in Xbox with Xmugen) or even create a Python game and play it in XBMC. But let's focus in the main thing: creating native Xbox games (with C or C++).

The first thing that you must decide is which kind of development kit are you going to use. As far as I know (please, if you know more options, write an answer to this post!!) there are two main options: XDK and OpenXDK. Let's analyze them:
  • OpenXDK: it is a free development kit for Xbox. Its best point is that it is free. Its worst point, as far as I have seen, is that its state is not as mature as the official XDK, and the code generated with OpenXDK is not as optimal. What does this mean? Well, this basically means that a game made with OpenXDK will run slower, with less frames-per-seconds, than a game made with the official XDK. So, if you are planning to make a game that does not need to update and refresh the whole screen many times per second, you can use OpenXDK. But if your game NEEDS to update and refresh the whole screen many times per second, maybe OpenXDK is not enough for you.

    Examples: if you are planning to create a game like my Arcadian Tactics, or a chess game or something like that (the screen does not change a lot) you can use OpenXDK. But if you are planning to create a game like "Sonic" (the whole screen scrolls very fast all the time), be warned that OpenXDK will force you to use all your skills to optimize the game and make it fast.

    I will let you know an advice, if you finally use OpenXDK. There is a marvelous trick named "dirty rectangle", which can boost your frames-pre-seconds. The trick is, updating only the area of the screen that has changed since the last time that you drew it. You don't need to refresh the whole screen! For example, if you have an static background, and a 32x32-pixel character that moves, you only have to refresh each frame the old position and the new position of your character (you don't need to refresh the whole screen every frame). This will boost your game. This trick is very good, and you can use it both with OpenXDK and XDK, but if you use OpenXDK you sure must use it, or your game will be slow.

    If you are going to use OpenXDK, what kind of environment will you need? In my opinion, if you have a Windows machine, the easy solution is installing Cygwin (it is a very powerfull pseudo-Linux environment). Here are a couple of usefull links:

    http://openxdk.maturion.de/installing.html

    http://forums.xbox-scene.com/index.php?showtopic=552447

    Following these instructions you will have a Cygwin system with a C/C++ compiler and the OpenXDK libraries, so you will be ready to create games.

  • The other option is using the official Microsoft XDK. The bad thing of this option is that XDK is not free. The good thing is that the code generated by XDK is better (faster) than the code generated by OpenXDK. What do you need to install if you want to use XDK? Well, of course you will be forced to use Windows. As far as the environment, you can use Microsoft Visual Studio .NET 2003. I am not sure if you can use other versions of Visual Studio, so if someone knows it, please tell us). I guess that later versions of Visual Studio .NET (2008 for example) can work too, but I am not sure. Furthermore, I don't know if there are older versions of XDK which can work with older versions of Visual Studio. The only thing that I can say is that people I know, have used allways this combo: Windows + Visual Studio .NET 2003 + XDK. This is enough to create your games.

Once you have selected your programming language (we are focusing in C/C++) and your IDE (Cygwin+OpenXDK or VisualStudio.NET+XDK) you need to decide which kind of technology are you going to use. In other words: are you going to make a 2D game, or a 3D game? You will need different libraries in each case. Again, I am going to analyze these two options:
  • If you are going to create a 2D game, I recommend that you use the fantastic SDL library, which has been ported to Xbox!! Of course this is not the only one option, but in my opinion it is the easier one. The good thing of the SDL library is that it has been ported to lots of systems (Windows, Linux, Xbox, Sony PSP, Nintendo Wii, Android for mobiles...). So, if you create a game in SDL, you can port the game very easily to any other of these systems, and 90% of the code will be valid! This has several advantages: one the one hand, you can create your game in Xbox and Windows at a time (I did this with Arcadian Tactics). It is very easy to debug the game in Windows, and later you can port it to Xbox easily (if you try to make generic code, almost everything in your code will be reusable).

    On the other hand, SDL makes easy to create games... and to port games!! If you don't want to create a game from scratch, maybe you can try to PORT a game that someone made using SDL. Simply be sure that the game does not use any other strange dependency. For example, if someone made a game which used "SDL and Qt.4", you will not be able to port it easily, because SDL is ported but Qt.4 is not ported for Xbox. But if you find an opensource game made only with C/C++ and SDL, you can port it to Xbox easily.

    By the way, if you use SDL to port a game (or if you compile it for Windows and Xbox as I did) be warned that the PATHS in Xbox are different than in other systems. In Xbox, you must write "D:" at the begining of every path, and it will be the relative path of your executable (not an absolute path). If you have made a port and it doesn't work, the most common mistake is this wink.gif

    What do I need to install, if I want to use SDL to make a 2D game? Well, you need the SDL libraries ported to Xbox. Maybe you will find them as "SDLx". Besides the SDL library, install also the SDL_image and the SDL_ttf (if you want to write in the screen) which also have been ported for Xbox. The port is diferent for XDK and OpenXDK, so whenever you search for the SDL libraries, search for the ones that have been compiled for the environment that you are going to use, and simply put them in the path that your compiler is going to use.

    With SDL, you will be able to create awesome 2D games!

  • On the other hand, if you are planning to create a 3D game, SDL will not be enough. It's true that SDL supports 3D graphics by using OpenGL, but this 3D support with OpenGL has not been ported to Xbox (yes, it's a shame). So if you want to create a 3D game you will need to use a different approach: Direct3D. Direct3D is a part of the famous DirectX library for Windows, so again you can develop a game in Windows using Direct3D, and it would not be very difficult to port it to Xbox (again, if you don't have a debug Xbox, this is one of the best methods in my honest opinion). The bad thing is that this games may only be ported to Windows/Xbox. The other systems that I mentioned (Wii, PSP, Android...) are more OpenGL-based, so the port of your game to these other systems will not be so immediate.

My advice, if you don't own a debug Xbox and you are going to create a Xbox game (2D or 3D) is to develop the game simmultaneously for Windows and Xbox, trying to use the same source code for both two systems. This makes debugging very easy.

For example, in Arcadian Tactics I created a "common" class that includes all the routines which I will use in all of my games (initialization of the screen, filling the arrays with ths status of every button of the controllers...). This "common" class is different for Windows and for Xbox. Once made this... all the rest of the source code is THE SAME for Windows and Xbox. So, I simply developed the game for Windows, debugged it in Windows, played it in Windows, and finally... compile it for Xbox in your Visual Studio.NET with XDK or in your CygWin with OpenXDK. That's all, you have your Xbox game!!

So, my advice if you don't have a debug Xbox (I don't own one) is to install in your PC two programming environments: your XDK/OpenXDK environment (with Cygwin or VS.NET as we said) to compile the game "for Xbox", and another environment "to compile the game for Windows" (I used the free compiler Dev-Cpp for doing this). This way, you can debug in Windows, and play in Xbox.

Come on, creating a game is not as difficult as you can think, and there is people here that can help you in these forums if you face any problem!! smile.gif

#2 freakdave

freakdave

    X-S X-perience

  • Dev/Contributor
  • PipPip
  • 472 posts
  • Location:Europe
  • Interests:PROGRAMMING,XBOX...
  • Xbox Version:v1.0
  • 360 version:v1 (xenon)

Posted 27 February 2012 - 05:25 PM

In addition, with the recent release of IrrlichtX, which is the XBOX port of Irrlicht,
creating 3D games has just become (a whole lot) easier cool.gif

Edited by freakdave, 27 February 2012 - 05:26 PM.


#3 hcf

hcf

    X-S Senior Member

  • Members
  • PipPip
  • 202 posts

Posted 27 February 2012 - 06:15 PM

QUOTE(freakdave @ Feb 27 2012, 05:25 PM) View Post

In addition, with the recent release of IrrlichtX, which is the XBOX port of Irrlicht,
creating 3D games has just become (a whole lot) easier cool.gif


Wow, I didn't know about it!! GREAT WORK!! It seems that I cannot edit my previous post, so I hope that people read your comment, because IrrlichtX is an enormous contribution as far as 3D games development for Xbox is concerned.
Thank you very much!

Edited by hcf, 27 February 2012 - 06:22 PM.


#4 Hyper_Eye

Hyper_Eye

    X-S Expert

  • Members
  • PipPipPip
  • 595 posts
  • Gender:Male
  • Location:Huntsvegas, AL.
  • Xbox Version:v1.0
  • 360 version:v5.0 (360S - trinity)

Posted 27 February 2012 - 08:06 PM

I think the pros and cons of the SDKs should be more clear.

OpenXDK is open-source, free, and legal. Games built with the OpenXDK can be legally distributed as long as the game code allows it. This means you can provide builds of your game on websites, google projects, sourceforge, etc.

The Microsoft XDK is not open, free, or legal. Games build with the Microsoft XDK cannot be legally distributed and, if you do distribute them, Microsoft could take legal action against you... however unlikely that is.

#5 hcf

hcf

    X-S Senior Member

  • Members
  • PipPip
  • 202 posts

Posted 27 February 2012 - 09:33 PM

Hyper_Eye, thank you very much for your clarifications. I tried to say lots of things in a few text lines, and obviously many things were missed on the road... wink.gif




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users