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 / Which is the best way to load 3D objects...?

Author
Message
Da_Rhyno
15
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 29th Sep 2011 21:13
So, I'm coming to a conclusion that it's more of a pain in the arse than is necessary to try and do 3D on a 2D map. So, I'm caving in and I'm going to switch everything to 3D.

Now to save me time, I was to be able to use the built-in object collision, which means I want to be able to load my 3D files as objects.

When I first started using these forums, I saw a method for loading Wavefront objects using Vertex Data for previous made objects then adding limbs to it. I tried finding the thread, and it ended up being futile to try to do so.

Then I ended up making my own method to load 3D objects, which was to make a memblock of appropriate size, then put all the object data into that and then load the object via that.

Now my question is... which is the better method of loading my own 3D objects? Building them up from previous objects using vertex data (which I'd have to research how to do so), or using memblocks?

Now, mind you this will be for both my world and my characters.

Since my characters are going to be animated (not bone animation, rather frame-by-frame animation), I'm going to have to make them animated objects.

Does anyone have any suggestions for that also?

Thanks.
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 29th Sep 2011 22:15 Edited at: 29th Sep 2011 22:16
Whether you have them as .x or .dbo (dbo which is always best for DBPro, loads the fastest because its native), however you create your level there is a useful part called instancing "INSTANCE OBJECT Object Number, Source Object
", which saves on memory by kinda cloning the object but using the same vertex data as the original. This comes in handy for the level itself, and saves you from re-loading the same object over and over again.

Also pre-caching your 'level' objects so that you're not loading them during game-play.

Animations, I don't know enough of yet apart from what I've read on these forums. Something about frame start and frame end, etc...

Collision can be a difficult one but if you're checking collision against a level which is made up of tons of objects then you may as well get your head stuck into Sparkys, not just because it has group collision, but for first person, it will do sliding collision. There's a smidgin' bit of a learning curve with that though.

When it comes back to objects as you've mentioned, .obj (or wavefront) you are best off getting the object into a .x or best still a .dbo file.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Da_Rhyno
15
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 29th Sep 2011 22:35
Thanks for the advice!

Well, if I'm to make a file loader is what I'm saying. I know the built-in objects in DBP are .DBOs, so if I can get vertex/face/texture data from my own file and make an object out of that data, then I should be good with that for levels. Add frames to the scenario, and I'll be well off with everything.

I think there's a DBO info file in my install... I'll have to look at it to see if there's anything about multiple frames in it.
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 29th Sep 2011 23:25 Edited at: 29th Sep 2011 23:30
I did this some time ago: http://forum.thegamecreators.com/?m=forum_view&t=183982&b=1 which is basically a level editor and automatically sets up collision for sparky's. Probably not what you were exactly after. But it also handles every objects details, emissive, specular, ghosting, etc.

What you're after is loading a pre-set level object list and then building your level map by instancing those objects. After that the game field is just another set of objects.

Keeping track of everything can be awkward which is why UDT's and arrays must have been invented. Global variables can store these in DBPro though. After closing down the level, just call the clean up function.

Fingers crossed man, you'll figure some of the odd bits out. Sounds like you've already got your noggin around what you're after.

Ah ha, been a while, the WIP : http://forum.thegamecreators.com/?m=forum_view&t=182641&b=22

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Da_Rhyno
15
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 29th Sep 2011 23:43 Edited at: 29th Sep 2011 23:47
Thanks man! I might actually try using that for my game.

BTW, I thought I posted my 3D object loader code before in the snippets section, but I guess not.

Here it is, and attached are the media files needed:



I still have to wrap my head around how to work the animations. I looked at that documentation file for .DBOs that comes with the DBPro help, and it's a bit confusing on how the files are set up among other things.

And regarding the WIP... xD Shouldn't mods remove that since you already released it?
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 29th Sep 2011 23:50 Edited at: 29th Sep 2011 23:52
You could just render your 3D models, I suppose it depends on how many angles you want. You would probably need too many frames. Anyway I have to use DBPro to make some 3D to 2D animations soon as well. I was just going to save screens. I have rendered the parts which have less angles.

WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 29th Sep 2011 23:54 Edited at: 29th Sep 2011 23:55
TrueSpace 7.61 (which .obj files are standard and is now FREE) exports .x files. Doing it that way your final object can be loaded into a dummy DBPro program and saved as a .dbo.

I'm more used to video editing and not 3D animation but I'm assuming that exporting a .x with animation, then the tick/clock/frame settings of the export module would basically be what's used in DBPro. Don't quote me on that, I've not tried it ever yet...

EDIT: Also you're 3d on a 2d map, would be simply done using cloned/instanced objects and placed similar to what you would do in 2D but using X,Z coords instead.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Da_Rhyno
15
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 30th Sep 2011 00:05
Quote: "EDIT: Also you're 3d on a 2d map, would be simply done using cloned/instanced objects and placed similar to what you would do in 2D but using X,Z coords instead.
"


Would that also work for sprites overlapping 3D objects and then having them have the ability to go behind them, since the 3D objects will be characters in the game?

I would be making something similar in mechanics to this:
http://www.youtube.com/watch?v=wuIFG848WZs
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 30th Sep 2011 00:12
Plains can be used as sprites, and go behind other objects.

WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 30th Sep 2011 00:15
You would use the images and texture the plane objects and then place the plane objects on the x, z coords....

By default 2D is usually drawn after a 3d render, but that's a different subject. Text does, pasting images does. Don't know about sprites.

The LBA video would be so much easier using a list of 3d pre-fabricated models and would look better because of the camera control you'll learn along the way.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Da_Rhyno
15
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 30th Sep 2011 00:17
True, but the question at that point is "How far behind?" hence why I'm thinking about switching to full 3D now. Reason being, if all I had to work with was the 2D projection of the 3D object, that would be easy since I could set up a bounding square for collision detection, and not worry about the Z coordinate.
Da_Rhyno
15
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 30th Sep 2011 00:17
Yeah... 3D will probably be simpler with this.
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 30th Sep 2011 00:22
Any 3d program that you use will basically give you what you will expect in DBPro. If you place your object at 0,0,0 (x,y,z), then you'll need to view it, ie placing your camera at 0,0,-10, "position camera 0,0,-10" (the z value can be double your object size in this case object size is 5 just for example). You might also need to point your camera to a particular point, using "point camera 0,0,0".

It isn't really that hard and you do get some great results over 2D.

Have a toy around and you'll amaze yourself. I did sometime ago after I left programming the Amiga...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Da_Rhyno
15
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 30th Sep 2011 00:26
Believe me, I actually did play around with it and I like it.

I used to program 3D stuff using pure maths in FreeBASIC, which was fun.

After making my own equations and stuff to do this same thing, DBPro's 3D is a piece of cake.

I just don't fully understand the .DBO file format yet.
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 30th Sep 2011 00:32
Neither do I, and when it comes to the animations then others can help much more than myself. I can build and object from scratch and that's about it but you've already played with those commands too by the look of your code...

I'll be following your progress if you don't mind man. Along the way I'll also pick up a few things about animations so I may be able to help out here and there.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Da_Rhyno
15
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 30th Sep 2011 00:39
Thanks! And by all means, feel free to follow and ask questions if you have any/offer advice. As I see it, we're all here to help each other.

<- Except for this guy, here's here to eat you.

I'll keep playing with the objects and hopefully someone can enlighten us as to how things work with the DBO structure. Otherwise, there /are/ alternate methods of animation rather than using the built in "PLAY OBJECT".

One I just thought of would be to have multiple limbs representing each frame of the object, and then hiding the previous limb and showing the current limb.

I'll have to play with it.
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 30th Sep 2011 00:53
The forums searches have many, many, infinite answers to play object and limb animation stuff. One I have noticed from the forums is that play object is much slower than just setting the frame number. Don't know why, just people moan about it, so when it comes to it I'll just be setting a frame instead of using the play object command.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Da_Rhyno
15
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 30th Sep 2011 01:01
Yeah... I tried setting a frame number and changing the object on the spot to see if it would add a frame. Didn't work, so I think I'll try the limb concept.

Login to post a reply

Server time is: 2026-07-11 09:49:28
Your offset time is: 2026-07-11 09:49:28