My first game project

Started by
12 comments, last by counterrabbit 18 years, 8 months ago
If you only have basis knowledge in c++ ( or the other language ) i wouldn't try to make a tetris game. This game is not that easy to do when it's your first game you code. I'm coding Tetris atm ( and just made Pong before ) and it's a really good chalenge :)

You should try something basic like Pong, with SDL ( An Api ) There is some nice tutorials on that API that you could learn a lot. If you choose to use that API, tell, and i will post you some link to tutorials to get you started.
Advertisement
If you dont mind digging a bit into old stuff, then you could try a bit of DOS game programming using Mode 13 h.It's a very simple mode which lets you set up a screen of 320x200 pixels and you have 256 colors.

It's the most basic mode you can get and all the basic principles of rasterization (drawing), buffering etc can be done pure and simple via you own code.There's no compilcated API required for this.The code for getting into and out of the mode is just about 10-15 lines.


You get direct access to the video memory and it's arranged as a single dimentional char array.You can change the color of each pixel by setting it to a value from 0 to 255. ;)

256-Color VGA Programming in C One of the best.

Disadvantages: Only that you will need to fiddle a bit with the setting of your compiler to set it to compile in large memory mode.BUT if you are using DJGPP then it's easy as pie and there's no need to change any settings.


There's something similar, under the windows platfrom called TinyPTC
Quote:
TinyPTC is a low level graphics library for software rendering in 32 bit color.

TinyPTC is simple, fast and easy to use - There are only three functions! "open" creates the display, "update" copies your pixels to the screen, and "close" shuts down. Could it possibly be any easier to use?

TinyPTC supports C, C++ and Java and has optimized assembler blitting routines for computers that support x86/MMX. Best of all it comes with full source code under a liberal open source licence.


http://www.gaffer.scene.org/tinyptc/ (Look at the bottom in the Download section )

This too gives you access to a single dimentional array like mode 13 h but you use 32bit colors and you will have to do all rest by yourself just like in mode13h.Yeeha, it's really cool and the best if you have VisualC++.

Best of luck ;).

The beggining will be very hard

______________________________________________________________________________________________________
[AirBash.com]
To be honest, I wouldn't listen to my prof if he told me to develop games in DOS.

1) DOS, welcome to 1994. I think somewhere around that time, the last version of DOS was released. That's over 11 years ago.

2) Programming games under DOS is *HARD*. There is no graphical API for you to manage some sort of layering between the videocard and your come. You need to write all your interfacing code yourself, interfacing on an extremely low level with your computer.

3) Under Windows/Linux, you could just use OpenGL and draw with that. Sure, you need to do some sort of management to load models and textures, but it's 50 times better than writing your own low-level blit function with transparancy and clipping.

4) Windows/Linux comes with a bunch of drivers for sound, graphics, etc. Under DOS, you're probably stuck to a small set of videocards, because each card likes to be addressed differently. So you either have to acquire over 20 libraries to play sound for you game on different computers, you also except people to remember their IRQ/DMA channels and have a card that still supports DOS.

I'd go with OpenGL if I were you, and still make that racing game. Or just go with tetris. Tetris is actually pretty easy to make, because:

- You have a field that's 8x20 big(Or something along those lines, can't remember)
- You have a small set of different blocks
- Collision detection is extremely easy, because you just check if the block below the current block is used(Or the sides, if you're moving the piece sidewards)

Now, a basic game, looks like(Some C# code, I bet you can translate it into Java/C++ yourself without help):
GameEngine game = new GameEngine();game.InitalizeGraphics();while (game.IsRunning){    game.Update();    game.Render();}game.Dispose(); // Get rid of the object


Inside the Update and Render functions, you either update all your entities, or draw them.

public void Update(){    float deltaTime = timer.TimeElapsed; // We call this one every frame. It tells us how much time has passed since we called this function for the last time. If it returns 0.25f, we know 250ms passed.    // We pass along our playing field to our block. The block then checks it's position against the playfield. If it's in such a position it can't move, we weld the block into the playing field, otherwise we update it    if (!block.DetectCollission(playField))        block.Update(deltaTime);    else        WeldBlock(block);        // Check for keypresses    if (keyPresses.KeyLeft == true)        block.MoveLeft(playField);    if (keyPresses.KeyRight == true)        block.MoveRight(playField);    if (keyPresses.KeyDown == true)        block.MoveDown(playField);}


I hope this got you started. If not, check out the tetris clone on my website. I released it's source code, although it's written in C++ and DirectDraw

If you really are that new i wouldnt even bother with tetris, start by doing some simple console apps that for example simulate a simple betting game like black jack or some other hight or lower evaluating game.

If you do want to throew yourself into the deep end so to speak then get used to an APi that deals with graphics, opengl and directx being the obvious choices.

the bottom line tho is that game development isnt at all easy and does take quite a long time (depending on ur level of skill, if this is high then you should have stuff working and playable in no time).

for me im quite slow at learning all this stuff and it does take me a while to get used to a lot of the algrithms and code segments . . .the bottom line i suppose it to crack at it but for me learning tetris if you are so new is not the way to go as tetris is indeed quitye complicaqted, people get confused with the simplicity of the GAME but have no idea thwe complexitys of the code of the game. if you are totaly new to windows programming for example, just setting up a window and the d3d device is a little complicated and a lot to take in at first. feel free to pm me if you are that stuck and i could possible tell you what you should be looking at to further improve ur skills, saying that tho, im by no means a fantastic programmer myself but i try . . laters

This topic is closed to new replies.

Advertisement