Best Guidelines to make a 3D game in OpenGl?

Started by
7 comments, last by Fl4sh 13 years, 4 months ago
Hi,

Short Question: Can anyone give me some guidelines in what material and details should i focus considering i have a 1 week deadline for making a 3D Game?

Im in the end of my Course in Computer Graphics, i did a 2D Asteroids Game with OpenGL + Glut in my last assignement (my colision and physics implementations were awful and bugged).

Now i need to make a 3D game in one week. And im really lost.

I know about NeHe and the Red Book, but the enormous quantity of tutorials intimidate me and make me wonder if i can read enough for the 1 week deadline.

I know a little math(Bresenham and DDA algorithms, polar coordinates), very basic OpenGL and Glut, and very little about colision (i tried to implement a Edge Intersection algorithm, but failed.)

[Assignement Specification Summary]:
Make a 3D game using OpenGL, it must have:
1- Viewport manipulation in a Interactive and automatic way. The
viewport movement must be continuous and smooth. You must do clipping,
geometric transformations and removal of hidden supperficies.
2- Automatic Camera Movement: Besides the mentioned above the camera must move through a linear and curved path, with acceleration variance along the curve.
3- Illumination with the OpenGL Model (Gouraud Shading) using normal and material vectors and ambient lights.
4- Texture Map: you must map a texture to atleast one of the 3d objects.
5- You must implement atleast four of those techniques: Heads Up Display, View Frustum Culling, Level of Detail, Occlusion Culling, Procedural and Physical-based modelling, Collision Detection, Artificial Intelligence, Scenario Edition.
Advertisement
What's a Scenario Edition? :P

This sounds like a game where you should apply KISS religiously! Writing a 3d game in 1 week is difficult.

Use Glut as your window system, since you are familiar with that, and focus on just implementing your requirements first.

1) Glut has input handling, so just take advantage of this. Then it's all about using gluLookAt (if you're using OpenGL 2.x), or calculate your view matrix if you're using OpenGL 3.x. Make it as simple as you possibly can. If updating camera rotations/movements for each input cycle isn't enough to make your camera transform smoothly, just interpolate between last and next position/orientation, if you really need this, I'd suggest using quaternions for orientation... but this sounds like overkill to me...

2) This part is quite simple really. It doesn't state that you have to use anything fancy like bezier curves. You could just manually plot a track with curves. Each track node also says something about the speed. You then interpolate the position of the camera between the track nodes until you reach the finish line.

3) Gouraud Shading basically means that you use GL_SMOOTH for shading. I'd just use very simple shapes for a 1 week game and not bother implementing a 3d mesh loader. Go with boxes of varying sizes, those are very simple to add normals and texcoords to also!

4) There are some copy/paste texture loaders on the net. Just search for OpenGL TGA Loader or something like that, and you will find something that should be pretty much drop-in code. Then just bind the texture before drawing each cube, and you should get textures going. Just remember to enable texturing via glEnable(GL_TEXTURE_2D);

5)
- Heads Up Display is fairly simple, and can be achieved in multiple ways. With a shader, you could just draw a fullscreen quad with a transparent texture slapped on, then render some text for varying info. A better approach is to render the HUD after the scene using an Orthographic camera. This will allow you to render all hud graphical elements in 2D coords.

- View Frustrum Culling is fairly simple too. VFC vs AABB (axis aligned bounding box) is what I would recommend. One result from googling View Frustrum Culling aabb

- Level Of Detail can quite simply be implemented setting up the entire scene in a Quad tree. Let the level of detail in the leaf that the player occupies (detected with a simple point vs aabb insertion) be of highest resolution, and let the octree levels that other objects are positioned in define which level of detail they're rendered at based on the player position. If quad tree gets a bit technical, you can always just do plain distance check from player object to all other objects in the scene, if your scene isn't packed with them, and define some thresholds that define level of detail vs distance.


- Collision Detection can be done very simple. AABB vs AABB is by far the simplest.


If you get passed this point, I guess you can start to think about gameplay. Just a simple shooter should do it, using the simple functionality you've implemented through the requirements. But that would of course be entirely up to you.
If you can make any game, then I recommend just making a 2D game (gameplay-wise) with 3D graphics on top. If you're allowed, you can just edit the asteroids game you already have partly made. 1 week is not much time, so keep it as simple as possible. Keep collision detection down to simple axis-align boxes or circles.

The artificial intelligence option is rather vague. Would it count to have basic alien ships that shoot at you (Assuming you do an asteroids game again)? Their AI could be as simple as moving straight to the player and shooting periodically. If that's not enough, you can throw some randomness in - ie. move towards player for a random amount of time, then either stop, go back or shoot. Something simple should be quite doable.

Good luck, that's a tight deadline.
You got some excellent answers here. I have to say though (and this was hinted at above) that one week does not seem like enough time for this. I have a pretty good idea of how to do all those things, and what you described would probably take me at least a solid day or two to build from scratch. If you don't already have the requisite background knowledge and/or have other things going on in that time period as well, one week might be a little tight.

Was this assignment only given one week before the deadline? Why is the time scale so short?

Regarding the requirements:
Quote:Viewport manipulation in a Interactive and automatic way. The viewport movement must be continuous and smooth.
Without some additional context, the meaning of this is not clear.
Quote:You must do clipping, geometric transformations and removal of hidden supperficies.
There is also some lack of clarity here. Clipping is usually done on the hardware, as are geometric transformations. Hidden surface removal can refer to backface culling and z-buffer culling, both of which are performed automatically by the hardware (assuming you have things set up right). So it's not entirely clear what they're asking for here.
Quote:You must implement atleast four of those techniques: Heads Up Display, View Frustum Culling, Level of Detail, Occlusion Culling, Procedural and Physical-based modelling, Collision Detection, Artificial Intelligence, Scenario Edition.
Four? Ouch! Also, what the heck is 'scenario edition'?
Great answers!

Scenario Edition is the possibility of changing the 3D contents of the game, for example: if i have a Shooter Game, the player could make a Labyrinth Map and the game would use it. Other examples: edit the terrain, make new monsters models, make new weapons models. In that way it would require to use(or make) a "scenario" format that could be changed by the player and loaded in the game.
(Sorry for my bad explanation, English is not my nature language and i translated the assignement)

As pointed out by you guys, the teacher is a lot vague in the specification and i don't know what he means in those vague parts ( but he may be saying for us to implement clipping, geometric transformations and removal of hidden supperficies without using hardware, or making them even though the hardware does it).

we can do a Test instead of the Assignement (that's why the deadline is so short, its a challenge) but i'll try the Assignement.

Thanks for the guidelines! Following them (the KISS, and simple shapes) i'll try a Shooter Game were the player is a Refrigerator (a white box) and throws ice blocks to kill Monster Boxes (a Box with a monster texture like something brown with a evil emoticon). It will be first person (but with a small part of the refrigerator appearing in the screen, like the weapon appears in shooter games), and there will be a ramp (a little mountain or something) so i can do the Curve Camera Movement that it's asked.

It seems hard for me, and im still lost in some ways, but it's a lot more clear and i can see some objectives now.

And great summary Trefall, really liked your explanation!

Thanks guys!
Only glad to be of some use :)

I still don't understand quite what Scenario Edition is. Though my intuition guess it's got to do with GameStates. That is, the underlying logic that allows you to have a main menu, level1, level2, etc in the game?

Some really good suggestions here from the other guys as well, and like jyk pointed out, this isn't really a realistic deadline set for a project of this size at all.

I also liked Ezbez' suggestion of just converting your 2d asteroids game to 3d rendering, but keeping the gameplay in 2d. This should save you several days of work. It would also allow you to keep all you've done with collisions so far (although buggy). If there's time at the end of the week to fix your collisions to a simple circle vs circle or aabb vs aabb, then you could throw that in there just in time. Doing a first person shooter within this timeframe might not be as simple as it sounds... :)
I would recommend DevIL for loading images into OpenGL. I implemented it a few weeks ago, it only took half hour tops. I can post my source code if you like.
That said, a week seems more than a little tight considering the amount you want to implement. Is it for a course or a competition?
2 words: agile development.

You're not going to do anything by planning it out. Just MAKE IT WORK...NOW! Then work out the bugs as best you can at the end. D:
They hated on Jeezus, so you think I give a f***?!

This topic is closed to new replies.

Advertisement