Advertisement

How to write a game

Started by November 20, 2002 04:24 AM
14 comments, last by dcgeek 21 years, 11 months ago
I''m new to game programming, so therefore: Where can I find a simple tutorial about how to write a game like pacman and/or ping pong, with simple graphics (NOT using SDL, can''t use SDL in Dev-C++). It have to be a tutorial about game programming in both console mode and Win32 API.
Look here : http://www.gamedev.net/reference/start_here/
"...and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces."----------Scott Meyers, "Effective C++"
Advertisement
Your best bet is to start small. A tutorial might help you learn new programming techniques, but it''ll mostly be gibberish if you''ve never touched C/C++ before.

However, I''m assuming you''re at least familiar with the basics of programming in C/C++, juging from your post. You might want to look for some open-source games to examine the code. That''s a pretty good way to learn if you don''t want to have a tutorial leading you around by the hand.
quote: Original post by dcgeek
(NOT using SDL, can''t use SDL in Dev-C++).


Why can''t you use SDL with Dev-C++? Works fine for me...



"Discipline is never an end itself, only a means to an end." - Robert Fripp
"Discipline is never an end itself, only a means to an end." - Robert Fripp
[Not helpful, -5]

[edited by - michalson on November 20, 2002 11:18:15 AM]
SDL works in Dev-Cpp for me, perhaps you didn''t installed it properly or something. It took me about 5 days to get it to work but it is fine now.
Advertisement
All the other articles at http://www.gamedev.net/reference/start_here/ is only for making
games in DirectX. I want to write games using OpenGL (in 2D), because i don''t want to use so much time to download the DirectX SDK, and i''ve already learned how to setup and use OpenGL in C++.


I''d recommend GLUT as a nice way to cope with all the initialization/windowing BS you have to deal with using OGL.
It also helps making your code portable (e.g. your programs will
compile fine under most OS that GLUT was ported to).

It also helps you focussing on the GAME code, not how to set up a window,render context, message loop and stuff like that.

As for your tutorial questions - yesterday I''ve written a nice little Tetr*s clone for console mode. It just uses five CRT
(C-runtime library) functions (namely _kbhit(), _getch(), printf(), system(), and clock()) and is about 300 lines of code.

I understand that it''s very hard to find a good start in writing games - you only find little pieces you need here and there.
I also miss a _complete_ tutorial that just assumes a little knowlegde in C/BASIC/whatever (e.g. my Tetr*s doesn''t use any pointers, structs or other rather ''complicated'' things) and presents how to actually put all the little pieces together to
make a little game.

Once you''ve _finished_ one (small) game, you will at least most probably know where to start the next time.

I''d send you the code, but it''s uncommented (just a quick hack) and a very good example of how not to write good code - but on the other hand: it works without any errors.

Is there any complete -how-to-write-a-simple-xy-clone- tutorial on gamedev? If not I might consider revising my crappy little program and writing one...

actually if you look in Forums you''ll see that Teej wrote a Tetr*s tutorial but with "complicated stuff". I would like to see your Tetr*s code though. Without pointers, structs... and 300 lines of code, sounds impressive, but what do I know ...

Beginner in Game Development?  Read here. And read here.

 

Unfortunatly "search" is disabled so...
Actually I cheated a bit - the code is exactly 328 lines

Feel free to download it: Here

But be warned the code is - as mentioned above - undocumented and far from being 'clean'. It compiles fine under Windows and should (if the system()-call is changed to system("clear")) work on Unix/Linux platforms as well. It uses parts of the C++ STL
now instead of some for-loops and printf(), but imo that's not much of a difference.

Have fun,
Patrick


typo...

[edited by - darookie on November 21, 2002 1:34:14 PM]

This topic is closed to new replies.

Advertisement