Sign in to follow this  
Twiggy

Highschool student starting work on a project and seeking info, please help!

Recommended Posts

Hello to you, my new GameDev friends. I'm a senior highschool student, and I have a yearly project to build and hand in on May, and Iv'e decided I'll be creating a 2D Strategy (Something like old and good Warcraft) using basic AI. After talking to knowledgable friends, I've decided that the things I need to learn are: Win32 API DirectDraw - [For average, acceptable graphics] Creating RTS (Tile-Based) engines and games AI for this game Currently, after searching GameDev and the net, I've only found articles concerning DirectDraw and not so helpful tile-based articles (but I think it's just me that's not understanding how to build an engine for an RTS 2D game). I would really appreciate if you would post a link to articles having more information, especially conerncing Win32 API (I was told that it would be better to learn the Win32 API before getting over on DirectDraw). I would also really be thankful if you would post any suggestions on the project. i.e. if I chose a too much complicated and long project for a half-a-year deadline, or if I'm learning stuff I don't need, or if there are better stuff to learn that would be useful in my project, or additional stuff I need in order to build it, etc. These are my grades, folks, any help would be really, really groovy here, thanks! :) P.S. I do not have the time or money to spend on books concerning the above subjects or others, I really have to start working seriously on my game. So online articles would be a lot more helpful than Amazon-Books links and such.

Share this post


Link to post
Share on other sites
Hi Twiggy,

Search for Direct3D rather then DirectDraw. I personally enjoy using OpenGL more then Direct3D. I'm not trying to start a API-War here or anything, I just find it easier. All you need to do to get some pretty going is:

  1. Download Dev-CPP (with Mingw/GCC)
  2. Install the SDL/OpenGL DevPack by going to Tools->Check for Updates/Packages. Choose the devpaks.org mirror. Click "Check For Updates", find the SDL package and install it.
  3. Start a new SDL&GL project (File->New Project. Multimedia, SDL&GL)
  4. Save Project As...
  5. Copy SDL.DLL from the DLL's folder in the DevCPP directory to your project location.
  6. Press F9 to compile and run.

Share this post


Link to post
Share on other sites
IMHO learning the (legacy) Win32 API is a waste.
All you need is to get familiar with some higher level library like
SDL.
You can then jump directly into the AI, UI and other game related areas.

On the above site are tons of links to tutorials and documentation, so I think it's a very good start. Using SDL also offers some cross-platform abilities, which is good because your game will be available on many platforms without much porting-related hassle.

Good luck with your game,
Pat.

Share this post


Link to post
Share on other sites
I think one thing the above two posters are trying to tell you is...don't reinvent the wheel. No reason to use DirectDraw or Win32 API when SDL is sofa king great.

I'll look up some articles about RTS AI (I had a very nice one bookmarked, but it seems to have disappeared) and edit this post.

What do you already know, by the way? If you have to learn all of these things, you're going to be hard-pressed to do it AND make something decent out of it in 6 months.

I won't say that you can't do it, but you'll probably want to get started before you finish reading this post.

Have you started yet? You should already have a window set up by now! SLOW POKE!

...[lol]

Share this post


Link to post
Share on other sites
OK Guys, first of all, we are given these compilers to work freely on: Borland ol' compiler (the blue screen thingy) and Visual Studio 6 C++ and Basic, so I presume using the VC 6 is better instead of DEV C++ right? If not, please tell me.

Btw, they were legally purchased. :) (I'm a FAQ reader, sue me)

My current education is Pascal, C, and above basic programming education like using recursions and binary trees.

In addition to these stuff I'm learning C++ just becase i KNOW it will greatly help me on the project. I'll just be finishing volume 1 of Eckel's book if anyone knows of. best C++ tutorial ever known of by me.

So what you say is that I abandon the Win32 API and DirectDraw and just get to know the SDL?

And to the last dude - we've started our work on september, and what i've already done was setting the basic map tiles on ah single header (on memory - you know.. - creating a huge list of tile-types [instead of a huge array map tile, takes less memory. I'm also efficient :)]) We have 10 academic hours (45 minutes) to work on it weekly on school, and this is not including the time i can spend on it freely at home, using these LEGAL compilers they're giving us. :)

This is no joke btw, they ARE legal.

The thing is is that i thought i would make my game on dos and then decided that it is not such a good idea, because i need high resolution and bitmaps. So the mouse header and a bit of graphics (lousy window borders, i'm no SLOW POKE!) i made won't be much of a use in the future i presume. :)

The only thing that will be usuable is the map header, which is not that finished. That's why i need some good 2d rts tutorials btw. :)

Oh btw, please answer all the issues here when you're answering. people tend only to answer the last. this is just a reminder. thank you!

Share this post


Link to post
Share on other sites
Quote:

(I'm a FAQ reader, sue me)


We hate it when people dont read the FAQs and other provided information, so we're hardly likely to sue you for behaving in the desired fashion. [wink]

You'll need to put in a large amount of time and effort to succesfully complete such a project, but yes, it definately can be done. If you don't think you'll be able to complete it, a lesser goal you could work towards would be a tetris clone, but I assume from your posts that you're willing to put in what it takes for the larger, more complex project.

Be sure you have a good grip on the basics of your language before you try more advanced topics - you arent going to get anywhere otherwise. For the compiler/IDE, it's really a preference thing, but VS6 will be just fine as long as you're happy to use it.

Make sure to build your game incrementally, so that each part is functional before you add the next - this way you'll have something functional to submit if you happen to fall slightly short. Your first task (once you've passed the learning stage for all relevant techniques), should probably be to get a scrolling tilemap on screen. Next, add some units to the map, and make it so you can give them orders. Then combat for the units. Follow this with structures that can produce additional units, and perhaps some way of producing new structures. Don't get bogged down in having to many unit or building types, you need to have something working - if you have time to spare, you can always add more content and/or extra features after you're happy with the basic project. Due to time constraints, and with the assumption you wouldnt know how to implement it, it's not at all advisable to attempt to add multiplay.

Don't worry overly much about effeciency at the expense of getting things working either, there's a saying that goes "premature optimisation is the root of all evil", or something along those lines, and to an extent it's true - especially with a deadline. Make it work, then if it's too slow, find a way to speed it up - otherwise, you can get stuck on increasing the speed of a function that may not actually be time-critical anyway.

Yes, SDL would probably be a good option for you.

Anyways, just some general advice, hope it's of some help, I don't have access to my saved links atm, but I'll post again with some links to more specific information if I remember any.

Good luck, and welcome to GDnet! [smile]

Share this post


Link to post
Share on other sites
Wow, thank you all very much.
You've done a great help, and I'll really love you if you post those articles \ tutorials you're talking about.

oh and by the way, i said i can use VC 6, i just don't know if i should. I mean, what would be more comfortable \ less complicated \ more understandable - Dev C++ or VC6 ?

Share this post


Link to post
Share on other sites
Bare minimum DirectDraw and Win32 Game Loop if you want to use these. Straight C style. See demos middle of page, near the bottom.

VazGames

A bit more set up than SDL which has built in 2D graphics functions. So SDL probably easier, haven't used it yet myself.

Phil P

Share this post


Link to post
Share on other sites
Stick with VC6 if you've already started. Its a great IDE and the debugging features are very handy! If you hate VC6 then it'd be worth trying something else but I doubt you'll find anything significantly better so unless you have major issues i'd suggest just sticking with VC.

Share this post


Link to post
Share on other sites
I'd be tempted to do this in Win32 GDI only. Pros:
1) It's one less thing to learn
2) Win32 provides lots of GUI stuff so you don't have to worry about implementing them yourself
3) It's a very desirable skill - ability to write good quality editors for a game can make a huge impact on the development of the game
Cons:
1) It's not going to be as fast a pure DirectDraw version

A general rule in development is:
"make it work, then make it work fast"
So, if you are careful about your design you can, if time permits, replace the GDI rendering system with a DirectDraw system (or SDL/OpenGL/whatever).

Also, search around the internet for free tile sets - ask in the Isometric forum for any links.

Skizz

Share this post


Link to post
Share on other sites
You need a million HDC and HBITMAP objects if you're gonna write this in Win32. DO NOT USE Win32. Your timespan is very limited, so go with SDL. It doesn't have a large learning curve(Direct3D/DirectDraw/OpenGL do have larger curves then SDL).

SDL is very easy to use, there are a million articles out there, and more important, there are also alot of libraries for it. I bet someone wrote an SDL GUI library which you can use.

Toolmaker

Share this post


Link to post
Share on other sites
Yeah, i think i'll stick with SDL. I don't have the time to spend on learning Win32. I really need to get goind, and still have to learn C++ on the way.

Anywayz, please post links to articles of the things i need, if you have, please.

Share this post


Link to post
Share on other sites
Ok here is my opinion base on my experience. I think Winapi knowledge is not required, you just have to learn some simple stuff, like creating windows, working with messages etc. But still understanding and learning this would take you about 1 month of time minimum , OpenGl is another fast way to start programming games , it took me about 1 month to learn some basic things.I firstly started learning directdraw , but it is really limited , doesn't have basic functions like putpixel , rotation is slow .So direct3d or opengl is better choice. For me openGl is the simpliest and the most easy to learn.

Here is the best place to learn OpenGL -> NeHe

Share this post


Link to post
Share on other sites
Calm down Twiggy. See what you can get out of the functionality SDL provides. Whether SDL uses DirectDraw or OpenGL internally is not important - treat it as a blck-box that does the dirty work for you.

I'd *suggest* starting with a design doc for your game project. Figure out exactly what you want to achieve and try some basic functions to see how it can be done with SDL. You can still remove items from your initial design later, so don't make it too minimalistic.

A simple top-down map can be produced out of text files so you won't need any sophisticated editors for starters:

file: simplemap.txt
Simple Map
16
8
MMMMMMMMMMMMMMMM
....t.t........M
.....t..........
...t...t....M...
.............M..
................
.....======.....
....========....

In the above sample, dots ('.') are representing ground tiles (e.g. dirt or grass), t's are trees, M's are mountains and equal signs ('=') are water.
A very rudimentary map loader could look like this:

file: maploader.c

#define MAX_TILE_TYPE = 5;
#define EMPTY_TILE = 0;
#define GRASS_TILE = 1;
#define TREE_TILE = 2;
#define MOUNTAIN_TILE = 3;
#define WATER_TILE = 4;

// a tile
typedef struct __Tile {
int type; // ground, water, mountain, tree
int unit; // type of the unit that is on this tile
SDL_Surface *image; // tile image - will be setup seperately
} Tile;

// a very basic map structure
typedef struct __Map {
char name[32];
int width;
int height;
Tile **tiles;
};

// images for all tiles (tile 0 is an empty tile)
SDL_Surface *tileImages[MAX_TILE_TYPE];

// load tile images (path is optional, e.g. different tile sets)
int LoadTileImages(const char *path) {
char tileName[256];
int i, loaded = 0;
for (i = 0; i < MAX_TILE_TYPE; ++i) {
if (path == 0)
sprintf(tileName, "tile%02i.bmp", i);
else
snprintf(tileName, sizeof(tileName), "%s/tile%02i.bmp", path, i);
timeImages[i] = IMG_Load(tileName);
if (timeImages[i] != 0) ++loaded;
}
return loaded;
}

// delete a loaded tile set
void DeleteTileImages(void) {
int i;
for (i = 0; i < MAX_TILE_TYPE; ++i) {
if (tileImages[i] != 0) {
SDL_FreeSurface(tileImages[i]);
tileImages[i] = 0;
}
}
}

// evaluate tile symbols and return an image from the array
SDL_Surface *GetImageForTile(int type) {
switch (type) {
case '.': return tileImages[GRASS_TILE];
case 't': return tileImages[TREE_TILE];
case 'M': return tileImages[MOUNTAIN_TILE];
case '=': return tileImages[WATER_TILE];
default: return tileImages[EMPTY_TILE];
}
}

void DeleteMap(Map **map) {
if (map != 0 && *map) {
if ((*map)->tiles != 0) {
int i;
for (i = 0; i < (*map)->height; ++i) {
free((*map)->tiles[i]);
}
free((*map)->tiles);
}
free((*map));
// set the variable to null
*map = 0;
}
}

Map *LoadMap(const char *fileName) {
Map *map = 0;
char line[128];

FILE *file = fopen(fileName, "r");

if (file != 0) {
// this variable tracks errors
int error = 0;
int i;
// create map if file reads ok.
map = (Map*)malloc(sizeof(Map));

while (true) {
// read the map name
if (0 != fgets(line, sizeof(line), file)) {
strncpy(map->name, line, sizeof(map->name));
} else { error = 1; break; }
// first comes width
if (0 != fgets(line, sizeof(line), file)) {
map->width = atoi(line);
} else { error = 1; break; }
// next line is height
if (0 != fgets(line, sizeof(line), file)) {
map->width = atoi(line);
} else { error = 1; break; }
// now allocate and clear the tiles
map->tiles = (Tile**)malloc(map->height);
for (i = 0; i < map->height; ++i) {
map->tiles[i] = (Tile*)malloc(map->width);
memset(map->tiles[i], 0, map->width * sizeof(Tile));
}
// read all rows
for (i = 0; i < map->height && error == 0; ++i) {
if (0 != fgets(line, sizeof(line), file)) {
int j;
// line is too short
if (strlen(line) < map->width) {
error = 1;
break;
}
for (j = 0; j < map->width; ++j) {
map->tiles[i][j].type = line[j];
}
} else { error == 1; }
}
break;
}
fclose(file);
if (error != 0) {
DeleteMap(&map);
}
}
return map;
}

// apply the currently loaded tile set to a map
int SetTileImages(Map *map) {
int i, j;
// error if the map is invalid
if (map == 0 || map->tiles == 0) {
return -1;
}

for (i = 0; i < map->height; ++i) {
for (j = 0; j < map->width; ++j) {
map->tiles[i][j].image = GetImageForTile(map->tiles[i][j].type);
}
}
}

// sample usage:

int loaded;
Map *map;

// first load all tiles
loaded = LoadTileImages(0);
// now load a map
map = LoadMap("simplemap.txt");
SetTileImages(map);

if (map == 0) abort();

PlayGame(map);

DeleteMap(&map);
DeleteTileImages();

// or something like that - you get the idea, I hope :)



More ideas include overlays, smooth scrolling, animated tiles a.s.o. but this should be considered when the rest (loading and rendering a map) is working.

Hope this helps a little,
Pat.

[edit]Forgot a function in the sample source code.[/edit]

Share this post


Link to post
Share on other sites
At the risk of being flamed by my peers, C++ is a very difficult language to learn, especially if you haven't cut your teeth on another language or three first. Your project time-line may be too short to be blundering through learning C++ while you try to learn everything else.

C++ is my favorite language for writing graphics/game code, but C is like a high-level language without safety belts (it's like a cross between Pascal and assembler), and C++ is C with object orientation grafted onto it (which tends to make its implementation less clean than other object-oriented languages). Without a strong foundation in C, especially where pointers and memory allocation come into play, your program will have an awful lot of very hard-to-fix bugs in it. Without a strong foundation in the C++ extensions on top of C, you will encounter even more bugs due to some of the subtle nuances of things like copy constructors.

And if you use the Standard Template Library (STL), which I would recommend if you're using C++, you also need to have some degree of familiarity with C++ templates. Templates are powerful, but the syntax and some of the implementation details are horrendous. Rarely in my life have I seen messier-looking code or more obscure warnings and error messages. Using them across libraries (DLL's) doesn't always work well, and I've seen the debugger do some strange things with them.

I really hate to say this without giving a clear alternative, but I'm not sure that there is one. VB just plain sucks for this sort of thing. I would recommend Java or C#, but I'm not sure if the Java multimedia libraries are up to the task yet and you don't have access to Visual Studio .Net (the C# compiler/debugger). Does anyone else have any good recommendations?

Share this post


Link to post
Share on other sites
This is a little OT from the OP's question, but I just could'nt not respond to this:

Quote:
Original post by s_p_oneil
VB just plain sucks for this sort of thing.


Actually, VB would be able to handle such a project quite easily, and anyone who says otherwise simply isnt good enough at VB programming. I won't dispute that other languages are better suited to such projects, and definately for games more advanced than this, but VB can handle a Warcraft clone quite easily, by use of DirectX and Win32 API, as well as an avoidance of the built in controls and methods, which do tend to be quite slow and inefficient for many purposes.

This being said, I don't know that someone without a good knowledge of VB could learn to program in it well enough to get good performance within 6 months. If you're interested in learning to program well in VB6, a couple of good resources include:
Lucky's VB Gaming Tutorials (no longer maintained, tutorials are still there, and still good though).
VB Fibre
DirectX4VB

However, this is not the place for a language-war, so I'll leave it at that.

Share this post


Link to post
Share on other sites
whether its iso or top-down, make sure to read all gamdev articles on the subject (or as many as you need. example iso map using sdl\opengl. the only reason i mention the latter is most rts games use made that way, and its fairly simple to create.

for tutorials on sdl itself, cone3d is an excellent resource. PnPBios will probably enter this discussion at some point, as he has some quality tutorials on his site.

also, vertexnormal's site (World of Golem) has some excellent iso and top-down tile tutorials (actually creating the tiles themselves). i've found them extremely useful.

cheers.

<edit :: gametutorials also has tutorials for c, c++, win32, opengl, directx, and networking.

Share this post


Link to post
Share on other sites
I'm Just out of High School my self but have been programming for about 6-7 years already. My first game engine type thing(a 2d atari style tile map) was created in qbasic, I program in c++ now.

I've Played with win32 GDI, SDL and Directx etc... and its all up to the style you want to program with. SDL from what i've seen of it is a good starting block and there are some excellent tutorials linked off of libsdl.org and the SDL Guides have some good examples too.

but of all things the most important is sitting down and planning
if you dont know where you are going its hard to get there

and GoodLuck

Share this post


Link to post
Share on other sites
Quote:
Original post by Kazgoroth
Actually, VB would be able to handle such a project quite easily, and anyone who says otherwise simply isnt good enough at VB programming.


It is true that I don't know VB very well, and I don't have any doubts that it could handle a project like this from a performance standpoint. You could probably write a game like this in a scripting language if you wanted to (many have SDL plugins). That statement came from discussions I've had with a friend who knew VB. I suppose it's not fair to use hearsay to make a statement like that. ;-)

Quote:

However, this is not the place for a language-war, so I'll leave it at that.


Amen to that.

Share this post


Link to post
Share on other sites
On SDL:
I agree with most of the others: skip the Win32/DirectDraw route and just use SDL. If you are only going to have 2D graphics, that's a fine way to go and SDL takes care of all the windowing and input handling for you. There is no OS-specific interfacing to have to deal with.

Quote:
SDL uses OpenGL and textured quads(IIRC).


false

Quote:
But the point is, he doesn't have to spent alot of time setting up OGL, learning how to do quads, etc.


true ;-)

OpenGL piggybacks with SDL. You use SDL for the window and input and image loading functions, and use OpenGL for the actual graphics rendering. For 2D you just use the very very basics of OpenGL to render textured quads to the screen on a flat plane. No lights, shading, or any of that fancy jazz. Even though OpenGL is a essentially a 3D API, it works great for 2D and that's what I and many others are using for their personal projects. Besides that, the SDL+OpenGL combo is cross platform and free as well.

Now the bad news: Creating even a very simple RTS with AI is not doable by this May unless you have a whole team of hardworking folks hacking on this thing for several hours every single day. Especially if you plan to "learn C++ as you go". If it's just going to be you, you might want to scale back your project a bit.

If you are interested in AI (and it is very interesting), i would like to offer as a suggestion programming an interactive AI "demo". Not so much a full-fledged game, but still something graphical and interactive. I honestly do not think you could pull off a full fledged game by next May. A slick demo that doesn't require a serious UI, sound, resource management, start and end screens or any state changes at all, rules, networking, etc, etc, etc... would be possible. But you better be willing to work your butt off!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this