Page 2 of 9

Posted: Fri 07 Apr, 2006 10:13 am
by Timendus
Dude, get real :mrgreen:
Sounds like you need "BSP trees for dummies",
unfortunately that page (http://qxx.planetquake.gamespy.com/bsp/) is offline :P

Posted: Fri 07 Apr, 2006 11:13 am
by coelurus
I still haven't made a single BSP tree generator in my life. I still know the overall algo and here's my tut:

1) Insert line, by splitting it against the infinite representations of the existing lines already in the BSP.
2) Go to 1 until there are no more lines.

Done. Would be real nice to see a BSP-based 3D app on the calc :)

Posted: Tue 11 Apr, 2006 1:31 pm
by benryves
I've been a bit busy of late, but I've changed a few things; still no occlusion or clipping (boo!) but there are now variable height sectors (as well as a variable camera height).
Image
The odd flickering lines in places are due to 8-bit overflows when truncating a 16-bit screen coordinate to an 8-bit one. Note the smoothness (24/16-bit divisions for projection to screen rather than 16/8 and a lookup table) and the backface culling on the central "cube".

Posted: Tue 11 Apr, 2006 2:05 pm
by the_unknown_one
This looks nice, ben!

Posted: Tue 11 Apr, 2006 2:37 pm
by Timendus
Wow, it's so fast... Pretty incredible :)
The backface culling doesn't work very well with the variable camera height yet though. When you look on top of the central cube you don't see the full top square. Pretty amazing nevertheless ;)

Posted: Tue 11 Apr, 2006 2:51 pm
by benryves
Timendus wrote:Wow, it's so fast... Pretty incredible :)
I wouldn't take the GIF speed as accurate... it looks roughly accurate in Opera, and fine in ImageReady, but it runs super-fast in IE. :(

Posted: Tue 11 Apr, 2006 5:01 pm
by kalan_vod
Great work ben, are you planning on using this for anything or just trying to hurt use! :P Looks amazing, and I hope something develops from this.

Posted: Tue 11 Apr, 2006 5:26 pm
by benryves
Even if I don't use it in a game myself, I'm aiming for the engine to be nice and modular (along with a simple level format) so that it's easy enough for someone else to plug a game into it. Of course, this also means that if it crashes and burns, someone else can help me out (for example, all vertices transformed and rotated by code in one source file, then the walls are projected and drawn in another, input handling and movement in yet another and so on).

Posted: Tue 11 Apr, 2006 6:35 pm
by coelurus
I wonder, why is there no backface culling on the outer cylinder?
Nice to see moving screenies, not a lot of them around here lately :)

Posted: Wed 12 Apr, 2006 9:46 am
by benryves
coelurus wrote:I wonder, why is there no backface culling on the outer cylinder?
The wall is flagged as being double-sided.

Posted: Wed 12 Apr, 2006 11:51 pm
by tr1p1ea
Wow, awesome stuff ben! Perhaps you can use it in another demo?

Also, the outer cylinder can have its back-faces culled also? (any object can i guess?).

Posted: Thu 13 Apr, 2006 10:28 am
by benryves
The current data structures are:

Code: Select all

vertices:
.dw <x>, <y>
...

lines:
.db <start vertex>, <end vertex>, <flags>, <sector>
...

sectors:
.dw <ceiling height>, <floor height>
...
So, by clearing the least significant bit in a wall's (line) flags byte, it will be culled if required. Setting it sets the wall as double sided, so it is never culled.

Posted: Mon 17 Apr, 2006 9:46 am
by GuillaumeH
benryves wrote:Even if I don't use it in a game myself, I'm aiming for the engine to be nice and modular (along with a simple level format) so that it's easy enough for someone else to plug a game into it.
That would be great news to have at last a 3D engine ready to be used for a game :) Hold on, benryves!

Posted: Tue 18 Apr, 2006 3:58 pm
by benryves
I'm having real issues with clipping lines (walls)... I haven't implemented anything in assembly yet, it's all being done in QB for the moment. ;)

A thread on GDNet.

The problem is more detecting whether a line lies completely outside or just inside the view, as I'm currently "accidentally" moving certain walls that were completely outside into the view, or ending up with zero-length walls on the x=y or x=-y boundaries.

Posted: Wed 19 Apr, 2006 7:34 pm
by coelurus
I don't understand the issue, could you elaborate or rephrase only the problem and not the general idea? Should the discussion be continued in the GD thread?