Released Quake 3 BSP loading & rendering example

MilkMan5x

Member
Quake 3 BSP loading & rendering


GitHub repo link (legacy repo)
==========================================================================

So, back in 2017, I somehow decided to create a BSP loader.
After few days of pain and agony, I managed to wrangle up some very basic loader... and then I forgot about it.

But today, As I found this thing all dusty and forgotten,
I thought this bad boy needs to see the light before it gets totally abandoned.
So I polished a little and decided to Share with you, Folks.
(Who knows? This might be come in handy and could be some good starting point on writing the map Loader.)

So here it is, The very Minimal (AKA too-lazy-to-finish-it) Quake 3 BSP loader.

==========================================================================

--=[Things implemented]=--
"Leaf" culling using visibility data from the map
6DOF(...kinda) 3D camera with Quake-like side tilt thing (You can backflip! ...sorta)

Basic loader :
Loading basic level geometry, leaves, lightmap and more.

Basic(?) renderer :
Able to render the "leaves" that is visible only
Lightmap!
(The renderer can still be optimized; As I didn't knew much about the Vertex buffers and used some inefficient method.)

--=[Things NOT included]=--
BEZIER PATCH (my urban weakness) - If you see some "holes" in the level, That's probably the Bezier patch model that's not loaded and rendering.

Textures & Entities - My intent on writing this was to Learn about the BSP's level structure, So I didn't wrote them, Apparently.

Many other things - As this boy's really Abandoned.

Also there's "playable" .EXE file conveniently compiled in the GitHub's repo, Feel free to Take a gander at it!
(It contains Brütal metal music and Some handsome & evil guy's voice; Be careful with the volume!)


==========================================================================

--=[Screenshots]=--




--=[GitHub]=--

GitHub repo link (legacy repo)

Quake 3 BSP loading & rendering
(stronger & spicier & better, Hjåh!)




GitHub repo link : https://github.com/TandyRum1024/gml-q3-bsp-loader

Hi. After chucking this old tech on this forum back in 2018, abandoned, Those haunted souls of railgun-holding quad-damage-loving-freaks kept haunting me every friday the 13th.
That combined with the guilt of leaving some (potential) projects alone made me to return to this project & work a bit more on it.
So Here I am, Re-wrote everything & made few improvements.
The future of this project is still unknown, But at least I was able to make this thing a bit more usable.

==========================================================================

This example features :
Rendering of level geometry via the BSP with Potential visible set, Pre-baked in the map.

3D camera with Quake-like side tilt thing
Loading basic level geometry, leaves, lightmap and more.
Bezier patches (Finally!)
Texture loading & mapping (only if its available)
Lightmap lighting model
Lightvolume lighting (in test phase)

Things not featured :
Quake 3's shader pipeline (too much complicated for me to implement it :/)
Frustum culling of leaves when rendering them (potential optimization)
Level geometry texture atlas (another potential optimization)
"Billboard" Type of leaffaces.

==========================================================================
Heads up :
In order to use this example, You'll need some resources from Quake 3 : Arena (or Quake live).
Since including the resources in the example violates the Copyright law (and potentially dunk me in some sticky situations), You have to get them yourself.
Thankfully the bare-minimum resources you need is just a .bsp / .pk3 / .zip map file.. And you can grab some of them from the Quake 3 map database (link).

On the other hand, The assets (pak0.pk3) must be obtained by you. It can be found in quake 3's installation folder with the name [pak0.pk3], And you can grab the demo version of Quake 3 : Arena on steam for free, If you don't happen to have the full version of the game. Quake live's assets works just as fine as Q3A, So you can use that if you have one too.
==========================================================================
Gallery



==========================================================================
GitHub repo link : https://github.com/TandyRum1024/gml-q3-bsp-loader
 
Last edited:

MilkMan5x

Member
The deed has been done; I'm no longer hesitating to update this post to feature the latest build of my loader.
Have fun & Happy coding y'all :>
 

okasion

Member
The deed has been done; I'm no longer hesitating to update this post to feature the latest build of my loader.
Have fun & Happy coding y'all :>
Thanks, this is something I managed to do with C++ and OpenGL a lot time ago, but it was incredibly difficult; I was able to load a BSP map file, and even MD3 models, but again, it was way too difficult so I abandoned it.
This will help some people a lot!
 

MilkMan5x

Member
Thanks, this is something I managed to do with C++ and OpenGL a lot time ago, but it was incredibly difficult; I was able to load a BSP map file, and even MD3 models, but again, it was way too difficult so I abandoned it.
This will help some people a lot!
Thank you. Loading MD3 models is quite impressive even if you used Cpp n' OGL, I would say.
Also, I do hope this would help a lotta folks out there too.
 

zenc90

Member
Quake 3 BSP loading & rendering


GitHub repo link (legacy repo)
==========================================================================

So, back in 2017, I somehow decided to create a BSP loader.
After few days of pain and agony, I managed to wrangle up some very basic loader... and then I forgot about it.

But today, As I found this thing all dusty and forgotten,
I thought this bad boy needs to see the light before it gets totally abandoned.
So I polished a little and decided to Share with you, Folks.
(Who knows? This might be come in handy and could be some good starting point on writing the map Loader.)

So here it is, The very Minimal (AKA too-lazy-to-finish-it) Quake 3 BSP loader.

==========================================================================

--=[Things implemented]=--
"Leaf" culling using visibility data from the map
6DOF(...kinda) 3D camera with Quake-like side tilt thing (You can backflip! ...sorta)

Basic loader :
Loading basic level geometry, leaves, lightmap and more.

Basic(?) renderer :
Able to render the "leaves" that is visible only
Lightmap!
(The renderer can still be optimized; As I didn't knew much about the Vertex buffers and used some inefficient method.)

--=[Things NOT included]=--
BEZIER PATCH (my urban weakness) - If you see some "holes" in the level, That's probably the Bezier patch model that's not loaded and rendering.

Textures & Entities - My intent on writing this was to Learn about the BSP's level structure, So I didn't wrote them, Apparently.

Many other things - As this boy's really Abandoned.

Also there's "playable" .EXE file conveniently compiled in the GitHub's repo, Feel free to Take a gander at it!
(It contains Brütal metal music and Some handsome & evil guy's voice; Be careful with the volume!)


==========================================================================

--=[Screenshots]=--




--=[GitHub]=--

GitHub repo link (legacy repo)

Quake 3 BSP loading & rendering
(stronger & spicier & better, Hjåh!)




GitHub repo link : https://github.com/TandyRum1024/gml-q3-bsp-loader

Hi. After chucking this old tech on this forum back in 2018, abandoned, Those haunted souls of railgun-holding quad-damage-loving-freaks kept haunting me every friday the 13th.
That combined with the guilt of leaving some (potential) projects alone made me to return to this project & work a bit more on it.
So Here I am, Re-wrote everything & made few improvements.
The future of this project is still unknown, But at least I was able to make this thing a bit more usable.

==========================================================================

This example features :
Rendering of level geometry via the BSP with Potential visible set, Pre-baked in the map.

3D camera with Quake-like side tilt thing
Loading basic level geometry, leaves, lightmap and more.
Bezier patches (Finally!)
Texture loading & mapping (only if its available)
Lightmap lighting model
Lightvolume lighting (in test phase)

Things not featured :
Quake 3's shader pipeline (too much complicated for me to implement it :/)
Frustum culling of leaves when rendering them (potential optimization)
Level geometry texture atlas (another potential optimization)
"Billboard" Type of leaffaces.

==========================================================================
Heads up :
In order to use this example, You'll need some resources from Quake 3 : Arena (or Quake live).
Since including the resources in the example violates the Copyright law (and potentially dunk me in some sticky situations), You have to get them yourself.
Thankfully the bare-minimum resources you need is just a .bsp / .pk3 / .zip map file.. And you can grab some of them from the Quake 3 map database (link).

On the other hand, The assets (pak0.pk3) must be obtained by you. It can be found in quake 3's installation folder with the name [pak0.pk3], And you can grab the demo version of Quake 3 : Arena on steam for free, If you don't happen to have the full version of the game. Quake live's assets works just as fine as Q3A, So you can use that if you have one too.
==========================================================================
Gallery



==========================================================================
GitHub repo link : https://github.com/TandyRum1024/gml-q3-bsp-loader
i don't understend how did you make the 3D camera with Quake-like side tilt thing. Do you have any video explain how to make that and how work???
 

MilkMan5x

Member
i don't understend how did you make the 3D camera with Quake-like side tilt thing. Do you have any video explain how to make that and how work???
The code is up on github, just look at it and you'll find out. :)
Ah, sorry for late reply! I was busy working on my projects so I basically couldn't frequently check the forums as before lately.
You can take a gander at some code at my repo as IGameArt said.. If you hadn't yet ofc;

But basically, what I'm doing is that I transformed camera's forward & up vectors w/ fancy trigonometry and use that for the d3d_set_projection_ext().
I'm using the script z3d_update_vectors() to update/transform the camera vector, and after calling that I've used the resulting up & forward vectors for the d3d's projection function like following snippet:
GML:
// set the camera
// camXYZ = camera's position vector, camFwdXYZ = camera's forward vector, camUPXYZ = camera's up vector
d3d_set_projection_ext(camX, camY, camZ, camX + camFwdX, camY + camFwdY, camZ + camFwdZ, camUpX, camUpY, camUpZ, 90, window_get_width() / window_get_height(), 1, 16000);
 
Top