3D Game Engine

Member
Posts: 281
Joined: 2009.04
Post: #1
OK, I've learnt C, and would really like to make a 3D game engine
(A good reason I wanted to learn C)

I followed some OpenGL tutorials (The cube, triangle) but these seem to be taking me nowhere.

Please don't go "Oh, here's another noob who wants Halo-5 quality shaders and a level editor. Go away noob"
Infact, I'd be very happy with a wireframe layout of a cheesy small street. As long as the world's got more that 5 cube's, I'm happy Smile

I built Nehe's tutorial on setting up a 3D world. I think I counted ~39 Errors! MadMadMadMad

I have three options. If anyone could help me choose/follow please reply.

Option #1:

Quote:[INDENT]Do you think It's worth it to learn OpenGL and GLUT and try and create my own?
I'd like to do this, as I'm one of those people who love to say "... without any help. HuhSmileLOL
I've been looking at Nehe's source code and trying to deerrorize (my new favorite word) it, but I can't.
[/INDENT]
If I did this, I'd like to lay down map files (e.g. TXT) and just slowly gear it up (I could start with, say, lights).

I'd like to do that the best, and If there was any compatible tutorials, that would be great.

Option #2

Quote: Go and buy *gulp* The Red Book - or learn OpenGL for myself, but I'd have to find some decent Xcode Compatible guides - and try and code my own 3D world and camera routines. This would give me more knowledge, and upgrading my engine would be much easier.

Option #3

Quote: Buy/Download a 3D game engine and mod that, but I don't really like doing that, as most 3D game engines are impossible to mod or understand as they're so complicated.

Thanks everyone
AnnoyedHuh

~ Bring a Pen ~
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #2
Here's the deal: Learning OpenGL is hard! If you've really put in a lot of effort and seem to be getting nowhere, then let me just say that you have a long way to go if you wanna make your own 3D game engine. No really, it is hard! I've been fiddling around with this OpenGL stuff for like ten years and I'm still learning. That said, it is not impossible. Many of us did the NeHe tutorials in conjunction with other stuff, including the Red Book, among other books and sources of information. Unfortunately the NeHe tutorials for Mac are getting old. I would suggest sticking to the GLUT versions. I can't think of any other good sources for the Mac off-hand.

All that said, the best advice I can offer is to try out Unity.
Quote this message in a reply
Member
Posts: 281
Joined: 2009.04
Post: #3
£134! I'm under 14! WackoLOL I could buy the UK government!

OK, Unity seems good - apart from the price - but I don't really want that kind of level of no-programming, anyway, I don't really mind if I'm wandering around in a wireframe box at 512*512 screen res.


Blush Where are the NeHe GLUT tuts? BlushWackoHuh

Hmmm. Considering I am a - lets say... novice - C programmer can you recommend any books? My experience with books over the Internet is not good.Mad ...

Quote:I spend £~50 on 'Mac Game programming' and wait a couple of weeks. It said "For beginners!" It didn't mention that teeny-weeny words inside the cover: "It is advisable for users to be confident is C++." Oh. Anyway, the pub. date's 2001

Although, seeing something in my hand really helps me learn.

~ Bring a Pen ~
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #4
Unfortunately NeHe doesn't gear their tutorials specifically at GLUT, so you'll have to extrapolate a little. What I meant is only downloading the GLUT versions of the code to look at. You'll probably still need to modify them a little bit to work on the Mac, but you should already know how to do that from OneSadCookie's GLUT tutorial. If you're still having trouble getting their GLUT code to compile, post which ones won't work here and maybe someone can help.

If you really want to stick with the down and dirty OpenGL path, you should probably consider picking up a copy of the Red Book. Older copies of the Red Book are probably okay too, so used is fine.

For other books, I'd avoid anything older than say two or three years. The book, "Mac Game Programming" is too old.

I haven't looked at it myself but you might try this thread. It is geared at iPhone, but the techniques should be pretty portable. Besides, the iPhone SDK is free anyway and comes with the simulator.

Once again, learning OpenGL is hard! You're starting at the right age though. I'd still highly recommend saving up for Unity as well.
Quote this message in a reply
Member
Posts: 260
Joined: 2005.05
Post: #5
AnotherJake Wrote:Here's the deal: Learning OpenGL is hard! If you've really put in a lot of effort and seem to be getting nowhere, then let me just say that you have a long way to go if you wanna make your own 3D game engine. No really, it is hard! I've been fiddling around with this OpenGL stuff for like ten years and I'm still learning. That said, it is not impossible.
On the positive side, learning OpenGL is actually very easy. The API is very nice and straight-forward for a 3D API. If you start by making something simple, then OpenGL really doesn't get in the way.

The big problem is the things that you need beyond OpenGL. Loading 3D models, drawing text (!), frustum culling, shaders, hierarchical organization of scenes, collision handling etc etc. Just like you, I have been building my 3D library for years and I never get all the things into it that I want.

Start in 2D, it is a lot easier. Then make something simple in 3D where you can manage without any extras.

Of course you can build on an existing 3D game engine, but I have burnt my fingers on those several times. Remember that they can not do anything beyond what you see in the demos. Even if the demos are impressive, you may run into problems very quickly when trying to do something else. Try them, but don't waste too much time trying to fix their bugs. If they can't do what you need you should go elsewhere. Just for a rule of thumb.

Considering "Mac game programmming" I don't find it all that outdated. Most of it is as valid today. Of course there are uncovered territory (shaders in particular) and the discussions about development tools are old, but that doesn't make the rest useless. It makes pretty nice introductions to game physics and game AI.
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #6
Ingemar Wrote:On the positive side, learning OpenGL is actually very easy...
It wasn't easy for me to learn OpenGL, but you're right about all the other stuff you need later being an extra complication. Starting with 2D is definitely a reasonable recommendation.

Ingemar Wrote:Considering "Mac game programmming" I don't find it all that outdated. Most of it is as valid today.

CopyBits, off-screen GWorlds, GameSprockets, Sound Manager, QuickDraw? Those are all old, deprecated, and some of it is even non-existent nowadays. That is most certainly "outdated" in my view. Further, I do not recommend learning to use Carbon these days; if you're going to learn an OS API, learn Cocoa instead.
Quote this message in a reply
Member
Posts: 46
Joined: 2008.10
Post: #7
My $0.02:

Step 1: Become comfortable with the basics of how OpenGL works: states, vertex lists, transformation stacks, etc.
Step 2: Look up SDL, a cross-platform HAL that will make it a little easier to write a game on a Mac without knowing tons about Obj-C or Cocoa.
Step 3: Using one of the handy SDL-OpenGL tutorials, wipe everything but the Cocoa / NIB window handler and start writing your own code from main.c.

This gives you a really good, mostly-platform-independent place to start. Learning the intricacies of OpenGL will take time, to be sure, but a solid grasp of the basics will actually take you quite far.

As far as texts are concerned: I have had good experiences with OpenGL Game Programming: it covers a lot of the basics, as well as some really slick not-so-basic techniques. The drawbacks: it was written for Windows, and it's a bit old. The material's still good, though, and since you're using SDL (Cocoa only as a window handler), you can just skip the annoying chapter on DirectX.

"Who's John Galt?"
Quote this message in a reply
Member
Posts: 749
Joined: 2003.01
Post: #8
Making a fairly complex 3d game with just opengl is going to be hard, really hard for a 14 year old.

From a productivity point of view, I'd definitely go with Unity. You still get to do programming, just many things are made easier.

If you want to go with Opengl, you will have to go slowly, one step at a time. Even the stupid "Cube" example, try to write that from scratch, you'll find out its much harder than you think.

As my collegue above says, SDL simplifies some stuff, check it out, http://www.libsdl.org/download-1.2.php download the os x development library, install it, then when you chose new application in xcode you will get opengl sdl application, that can give you a place where to start.

Still its going to be ugly Rasp

©h€ck øut µy stuƒƒ åt ragdollsoft.com
New game in development Rubber Ninjas - Mac Games Downloads
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #9
SDL is an excellent choice, but even that is overkill compared to the simplicity of GLUT when it comes to learning OpenGL. [edit] although there may be more accessible tutorials with SDL, but I haven't looked lately ("lately" being several years), so it's definitely worth investigating! [/edit]

"OpenGL Game Programming" is also just too darn old, although it does focus on OpenGL and there are other things to learn from it as well, but as already mentioned, it's Windows-oriented. Like "Mac Game programming" it would make a great reference if you can pick up a used copy for cheap, but otherwise, don't expect it to magically open up the path for you.

Sadly, currently there are no well-known directions to take with this endeavor of learning OpenGL on the modern Mac. I suspect one might have better luck learning OpenGL ES on the iPhone and going from there instead.
Quote this message in a reply
Member
Posts: 260
Joined: 2005.05
Post: #10
AnotherJake Wrote:CopyBits, off-screen GWorlds, GameSprockets, Sound Manager, QuickDraw? Those are all old, deprecated, and some of it is even non-existent nowadays. That is most certainly "outdated" in my view. Further, I do not recommend learning to use Carbon these days; if you're going to learn an OS API, learn Cocoa instead.
I wouldn't touch any of them more than necessary when learning game programming today. It is better to start with GLUT + OpenGL and some standard Unix calls.
TythosEternal Wrote:My $0.02:

Step 1: Become comfortable with the basics of how OpenGL works: states, vertex lists, transformation stacks, etc.
Step 2: Look up SDL, a cross-platform HAL that will make it a little easier to write a game on a Mac without knowing tons about Obj-C or Cocoa.
Step 3: Using one of the handy SDL-OpenGL tutorials, wipe everything but the Cocoa / NIB window handler and start writing your own code from main.c.

This gives you a really good, mostly-platform-independent place to start. Learning the intricacies of OpenGL will take time, to be sure, but a solid grasp of the basics will actually take you quite far.
That list makes much sense to me, although GLUT should be considered too. Game GLUT is very nice IMHO.
Quote:As far as texts are concerned: I have had good experiences with OpenGL Game Programming: it covers a lot of the basics, as well as some really slick not-so-basic techniques. The drawbacks: it was written for Windows, and it's a bit old. The material's still good, though, and since you're using SDL (Cocoa only as a window handler), you can just skip the annoying chapter on DirectX.
Actually, that book has been replaced by two books: "Beginning OpenGL Game Programming" and "More OpenGL Game Programming". Pretty nice books, but the Windows focus is really annoying in some places. One of the worst is the text chapter, providing a Windows only solution - for OpenGL! Wacko
Quote this message in a reply
Member
Posts: 281
Joined: 2009.04
Post: #11
Thanks everyone again:

OK, maybe I should write a 2D game to start with. I looked at OSC's GLUT square tutorial, and followed that. I'd like to have as little code to write as possible.

So could anyone show me how to set up fullscreen project, as It's all very well knowing OpenGL, but I don't know where to put it. Just on the subject, does anyone know how to make an Xcode template project? It would make writing OpenGL GLUT games much easier.

Does this sound like a decent first project?

1. A triangle.
2. An arrow-key moveable triangle. (like asteroids)
3. Asteroids?

I could mod my OSC tutorial to be a triangle, but that's not Fullscreen Kiosk.

Q: What's A H.A.L?Huh


I think I'm going to follow TythosEternal's advice, if I knew what a HAL was. Smile

PS: I thought about doing stuff in school, but sadly we're not even on BASIC yet. We've only just covered MS Word. Yippee.Bored

PPS: Guess what my other project is? A computer from a PIC and a ANLCD. That's using most of my RAM.

PPPS: Bill Gates is out there to make our lives harder. You would not believe the amount of tutorials for Windows two-million.

~ Bring a Pen ~
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #12
mikey Wrote:So could anyone show me how to set up fullscreen project, as It's all very well knowing OpenGL, but I don't know where to put it.

Add glutFullScreen(); right above the line that says glutMainLoop();

mikey Wrote:Just on the subject, does anyone know how to make an Xcode template project? It would make writing OpenGL GLUT games much easier.

It doesn't really get any easier than setting up a GLUT project, but if you must, then simply Google for Xcode template project and you'll get a whole bunch of hits on it.

mikey Wrote:Does this sound like a decent first project?

1. A triangle.
2. An arrow-key moveable triangle. (like asteroids)
3. Asteroids?
Yes, that's an excellent first project.

mikey Wrote:Q: What's A H.A.L?Huh
Hardware Abstraction Layer. Technically everything is a hardware abstraction layer. OpenGL abstracts you from the graphics hardware. SDL and GLUT even abstract you from the system.
Quote this message in a reply
Member
Posts: 51
Joined: 2009.02
Post: #13
Apple really needs a decent game example template now that CrashLander is gone. I'm surprised it just disappeared with no replacement.

>>Q: What's A H.A.L?

I'm sorry Dave, I'm afraid I can't do that.
Quote this message in a reply
Member
Posts: 281
Joined: 2009.04
Post: #14
AnotherJake Wrote:It doesn't really get any easier than setting up a GLUT project, but if you must, then simply Google for Xcode template project and you'll get a whole bunch of hits on it.

Nope. All the guides tell me to look in /Library/Application Support/Apple/Developer Tools/Project Templates/Application, but that path stops at Apple/Developer Tools. I'm running Xcode 3.1 and Mac OS 10.5. Is this a problem?

~ Bring a Pen ~
Quote this message in a reply
Member
Posts: 281
Joined: 2009.04
Post: #15
OK, I've set up a triangle, but I'm not sure how to read key-presses from the event queue? If there is one? As InputSprocket's useless, I'll use HID manager to read the Arrow keys. How would I go about doing this, or is there an easier way?


Thanks everyone again.

~ Bring a Pen ~
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Some Game / Engine Source code in C++ and MSVC kiavash2k 1 5,373 Apr 12, 2012 11:35 PM
Last Post: DJyStyler
  artificial intelligence engine for game like sherlock holmes sefiroths 3 6,227 Feb 26, 2011 12:15 PM
Last Post: Macmenace
  What engine to choose for bowling-like game? Sergnsk 2 3,519 Jan 30, 2010 11:53 AM
Last Post: mikey
  Easy game engine for Mac OS X YvanSoftware 7 11,557 Dec 17, 2009 03:04 PM
Last Post: SethWillits
  Help with Game scene and Game Engine smith_mike51 2 3,345 Oct 14, 2009 04:44 AM
Last Post: MikeD