Polygon Efficiency

Blitz3D Forums/Blitz3D Beginners Area/Polygon Efficiency

earok(Posted 2005) [#1]
Hi there,

I've started working on my next project, a first person shooter that spoofs Wolfenstein 3D.

Like Wolfenstein 3D, the levels feature very basic square archetecture. The map is made up of a grid, represented by a 2D array, and each value in that array represents either a wall, an open space, a player or an object etc etc. This works very well except..

It runs very slow on some levels that have been made. Granted, I dont have a super high performance PC (2.8ghz PIV Laptop with crap graphics) but I think it still should run faster. Levels where theres lots of wall and very little open space run exceptionally slow, presumably because of the large number of polygons (for instance, if the 48*48 map was filled with walls, there would be 2304 blocks, and since cubes have six sides that means that there would be 13824 textured polygons being rendered every cyle).

So what should I do? I had thought of a couple of possible solutions, including cutting the top and bottom off each cube, since neither are actually seen in the game (reducing the number of polygons by a third). Cutting out the polygons between walls might chop polygons down by another half, but im not aware of a way to remove individual sides from a cube made with the createcube() function, so would I have to create a mesh from scratch? how should I go about doing that?

Cutting back the viewing range speed things up a little bit, but not much. Is there any other obvious techniques for speeding things up that i've overlooked?


Many thanks!
--
Erik Hogan


Rhyolite(Posted 2005) [#2]
Hi,

Do not use cubes at all. Check out the surface and vertex commands and create 'flat' single sided walls. Also, try and link all your wall sections together into a single surface were possible. If you dont now what I am on about, do some searches - no point repeating whats already out there ;)

Rhy :)


Nicstt(Posted 2005) [#3]
better still design the map externally. Maplet is available for free from http://www.blitzbasic.com/Products/maplet.php

Others available check out some links from website.

Also:
http://www.codersworkshop.com/

http://www.thegamecreators.com/

I use Cartography Shop 4.1, found it decent so far, only thing I wish i could combine vertices, would make lighting much easier.


Matty(Posted 2005) [#4]
I wrote something similar which runs fine on my old AMD 500 Mhz PC with Blitz3d:

This game uses a grid based method of laying out the environment and comes complete with source code (blitz3d). Feel free to do what you want with it. Have a look at the various level text files and the level building code to get an idea as to what I did for something similar:

http://home.swiftdsl.com.au/~gezeder/lloyd/graverobber.zip


earok(Posted 2005) [#5]
Hey thanks for your help guys.

Rhyolite, i'll give that a go. I've now successfully made a couple of of walls in my game manually with vertexes and triangles, and it does run faster, but I still havent got all of the sides working correctly so i've still got a lot of tweaking to do.

Nicoust, I use Cartography Shop and DelED for most of my level design work for my other projects, however since my game is based on Wolfenstein 3D it has to be very simplistic, and so i've decided to create my own mapmaker customised for the game. I'll probably use some external editors for editing the objects that appear in my game.

Matty, that game looks really cool. Graphics remind me a lot of Dungeon Keeper. If you dont mind i'll have a careful look through the source sometime and see if I can learn a thing or too.


Many thanks,
--
Erik Hogan