Drawing a basic polygon, ie a wall.

Blitz3D Forums/Blitz3D Beginners Area/Drawing a basic polygon, ie a wall.

Escapader(Posted 2005) [#1]
I know this is an extremely simple request, but what is the most efficient way of drawing a simple untextured polygon, in this case, a wall. If I can just see how this is done, I'll be able to do all I need. Much thanks.


Rhyolite(Posted 2005) [#2]
Easiest way is to use 'CreateSprite'.

Other way is to use 'CreateMesh', 'CreateSurface' 'AddVertex' and 'AddTriangle'. Read the help manual for explanations ;)

If you are still stuck after experimenting, post your code and ask for help :)

Rhy :)


Escapader(Posted 2005) [#3]
Hey, thanks. Precisely what I wanted actually. Yeah, I should've just browsed through the manual, anyway, thanks!!

Also, just a quick question, are sprites faster than creating a mesh to perform the same task? I assume they would be, as they can't be modified like a mesh.


Rhyolite(Posted 2005) [#4]
Hehe, no! Generaly, sprites are a little slower than creating a 'quad' yourself, but sprites are easier to work with. Depends what you are doing and how many you need?

If you are going to be using a lot of 'walls', then I think you will probably want to create your own mesh and add as many wall sections to a single mesh surface as possible.

Rhy :)


Gord(Posted 2005) [#5]
create a cube and scale it to the correct size.


PowerPC603(Posted 2005) [#6]
If you want to use sprites, then set the SpriteViewMode to 2, otherwise your walls (sprites) will always face the camera and they won't fit nicely together, if you want to create a corridor where you're walking through, for example.


earok(Posted 2005) [#7]
I had a very similar problem with my current project, which is a Wolfenstein 3D clone. The map is handled by a 2 dimensional matrix array, and the values in each variable in the array represented part of the map (wall texture, door, enemy etc)

At first, I simply used individual cube entities to represent the walls. This was simple and worked very well, but with the horribly long and complex maze my brother made for the game, the frame rate was hideously slow, to the point of being completely unplayable.

So, I created functions to create the north, south, east and west sides of a wall. This cut the polygons down by a 3rd, since the top and bottom sides of the wall (which were never seen anyway) were not created.

Then I added in some formulae which stopped the creation of walls that would never be seen, for instance walls-between-walls and walls on the outside of the maze.

Then I added some complicated formulae which, instead of creating a row of individual polygons to represent a long wall, created a single polygon and stretched it to fit. This took me a fair bit of debugging to get right!

Despite all of this the game still ran slower then it should, until I realised that instead of creating individual mesh entities for each block of wall, I should simply set my code to add each block of wall to a single mesh entity which covers the entire level.

The game now runs faster then it ever did before.