Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Two 3D world questions - Performance & Object Scale

Author
Message
Schnide
23
Years of Service
User Offline
Joined: 18th Oct 2002
Location: The DarkBASIC Side of the Moon
Posted: 17th Jul 2011 16:21
Hello again.

I'm getting deeper into DB Pro and have a few questions which may or may not be obvious to answer.

Firstly, if I'm creating a map that has 20 buildings in it, is it any more or less efficient in terms of performance (forgetting the time or skill taken for the moment) to build them in a 3D modelling program and import them, or build them out of cubes in DB Pro code and then texture them? In the long run, I know it'll be of a higher quality to model them but I don't want to get into that habit if my creativity runs away with me and so many elaborate models will just kill the framerate.

Secondly, if I'm recreating a real-life map, how do I begin to figure out a scale to do so? Is there a matrix size that's a good equivalent to a metre square area? Or possibly an object that I can import that's a standard size to make everything relative to?

Thank you as always!

schnide
Jeff Miller
21
Years of Service
User Offline
Joined: 22nd Mar 2005
Location: New Jersey, USA
Posted: 17th Jul 2011 23:51
On question 1, I've had excellent results making even complex objects within DBPro using Ian M's MAKE OBJECT NEW command. That command is super-fast. I actually create them in an Excel spreadsheet, including the UV mapping data for textures, and copy the data to Data statements in DBP. Also, the models created with this command are by their nature optimized (triangulated with no degenerate or duplicated triangles, assuming you have thought them through). Also, the planes can be one-sided, whereas the Make Plane (or Plain) construction command in DBP creates a two-sided plane. I've had much faster results in making them in this way than in loading them as object files (either .x or .dbo).
Mr Bigglesworth
18
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 17th Jul 2011 23:57
If you want detail in your game, you will have to use models from a modeling program.
Schnide
23
Years of Service
User Offline
Joined: 18th Oct 2002
Location: The DarkBASIC Side of the Moon
Posted: 18th Jul 2011 16:53
(btw, am I missing an obvious way to reply to specific posts rather than addressing with an @ symbol?)

@Jeff

In Excel? How does that work?! I did suspect that building natively in DB Pro would be faster but thank you for the confirmation. My current thought is that I'll build myself a very simple editor allowing me to create, move around and possibly texture the basic shapes and then output the data in arrays to a file. I'll then copy that back into the program using data statements once it's all finalised.

@Mr Bigglesworth

Thanks, I knew that for the more complex models but I was thinking in terms of buildings, pavements and roads, I could simply make them out of boxes. If the textures are good enough it shouldn't matter for most things in the world and will also be faster. Because otherwise I'd probably want to consider a 'proper' level editing program and find some way to import that into DB Pro for me to use on the programming side. For instance, I'd like to know how something like this was built:

http://www.youtube.com/watch?v=YTajJ0URmss

Apologies if any of this is obvious.. I'm still finding my feet.
Jeff Miller
21
Years of Service
User Offline
Joined: 22nd Mar 2005
Location: New Jersey, USA
Posted: 19th Jul 2011 00:51 Edited at: 19th Jul 2011 00:58
The method I use in Excel is:

First a section with two columns containing the vertex count and the index count.

A second section (vertically) where the columns hold respective X#,Y#,Z#,u#,v#,nx#,ny#,nz#,and diffuse values for each vertex (in order). You can use additional or fewer parameters. With Ian's command, you set the FVF depending on which categories of vertex data you are including. (nx# etc. are normals, but you can sometimes avoid this using the Set Object Normals command after you have created the object with zero default values).(Use decimal number values for all but the double word parameters. So for full diffuse I would use 0xffffffff, setting the column format to "Text"). You will find that in many cases, using formulas for values speeds things up, especially when making angles or curves. For example, if you are making a polygonal disk of say, 16 sides, triangulated from the center, you need only enter a few formulas in the cells and copy them down. Excel takes care of all the calculations. Likewise, using formulas for the u#,v# data that express them as functions of the x#,y# and/or z# values is a great timesaver.

I then add a third series of rows which list the indices. Three (one triangle) to a line. Even here I have found opportunities to use cell formulas to calculate a series of triangles and automate data entry.

With regard to all three sections: at the far right I have a calculated column that arranges each entire line into a properly formatted string Data statement (i.e. beginning with the word "Data" and having comma-separated values). I highlight-select the relevant section of that column, copy, and paste into the appropriate data section in a dba module.

DBP produces the object at almost lighting speed compared to loading the object from an x or dbo file, in my experience.

Login to post a reply

Server time is: 2026-07-10 10:20:18
Your offset time is: 2026-07-10 10:20:18