#### Archived

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

# very frustrated! trying to make a game

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

## Recommended Posts

OK, I do know how to program in C++. Understanding pointers, classes, arrays, etc. is not my problem here. The problem is I haven''t been able to program a game after looking for over a year for articles on the internet and even after buying a few books. I tried the Direct Draw tutorial on gamedev.net (compiling with Visual C++ .net) and came out with a bunch of errors that I couldn''t fix. I have bought a few books including tricks of the windows game programming gurus. I have looked for tutorials on the internet including directx tutorials and even djgpp and allegro. Allegro code looked quite simple but I can''t build allegro! I just want to program simple 2d games but I can''t find any programming package that will work AND has adequate documentation on the internet. I am VERY frustrated with TRYING and TRYING and TRYING and NEVER getting ANYWHERE! Someone suggested that I learn Direct 3D instead of direct draw so I ordered an ebook version of a 3D game programming with direct X book that is supposed to be very good. I have only gotten this book as a last resort, thinking that I''ll be able to program my 2d games in direct 3d. Why isn''t there adequate documentation on the internet for Visual C++ .NET and Direct Draw? Why can''t I find a graphics game programming library that has clear complete explainations, and why is there such a LACK of complete source code for the environment that I''m working with? I have visual studio .net academic edition but I DONT want to program my games in visual basic because I much prefer visual c++. I would be willing to try some visual c# programming if that''s what I need to do to get a game going. I did program a game in C++ about 7 years ago using Borland C++ Builder and a game programming package but that''s an old compiler, I don''t want to use it, and I don''t know where to get that package. In fact, if I would want to program a game today the only type of game I am actually able to program is a java applet - but what I really want to do is a full screen game using Visual C++ (or C#) .net Is there anyone out there who has some simple complete code like a pong game or something that will work in visual c++/c# .net?

##### Share on other sites
It seems to me that you''re trying to swallow the whole hog here instead of taking it in bites. What I would suggest is to start by figuring out the pieces that your game is going to need (ie, keyboard control, mouse control, drawing, physics, etc) and start evaluating each piece one by one. Just seeing someone else''s code isn''t going to make you understand how to make a game, only taking a calm and rational approach will.

Now, what I would suggest is that you check out www.libsdl.org, as SDL can do all sorts of things for you very, very easily (and its crossplatform, if you care about that sort of thing). Check it out and I think you''ll be pleased with what it can do to help you get started.

P.S. I''m pretty sure that Direct Draw is depreciated (though I''m not entirely positive of this as I don''t code with DX), which might be why you''re having problems finding information on it.

Good luck!

##### Share on other sites
First of all, what type of errors were you getting when you tried to compile those DirectX examples? Chances are that they were the ever common linker errors. To correct them you need to include the appropriate DirectX library files into your project (i.e. ddraw.lib and dxguid.lib) and add a path in the compiler settings that points to the library files directory.

##### Share on other sites
The DirectX Forum FAQ will hopefully answer your DirectX questions. (If not, please tell me - it means I need to add/change the FAQ.)

The other thing it sounds like you need to do is really learn how to use your compiler/linker. If you do that, then "I can''t get it to build" is unlikely to present you with further problems - you''ll stand a better chance if you can understand the errors and know how to fix them.

##### Share on other sites
Step 1, compile a "hello world" as a console app

Step 2, compile a "hello windows" basic game loop
GameLoop1.cpp | EXE

Step 3, compile a "hello directdraw" basic full screen app
DirectDrawDemo.cpp | EXE

Steps 4 through 99 involves adding to step 3 until you have a side-scroller like Super Mario.

Step 17, a side-scroll demo
Megaman4.cpp | EXE

Make sure you understand what each part of your code does, make sure you are adding the DX SDK at top of your paths, make sure you are adding ddraw.lib to your Visual C libraries (assuming you want to stick with ddraw).

Phil P

##### Share on other sites
Okay, I've made a successful directdraw screen setup before, but
couldn't get past simply opening the graphics mode (i.e. - I
haven't yet gotten to drawing animations on the screen). I will take
this bit by bit of course, but I did scan the megaman code
and I am wondering something.
First of all, I need to know what's in the megaman4.h file -
and second - where is the code going to look for the bmp files?
In megaman4.h? What should be in the header file, and how do
I link the bitmaps to the source?

[edited by - jimiwa on April 11, 2004 5:49:24 PM]

##### Share on other sites
I''ll try to answer them tonight by giving you Megaman4.h

My issue is always "what is the BARE MINIMUM I need to make something work?" So I always use straight C, and do the minimum required for set up. I use global variables like crazy (so very little passing variables to functions required).

All my .h files contain the .bmp or .wav file names, with the resource number. Its the bare minimum you need to add resources (such as .bmp for graphics or .wav for sounds compiled inside the EXE itself).

A little about me: I knew nothing of Windows programming just a little over a year ago. Didn''t know how to go full screen, didn''t know how to plot a point. Knew nothing of graphics in Win32. In a year I made BreakOut, Asteroids, Pacman, and now working on a side-scroller.

You can do it if you know C or C++. My advantage is I''ve been programming since I was about 14 and I''m 38 now. I was "out of it" for most of the 1990s so trying to catch up. Full source for my GDI games (minus .h and resources) here

VazGames.com

Phil P

##### Share on other sites
Forgot to mention: you''ll need a .h and a .rc file. As in Megaman4.h and Megaman4.rc, I''ll put those here tonight. I understand Visual C can make the .rc for you, but I do them by hand in a plain text editor (TextPad).

Then in your Visual C, if I remember right, on the left where it says "resources" you right click on that folder, and do "add resource" and click on the file you created called Megaman4.rc (or whatever) and like magic all your .bmp and .wav files are added and will be compiled within the EXE the next time you do a full compile.

But unfortunately you will keep getting the same error that says "missing main()" since you are trying to compile as a console app not a Win32 app! Just kidding.

This was all new to me a year ago, so you can do it.

Phil P

##### Share on other sites
Try SDL, my friend...

If you can''t seem to get that working, then I suggest you take a breather from trying to be a gamer, focus on school, homework, etc and come back to it in a year or so...

Regards,
Jeff

##### Share on other sites
If you have sufficient general programming skills then why won''t you just join any game developing team? At least you would not *be frustrated* alone.

##### Share on other sites
Hmm, sounds to me you''re not yet ready, despite saying otherwise.

It''s best to take things step by step. If you''ve never written any non-game programs in C/C++, or don''t know how the majority of your compiler''s design works out (ie, having a hard time setting up DirectX), you might want to look into correcting those problems instead of moving on to something else. These problems pile up after a while.

My personal recommandation is to get started with the Windows GDI. It''s pretty simple, there''s a lot of docs on it, and you should be able to get something up and running pretty fast. Game? Not as your first project. Forget about games for now. Code a spiffy little graphic demo: something that loads a bitmap and moves it around. It doesn''t matter how lame it is, once your program can do that, you''ll know the basics of Windows programming: message pump, how bitmaps are handled, etc..

Then try the classic Tetris clone. Check the tutorial on the boards; really good way to get into this.

Then move on to SDL. Really easy to use, but you''ll need a little bit of experience before being able to just jump right into it and start working on a game.

Good luck! And remember, programming isn''t something you can just do overnight. A serious game project could take a few months, if not a year or so.

##### Share on other sites
I completely agree with RuneLancer, it sounds like you''re "trying to run before you can walk". Take things one step at a time maybe try the Windows GDI instead like RuneLancer says its a little less complicated.

##### Share on other sites
Here is my .h and .rc in case you want them

You'll have to supply the .bmp, I turned a megaman gif animation into a series of 24-bit bmp files

Also you'll need ddutil.h | ddutil.cpp for DDLoadBitmap

Megaman4.h

// Megaman4.h by PhilVaz// Mar 8, 2004// HEADER FILE ///////////////////////////////////////////////// BITMAPS#define BMP_MEG00    100#define BMP_MEG01    101#define BMP_MEG02    102#define BMP_MEG03    103#define BMP_MEG04    104#define BMP_MEG05    105#define BMP_MEG06    106#define BMP_MEG07    107#define BMP_MEG08    108#define BMP_MEG09    109#define BMP_MEG10    110#define BMP_MEG11    111#define BMP_MEG12    112#define BMP_MEG13    113#define BMP_MEG14    114#define BMP_MEG15    115#define BMP_MEG16    116#define BMP_MEG17    117#define BMP_MEG18    118#define BMP_MEG19    119#define BMP_SKY      200#define BMP_CLOUD    201#define BMP_HILL     202#define BMP_GROUND   203

Megaman4.rc

   // Megaman4.rc by PhilVaz// Mar 8, 2004// RESOURCE FILE ///////////////////////////////////////////////#include "Megaman4.h"// BMPBMP_MEG00  BITMAP  "MEG00.bmp"BMP_MEG01  BITMAP  "MEG01.bmp"BMP_MEG02  BITMAP  "MEG02.bmp"BMP_MEG03  BITMAP  "MEG03.bmp"BMP_MEG04  BITMAP  "MEG04.bmp"BMP_MEG05  BITMAP  "MEG05.bmp"BMP_MEG06  BITMAP  "MEG06.bmp"BMP_MEG07  BITMAP  "MEG07.bmp"BMP_MEG08  BITMAP  "MEG08.bmp"BMP_MEG09  BITMAP  "MEG09.bmp"BMP_MEG10  BITMAP  "MEG10.bmp"BMP_MEG11  BITMAP  "MEG11.bmp"BMP_MEG12  BITMAP  "MEG12.bmp"BMP_MEG13  BITMAP  "MEG13.bmp"BMP_MEG14  BITMAP  "MEG14.bmp"BMP_MEG15  BITMAP  "MEG15.bmp"BMP_MEG16  BITMAP  "MEG16.bmp"BMP_MEG17  BITMAP  "MEG17.bmp"BMP_MEG18  BITMAP  "MEG18.bmp"BMP_MEG19  BITMAP  "MEG19.bmp"BMP_SKY    BITMAP  "SKY.bmp"BMP_CLOUD  BITMAP  "CLOUD.bmp"BMP_HILL   BITMAP  "HILL.bmp"BMP_GROUND BITMAP  "GROUND.bmp"

[edited by - PhilVaz on April 11, 2004 7:36:52 PM]