Archived

This topic is now archived and is closed to further replies.

How to write a game

This topic is 5505 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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++.


Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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 ...

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
I just wanted to comment on the fact that I tried for two years to feed an appetite of wanting to write the "big" one. I thought "screw the small stuff, I''ll wait for the big one".

Do build small. I wasted 2 years (well, not totally wasted, but close enough) trying to write a RPG. It was pretty bad. Failure followed by another failure. I almost quit (you fail enough, you get there), then decided to start easy. I''m currently working on breakout and going to progress slowly from there. Don''t waste your time doing alot of big stuff up front. It will come.

Good luck.

Much greatness is achieved thru perseverance and faith.

Share this post


Link to post
Share on other sites
quote:
Original post by crazemanx
thats a nice little game there

Thanks, so it was an hour well spend then

Anyone noticed the bug?
BTW sorry for the link not working for some time - the server was down but it should work now.
If anyone is interested I could also post the GBA version with some nice GFX and - eh - a _little_ more than 328 lines and _lots_ of ''complicated stuff'' in it

cheers,
patrick

Share this post


Link to post
Share on other sites
quote:
Original post by Paladin__
Do build small. I wasted 2 years (well, not totally wasted, but close enough) trying to write a RPG. It was pretty bad. Failure followed by another failure. I almost quit (you fail enough, you get there), then decided to start easy.


quote:
Much greatness is achieved thru perseverance and faith.


Please don''t consider this a derogatory post or flame of any type, but I just find it ironic (and a bit humorous) that you spent two years building an RPG and effectively gave up while your sig clearly says that perseverance and faith are the keys to success.

RapscallionGL - arriving soon.

Share this post


Link to post
Share on other sites
I think the basic point is, don''t bite off more than you can chew. I''ve done this on many occations, and I think I''ve only really "finished" about 5 of the dozens of projects I''ve started over the years.

The most important thing when starting out is to learn good programming techniques. That way, when you get to building more complicated projects, you can use more elegant, easier techniques rather than brute-force coding.

Object-oriented development is very important to learn. I would start with a good, basic C++ book, and start with coding pure console stuff, until you have that down.

It''s amazing how easily new concepts like DirectX come when you''re building on a solid foundation.

Share this post


Link to post
Share on other sites
quote:
Original post by dcgeek
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.



First of all, visit cone3d.gamedev.net to learn how to use SDL with Dev-C++. As for how to code a small game, try to figure it out on your own first, that way you''ll really feel like you''ve achieved something. If we just give you the answer, you won''t learn anything...




[Cyberdrek | the last true sorcerer | Spirit Mage - mutedfaith.com]

Share this post


Link to post
Share on other sites