shithub: nanobsp


branches: master

Clone

clone: git://shithub.us/qwx/nanobsp gits://shithub.us/qwx/nanobsp
push: hjgit://shithub.us/qwx/nanobsp
patches to: qwx@sciops.net

Last commit

fbd46067 – qwx <qwx@sciops.net> authored on 2026/02/16 17:47
npe port

About


NanoBSP
=======

by Andrew Apted, 2023.


About
-----

This is a project to make a simple node-builder which can be dropped
into an existing DOOM code-base, and build nodes at level-load time.
It is written in C, and uses fixed-point math (no FPU required).

I have created this node-builder *from scratch*, based on my experience
with the DOOM source code and BSP node building in general.  I have
placed the main code for it under the permissive MIT license, though
this repository as a whole is under the GNU GPL, since it contains a
version of the DOOM source code.

The nodes which this code builds is only suitable for DOOM's software
renderer -- it is unable to create nice polygons for OpenGL renderers.
This is something I *might* implement later on, but probably won't.

The ability to load nodes from the wad file has been retained.  This
can be forced using the new `-nobsp` option, plus it will automatically
kick in when demos are being played, since demos will usually desync if
the nodes are even slightly different.


Status
------

Finished, working, usable.


Using this code in a DOOM port
------------------------------

The bulk of my node-building code is in two new source files:
```
    nano_bsp.c
    nano_bsp.h
```

So firstly (and obviously) those files need to be added.

Secondly, the *seg_t* struct in `r_defs.h` needs a new field called
`next`.  Look at that file in this repository and copy'n'paste it.

Finally, add `#include "nano_bsp.h"` to `p_setup.c`, and within the
P_SetupLevel function call `BSP_BuildNodes()` instead of loading the
NODES, SSECTORS and SEGS lumps.  In this code-base, the node-builder is
always invoked unless explicitly disabled by a command-line option or
when playing back demos.  In your code-base, you may want to invoke it
only when the map is lacking nodes, and/or give users a config setting
to explictly enable it.


About this repository
---------------------

The rest of this repository is a copy of my "Carob Doom" port, which is
a fork of Chocolate-Doom (version 3.0.0) stripped-down to be easier for
me to compile, with lots of stuff removed (like networking), and a few
other changes.  It is not a source port intended for people to actually
use, just a playground for various (wacky) ideas I have.


Legalese
--------

I wrote this node-building code from scratch.
Hence it is Copyright &copy; 2023 Andrew Apted.

My node-building code (the files `nano_bsp.c` and `nano_bsp.h`)
are under the permissive MIT open source license.  The comments
at the top of those files contain the full license text.

The *rest* of this repository, and any executable compiled with it,
is under the terms of the GNU GPL (General Public License), either
version 2 or (at your option) any later version.
See the [COPYING](COPYING) file for the complete text.

This code comes with NO WARRANTY of any kind, express or implied.
Please read the licenses for the full details.