PDA

View Full Version : Quake III BSP Files



nukem
07-03-2003, 03:15 AM
I am currently writing a Quake III BSP engine. Its as far as the stuff on gametutorials.com but I want to make the engine as good if not better then the one used by Quake III. I know animations and high detailed objects on maps are held in MD3 files. Does anyone know how to get from the BSP were to put them and when to do there action? I was also looking threw the Quake III pak file and came accross two file types that I havnt been able to find any programming docs on. aas all I know about these is there for bots, while I do not plan to have bots in this version does anyone know if thats right? In the scripts dir there was a bunch of shader files. Does anyone know what they do? Does anyone know of a page to teach you how to script in this 'shader lang.'

Thanks,
Nuke

errno
07-03-2003, 03:57 AM
the entities lump point to a string. it contain the spawn location, items position, lights position ... and it reference some .md3 files.

DopeFish
07-03-2003, 04:29 AM
It makes you wonder if yoyo read the post at all now doesnt it.

.aas files are the pathfinding information for the bots.

.shader files are the scripts that control the texture renderings, such as UV coord warping/scrolling, vertex warping, frame-based texture animation, etc.

errno
07-03-2003, 05:30 AM
the first question was: "Does anyone know how to get from the BSP were to put them and when to do there action?"

nukem
07-03-2003, 07:46 AM
DopeFish: Thanks for clearing that up for me. Now I just have to find some place that will teach me how to write shader files by hand so I can write an engine to read them.

yoyo: thanks for the explination

My current lumps enum looks like this.




enum Lumps
{
L_entities = 0, //stores player/object postions
L_textures, //stores the texture info
L_planes, //stores the splitting planes
L_nodes, //stores the BSP nodes
L_leafs, //stores the leafs of the nodes
L_leaffaces, //sotres the leafs indices into the faces
L_leafbrushes, //stores the leafs indices into the brushes
L_models, //stores the info of the worlds models
L_brushes, //stores the brush info(collision ****)
L_brushsides, //stores the brush surface info
L_vertices, //stores the lvl vertices
L_meshverts, //stores the model vertices offsets
L_shaders, //stores the shader files
L_faces, //stores the faces for the world
L_lightmaps, //stores the lightmaps for the lvl
L_lightvolumes, //stores the extra world lighting info
L_visdata, //stores PVS and cluster info(visibility)
L_maxlumps, //a const to store the num of lumps
};


Would I change it to this?




enum Lumps
{
L_entities = 0, //stores player/object postions
L_textures, //stores the texture info
L_planes, //stores the splitting planes
L_nodes, //stores the BSP nodes
L_leafs, //stores the leafs of the nodes
L_leaffaces, //sotres the leafs indices into the faces
L_leafbrushes, //stores the leafs indices into the brushes
L_models, //stores the info of the worlds models
L_brushes, //stores the brush info(collision ****)
L_brushsides, //stores the brush surface info
L_vertices, //stores the lvl vertices
L_meshverts, //stores the model vertices offsets
L_shaders, //stores the shader files
L_faces, //stores the faces for the world
L_lightmaps, //stores the lightmaps for the lvl
L_lightvolumes, //stores the extra world lighting info
L_visdata, //stores PVS and cluster info(visibility)
L_spawnlocation,//the location points of were to spawn
L_itempos, //were to spawn the items
L_lightpos, //were to setup lighting
L_md3, //info about the md3's
L_maxlumps //a const to store the num of lumps
};


For spawn location, items position, lights position and the md3 stuff. What kind of structs would I use to load it? I already have lightmaps and light volumes setup to load. Is the light position your talking about diffrent? Isnt lighting in BSPs and most game engines done by multitexturing instead of using the lights made by OGL?

If anyone has anything im missing that BSPs have please tell me, Im trying to get this as close as possible to the Quake III engine.

Thanks,

Nuke

[This message has been edited by nukem (edited 07-03-2003).]

Coriolis
07-03-2003, 10:56 AM
AAS stands for Area Awareness System.

Each entity has an origin key pair... that's where you put it to start with. The game code moves them around later on.

nukem
07-03-2003, 11:33 AM
Dosnt the aas file dictate how the character moves around? Wouldnt that be why there so big?

Mihail121
07-03-2003, 01:29 PM
Look nukem it's actually (HELL NOT THAT)easy.

The ASS files contain a series of waypoints and flags for the bots.You can completely ignore them.The thing you need to know is that each BSP file contain a list of entities at the end.This entities are described with strings and are usually something like:

mode0
{
name "data/model1.md3"
render_mode wire
}

just use your entity lump to get there.

----------------------------------------------------------------------------------------

As for the SHADER files...they are nothing else but the heart of the Quake3 engine.If you open the console at the beginning you'll notice that the shaders are loaded first.Quake3 and all other games based on that engine *ARE BASED* on SHADER files.They dictate all of the rendering in the game and fill up a special render state manager.If you're going to load some BSP files or any other Q3 stuff i suggest to download the Q3 Shader Manual written by the ID Software team.

nukem
07-03-2003, 09:43 PM
Mihail121: when I do




modelcount = lumps[L_entities].length / sizeof(BSPModel);
models = new BSPModel[modelcount];

fseek(File, lumps[L_entities].offset, SEEK_SET);
fread(models, modelcount, sizeof(BSPModel), File);


What would be the BSPModel struct? Two char* one for the path and one for the render mode?

For the shader files does that mean I do not have to have an engine that reads shader files? My engine is going to be able to read BSPs from Quake III Quake II Half-Life and other map files so its not really based on the Quake III engine alone, but I do want it to read Quake III BSPs as well as the Quake III engine. Would you suggest I do something like shader scripting files for my engine? Or should I just hard core it untill I put mod support in?

errno
07-03-2003, 11:45 PM
the data at lumps[L_entities].offset is a string. you should do:
entities = new char[lumps[L_entities].length];
fseek(File, lumps[L_entities].offset, SEEK_SET);
fread(entities, sizeof(char), lumps[L_entities].length, File);

and then parse it to find what you want. there was some post on gametutorial forum on this subject.

don't modify the lumps enum !!!

Mihail121
07-04-2003, 10:34 AM
U don't get the idea.The shader files fill the render state manager of Quake III.They only save a billion of state switches.U can go without them too.After all each engine is uniqe.

nukem
07-04-2003, 11:24 AM
yoyo: Thanks now I just have to figure out the reason for having classname, light, targetname, radius, _color and angle. Im assuming that origin means were to put it in the map(x, y, z). If you know of anyplace that could tell me that would be great. I searched the gametutorials fourms and there search engine wont work for me. I guess ill go google that now.

Mihail121: Ok thanks I was thinking of doing that to make my engine uniqe.

[This message has been edited by nukem (edited 07-04-2003).]

Zy
07-05-2003, 12:08 PM
Originally posted by nukem:
now I just have to figure out the reason for having classname, light, targetname, radius, _color and angle. Im assuming that origin means were to put it in the map(x, y, z). If you know of anyplace that could tell me that would be great.

I'm not familiar with the programming aspects of Q3 BSPs, but I know GTK-Radiant (the level editor for Q3 based bsps) has fairly complete definitions of all the entity key values such as classname, light, targetname, radius, etc.

nukem
07-05-2003, 09:02 PM
Zy: ya ive known GTK-Radiant would be good. Infact I had it installed but it wasnt working for some reason. I redownloaded it and did a fresh install and now it works. http://www.opengl.org/discussion_boards/ubb/biggrin.gif now im starting to understand things alot better.

Thanks for everyons help!!!

Nuke