Real-time 3D terrain engine

Coders forum. Discuss techniques, swap code snippets, ask for help etc. relating to all forms of software development.
User avatar
arron
Baaaaaaa!
Baaaaaaa!
Posts: 7047
Joined: Mon Apr 22, 2002 11:42 pm 0
Location: Here and Now

Post by arron »

Jaguar wrote:
Any other ideas/advice? Greatly appreciate all your input so far :)
Have a plan how you get from here to there (the final objective) so you can see where you should be going at each step.

Start simple and make more complex. Keep a working codebase at all times during development.

Come back and show us the odd picture now (in this thread?) and again to let us know how you're getting on, I quite like seeing projects like this develop.. :D

If you have a problem and you're stumped, then don't be afraid to ask for help. Many brains make light opera..or..er..something along those lines.
"Observation is the path to understanding. Self-observation is the path to self-understanding."
User avatar
KlaxonCow
Baaaaaaa!
Baaaaaaa!
Posts: 8447
Joined: Fri Dec 13, 2002 3:46 am 0
Location: A large grassy field.

Post by KlaxonCow »

Jaguar wrote:To create a map editing tool that can create terrain using heightmaps, fractals, or bezier patches/surfaces. It can then save the vertex/triangle data as a binary file for the engine to load.
Perhaps split that up.

Have the map editor create text source files and then have a "map compiler" that creates the binary files.

Carmack's earlier engines (and Half-life too because it used a modified Quake 1 engine but with some improved compiling tools) tend to take that approach.

Maps are actually text files (can be hand-edited in Notepad, even) which are then compiled by a map compiler into a binary file (at this point, they can be used directly but lack lighting and lack optimising). Then there are other programs which calculated the precalculated lighting (I doubt this is necessary with the new DOOM 3 engine, though, as all lighting I presume is now real-time and none of it precalculated as it used to be) and an "optimiser" program which re-arranged the binary file - made splits in the BSP trees at more optimal spots, balanced the trees better and the like - to make it as optimal as possible.

The arrangement - as most programmers are familiar with from their programming command line compiles and liinkers and the like - allows more flexibility. Skipping the "lighting" and "optimising" steps, say, when you just want a quick test. Hand tweaking map text files and easier exchange between map modders (who can see how other maps do particular tricks when they are text file rather than binary).

In fact, with Half-life, a guy called "Zoner" put together improved "lighting" and "optimising" tools, which gave better visual results than the original Quake ones that Half-life originally used. Because the tool chain was modular, it was real easy for this "Zoner" to write an improved tool and then just swap it for the original tool.

It's your basic modulisation and modding and extensibility approach.

As the various engines out there show, it's a real good idea to encourage modding with an engine because entire communities and new games spring up everywhere (have you seen how many Half-life mods exist? It's staggering. But that was the wisdom of Valve putting their map editor onto the Half-life CD and making the whole thing open for modding. It extends the game and, you know, even if people don't like your game then they might still buy it to have the engine to access all the other mods and games that use the engine). Also, don't forget that if you've got a really good engine and it's flexible to be modded and used for other games then there's selling potential in the engine itself, quite separate from the game. As noted, Half-life uses a modified Quake 1 engine. Valve bought the engine's source code off Carmack and tweaked it to add in hardware acceleration and cool AI.

Plus, as noted, 3D engines can be big projects. It probably makes total sense to approach it in a highly modular fashion for your own benefit of keeping it organised and easy to modify. The fact that this approach could also make it potentially sellable in its own right as a base engine for other game companies and modding communities (if it's good enough, of course) is a nice bonus on top of that.

As noted before, those who just want to create 3D games tend to grab someone else's engine and work from that rather than start their own engines from scratch (iD are the exception because, generally, that's who everyone is mostly buying their 3D engine from! :wink:). So, you know, if you're doing all this work and the results are good then it seems fair compensation for all that hard work to potentially sell it to a few people, if you make it real good :D
"Words ought to be a little wild - for they are assaults of thought on the unthinking."
- John Maynard Keynes
User avatar
Firefox
Sheepie Whore
Sheepie Whore
Posts: 11412
Joined: Fri Apr 26, 2002 6:15 pm 0
Location: Sheffield

Post by Firefox »

Kemper_Boyd wrote:Loose octrees work very well. IIRC Thatcher Urlich came up with that idea first and has some nice terrain code.
I was about to ask "Isn't he the chap that came up the the Cube FPS engine?", but of course that was Wouter van Oortmerssen.

Still worth checking out though, as it uses a quadtree-based landscape engine and has source code available for download. It's also a damn fine game. :)
User avatar
Jaguar
Baa!
Baa!
Posts: 52
Joined: Wed Feb 15, 2006 7:01 am 0
Location: England
Contact:

Post by Jaguar »

Thanks for all of that. I like the idea of a map compiler. One of my lecturers at uni strongly encouraged the use of text files and it has kind of stuck with me, but the notion of still storing map data as a text file and then writing a compiler to turn it into binary is new to me, and I like it :)

It sounds like you're basically saying to think 'KISS' and use small steps and set simple, achievable goals. Which all sounds very wise. Since this is a huge undertaking I am very concerned about biting off more than I can chew or destorying thousands of lines of code etc. I've learnt my lesson about constantly backing up the codebase before implementing changes, etc.

I shall definitely have to start on this soon; play with heightmaps and fractals :D

Also:
KlaxonCow wrote:
Jaguar wrote: As noted, Half-life uses a modified Quake 1 engine.
I'm pretty sure Valve used a modified Quake 2 engine. They extended it to support 16bit colour (?) and as u said, hardware acceleration, better AI etc. I might be wrong but i'm pretty damn sure it was the Q2 engine.
User avatar
Wibble
Baaaaaa!
Baaaaaa!
Posts: 3317
Joined: Fri May 02, 2003 10:13 pm 0
XBL Gamertag: misterwibble
Location: The Hague - The Netherlands
Contact:

Post by Wibble »

Jaguar wrote:I'm pretty sure Valve used a modified Quake 2 engine. They extended it to support 16bit colour (?) and as u said, hardware acceleration, better AI etc. I might be wrong but i'm pretty damn sure it was the Q2 engine.
Nope.. it's most definitely based on the original Quake engine.

I could dig up a bunch of referring links, but google will spew those easily enough :)
Kronos

Post by Kronos »

trailer here on 4 different download points

i can see i will be needing a new pc VERY SHORTLY!! :wink:
Post Reply