Game Design

I'm thinking of developing a game. Just a simple (by my standards) 2D sidescroller beat 'em-up type game (Streets of Rage/River City Ransom type)

I have read plenty of game development tutorials, but I can never seem to find anything about certain topics.

For example, how would I go about organizing functions and which class would I put them in? I know it has to do with personal preference, but I haven't found any real information on where to even begin. Is there some sort of list of common classes used in games?

I would imagine you'd have an input class to handle keyboard/mouse input. Maybe some sort of person class, where enemies and the player are derived from? Some.. weapon class, I don't know.

I was thinking of storing all my player stats (health, strength, stamina etc..) and other game information (weapon strength, etc...) in typed datasets and using it from there, as opposed to hard coding it. Is there any reason I shouldn't do this? Is there a better way?

In my main game loop, how can I make the most out of CPU time? I was watching the C# video tutorials on Coding4Fun and it was using some sort of loop that sits idle while waiting to redraw the screen. They said it's not the best way to do it, but they gave no alternatives.

I'm not new to programming, but I'm certainly not a professional developer; all I need is a good push in the right direction.

While I'm asking questions, does anyone know any good 2D C# engines, preferably open-sourced? I want to develop my own (probably hard, I know, but it's not like I have time-constraints). Are there any resources that talk about developing your own engine (keep in mind, 2D)?

Again, there must be some sort of standard about what I should be developing when creating an engine (physics class, sprite handling class, etc...)

Thanks

[2141 byte] By [Ro0ke] at [2007-12-23]
# 1
Lots of good questions. Many that I still haven't answered myself. I'll try and cover them as best I can.

For code organization, you are right, it is going to be up to the individual developer to figure out what makes the most sense for their project. Really, this isn't a game development question as much as a general development question. The goal is to try and use good coding practices and stick with proper object oriented techniques to maximize your object reuse.

One good way to check and see if you're doing things right, is to download as many sample games as you can and examine their code and see how others decided to organize their objects.

Getting the most out of your CPU time. Just like everything, there's a lot of ways to do game loops and there are pros and cons for each. The most important thing is just to learn what your options are and then pick a method that works well for your type of project. There's isn't always a "best way". I myself am still exploring this topic and if I find some definitive best way, I'll be sure to pass it along.

I don't know of any open source C# engines, but I do know that Microsoft has partnered with GarageGames and that GarageGames has a 2D engine coming out developed in C# with the XNA framework. It's not going to be free, but it will be low cost if GarageGames history of pricing is any indication.

For standards in developing engines, I would just examine existing engines and see what classes and objects they implement and provide. There are a lot of tutorials out there and many have implements a rudimentary engine of some sort.

I would recommend looking through the collection of tutorials the ZBuffer has taken the time to collect. I also have a couple of tutorials up on my site along with a fully playable game written in VB.NET with Managed DirectX so that might help you out some as well.

Also, make sure you take a look at the XNA Game Development studio when it's released. It will make a lot of game development a lot easier and they haven't forgotten the 2D developers.

GeorgeClingerman at 2007-8-30 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 2
http://mail.rochester.edu/~mabernet/trans2d/

Trans2D is a good engine for 2D stuff... I wouldn't go as far as calling a engine, but more like some stuff you would prob have to code if you were to make a 2D game in direct3D. Also, the game loops in the samples are the best way I have found.

djperegrine at 2007-8-30 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 3

If I were writing a game like this, I'd set up the following classes:

- a graphic interface which serves as a wrapper to Direct3D functions (there's no reason the app itself should have to concern itself with devices, textures, etc.)

- a "game" class which contains all the objects which exist in the game

- an "actor" class which describes all the properties of any given character (e.g. visibility, screen location, "game" location, maximum health, current health, an array of sprite textures, animation state, animation timing, etc.) I'd also suggest that, if you're feeling ambitious, you create an event system which any of your actors can call to do certain common functions. For example, if an actor's current health falls below 0, it can raise a hypothetical "KillActor" event, you could handle that event by setting the sprite textures to show a "dying" animation (e.g., make the sprite flash between visible and invisible and show "BAAAAARRFFF!" in the message window [yes, I'm a fan of RCR also!] ) and then calling the destructor.

As George said, this is more a general programming question than a tech question.

duckthing at 2007-8-30 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...