C# Game Examples I would like to see....

Hi,
I posted this same list on a couple other forums without any replies. Eventually I ended up submitting my own first example and of course it gets marked as resolved. Plegh!

Like a number of other beginner's to game programming, I am having a difficult time deconstructing the Microsoft examples. They always throw in the whole kitchen sink! I would like to see some very rudimentary code samples which each do one simple thing. The Digipen seminars were a good start, but how is a beginner supposed to make sense out of a game engine which is spread out over 20 pages I've found a number of sprite tutorials, but every one uses a different method, so there's no basis for comparison. Maybe I don't want textures and tranparencies. I would like to see a bunch of simple games which use nothing but trianglefans and elipses. Simple. I don't care about levels of reflection and shadows and 3D sound and particle FX, etc. I got the triangle, now show me how to make it translate. Show me Lunar Lander using nothing but a triangle and a rectangle for a landing platform, Corridor Racing Game, Husker Du, Snake, Breakout, Klax, etc. etc.

K.I.S.S.

Dillinger's list of rudimentary game examples

C# code examples I would like to see:
( Note: each of these should be a separate file. Not one big app that does everything on this list. )

Make a dot

Make dot move every time you hit the enter key using a simple loop ( event based )

1. Draw new dot each time refreshing the screen

2. Keep adding dots to existing canvas

Make a game loop which exits when you hit the Esc key

Make dot move using arrow keys

Make it so when dot exits on right side of screen it enters again on the left

Make it so dot cannot go beyond edge of screen (resizeable)

Make a square room for dot, and make dot move around at 45 degree angles and bounce off walls like in Pong

Make a rectangle paddle and make it move left and right using mouse

Add collision to paddle

Add sectors to paddle so ball rebounds different depending on which part of the paddle hits it

Make a background which scales according to window size

Make game fill screen

OK now let's think Space Invaders:
Change the paddle to a 2D sprite of a spaceship

Change the dot to 2D animated sprite monster
1. Normal
2. with transparency
3. with alpha

1. Using a sequence of images
2. Using one image with multiple frames

Make ship move using Keyboard arrows

Make the ship fire dots every time you click the mouse or hit the spacebar

Make it so when dot hit's monster, it adds a point to score displayed on screen

Make monster display an explosion graphic and disappear when hit

Make a scrolling background

Now think Pac Man:

Player has 3 lives. Every time a monster touches player, the game halts and you have to start over. After 3 fails, display the end screen with final score and give the option to play again.

Now, make level 1 with 1 monster, level 2 has 2 monsters, level 3 etc...

each time you complete a level you get a congratulations screen.

Add sounds. Exploding monster, firing gun, looping soundtrack.

Create a high scores list. Allow user to enter their name if they make the top 10.

Show how to simulate 3D Z perspective using scaling

How to make vector sprites

Now let's think 3D:

Make a cube

1. Rotate cube in x or y using mouse

2. Rotate camera around cube using mouse

Make a 3D room with the camera positioned above the room looking down.

Add textures to walls.

Add tiled texture to floor.

Add a teapot and apply a generic color

Now think Tanks:

Make the teapot rotate using the left and right arrow keys and move forward using the up arrow key.

Make the teapot fire a ball when you hit a mouse button or hit the space bar

Create explosion effect when ball hits wall or object.

Draw graphic on wall where ball hits.

Add parabolic curve to ball trajectory to simulate gravity.

Add colored cube Ammo Pickup and give the teapot an Ammo Limit.

Make pickups appear periodically in random locations.

Add assorted color obstacles using various DirectX primitives.

Basic AI

Make a colored cone with the point facing forward to indicate the front.

Make the cone a zombie: randomly wandering about, bumping into walls.
Make a different color zombie. This one still wanders aimlessly, but avoids walls and obstacles.

Make another color cone which follows you wherever you go.

Make another color cone which will follow you only if you are within it's field of vision.

Make another which will only attack if you are within a certain range.

Make an enemy that shoots back at you.

Make enemies which will spawn duplicates of themselves if you don't shoot them within a certain amount of time.

Replace teapot with mesh model

Make model play an animation when moving forward / shooting

Make the camera follow the model

Make objects which get between camera and model transparent

Make option to switch between First Person and camera views

Show how to do billiard ball collision with 2 elipses

I want it all! Is that too much to ask
Seriously. I know this is all incredibly simple for somebody out there. If you see something on this list that you know how to do and can submit just 1 sample, that would help a lot.

Thanks




Answer this question

C# Game Examples I would like to see....

  • svip

    Thanks for your comments,
    I totally understand why you might be irritated. There is only one reason I used the Xilath base framework for the tutorials. For beginners everything can be found in engine.cs and beginners don't have to worry about the device initialization everytime and I thought that by using the engine we could seperate the topic at hand from the ugly things like Device creation etc.

    I also thought that by including things like camera code and other base classes that if a developer wishes he/she can look at how an engine is put together in a very logical manner.

    It's difficult to satisfy everyone and I value your comments. I will have a look at maybe doing something about the tutorials.

    Thank you for your comments once again.



  • uTILLIty

    Well, I don't know if it would be much help, but I've just added a simple sample on movement yesterday on our MDX site which moves about a point around the screen and does some very basic collision detection to see if it reached its target location. It's the second sample on this page:

    http://www.mdxinfo.com/resources.php view=Basic%20samples

    Hope this helps :)



  • HBN

    Shameless plug here, I do a lot of what you suggest in my book, Beginning .NET Game Programming in C#: http://www.apress.com/book/bookDisplay.html bID=324

    You can also find similar approaches in other books, like Tom Miller's Beginning 3D Game Programming: http://www.informit.com/bookstore/product.asp isbn=0672326612&aid=4fb68c89-9ff9-4014-b989-e66b786b67aa&rl=1

    You can also look at some of the tutorials on Gamedev.net or at c-unit.com (not to mention many other places).



  • JohnFlemming

    Thanks Rim,

    I found your site to be quite helpful. Your tutorials are well written and your code is pristine.

    However all your tutorials are loaded with extraeneous code. You are using a big all-in-wonder engine. I couldn't even load this one. My compiler was unable to link to the plethora of files associated with it, beginning with AssemblyInfo.cs, mutmisc, Security Permissions, etc...
    I tried re-adding them as references but, no go. I'm also on Windows 2000 using .Net 1.1 and DirectX 9, so backwards compatability is key.

    Seriously Rim, I see no reason why a simple tutorial showing how to move a dot from point A to Point B should take up 16 pages.

    For instance, your Draw a Triangle tutorial also contains camera movement. If you're just getting started, this is a wealth of unnecessary, confusing code.

    There are a number of other tutorials with the same problem: They all start out with an empty DirectX shell, then Draw a Triangle, then around Lesson 4 or so, they tack on a huge multi page engine and from then on, nothing works.

    Don't get me wrong. Keep up the good work. You're a good writer, but I think you need to trim the fat on your code examples so they only contain the code relevant to the tutorial at hand.

    Thanks



  • anydobbo

    OK, here's what I've got so far:
    As far as I could tell, there is no method to make a dot in C#. The best I could come up with is you make a rectangle which is 1 X 1. Or draw a line 1 point long.

    using System;
    using System.Drawing;
    using System.Windows.Forms;

    namespace Draw_Dot
    {

    public partial class DrawDot : Form
    {
    static void Main()
    {
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    Application.Run(new DrawDot());
    }

    protected override void OnPaint(PaintEventArgs pe)
    {
    Rectangle rect = new Rectangle(50, 30, 1, 1);
    SolidBrush lBrush = new SolidBrush(Color.Black);
    pe.Graphics.FillRectangle(lBrush, rect);
    }
    }
    }



  • miauru

    Actually I just found out about your book earlier today. I will more than likely blow the bucks, but I wanted to see what I could milk off the always free internet first.

    I disagree with your reasoning that this is a comment. There are at least 30 questions on this post, beginning most notably with "How do I get the #%*&^%$#! Triangle to move "



  • Slesh

    We've thought about this too and recognize the need for simple tutorials. The problem is, we wanted to work out the tutorials in a simple consistent framework, so Pieter (the author of our basic tutorials) fixed up a basic engine to demonstrate how things could be done, to get into 3D app design right away, rather than showing the bare basics and forcing people to reaquaint themselves with more advanced methods later... At least I think that's what he had in mind, so you'd have to take this up with him

    The samples I wrote on the other hand use the SDK's sample framework to get things done quickly. I tried to hide as much of the framework related code in #regions, but unfortunately it indeed still has to compile and link those files. The sample framework does take some getting into, but once you're accustomed to the structure it should be quite clear what's going on. More information on the sample framework can be found in the Managed SDK docs, under DX SDK -> Introducing DX9 -> Direct3D Graphics -> Sample framework.

    As I said, we've investigated this and it might be useful to use partial classes to trim the 'meat' of the code from the 'fat' of the engine, but those are a .NET 2.0 feature so it's a difficult choice. And finally, the compile problem doesn't sound familiar. I did have some probs with switching to VS2005, but on VS2003 and .NET1.1 you should be out of the woods. If you could supply some more info, that'd be great (preferrably on the mdxinfo feedback address).

    *pfew* Hope that answers some of your questions, thanks for the feedback



  • C# Game Examples I would like to see....