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 / Loading an object multiple times

Author
Message
Maxi
13
Years of Service
User Offline
Joined: 20th Jul 2012
Location:
Posted: 4th Nov 2012 17:09
Hello,

lately I am coding a RPG-Designer, with which it will be possible to create a 3D-midage-RPG with own wheapons, world and characters.

In the mapmaker i noticed one problem:
When loading an object multiple times, or even cloning it, it will always load the object from the harddrive. This takes emense amount of time for larger maps to load.

After looking through the commands, and on the forums, my question is:
Is there any way to load an object to memory, so i can load it from that over and over? (excluding the INSTANCE OBJECT command)
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 4th Nov 2012 17:33
clone object will copy an object from memory. It doesn't load it from the hard drive again.

TheComet

- The codebase
Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 4th Nov 2012 17:48
Quote: "clone object will copy an object from memory. It doesn't load it from the hard drive again."

humm i wonder who told you that?

Advanced Updater for your games!
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 4th Nov 2012 18:15
Quote: "humm i wonder who told you that?"


?? What do you mean Sergey, you've got me wondering now? lol



Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 4th Nov 2012 18:46
Quote: "What do you mean Sergey, you've got me wondering now? lol"

its between me and TheComet

on his PonyCraft engine he was used "load object" to load the object over and over again..
but then i told him he can use "clone object" to make faster loading..

Advanced Updater for your games!
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 4th Nov 2012 19:04
oh, roger that!

Maxi
13
Years of Service
User Offline
Joined: 20th Jul 2012
Location:
Posted: 4th Nov 2012 19:20
the thing is that i tried loading up 500 of the same object by loading them from harddrive, and by cloaning, and took exactly the same time (about a minute).
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 4th Nov 2012 21:01
Quote: "oh, roger that!"


Andrew_Neale
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 4th Nov 2012 21:24 Edited at: 4th Nov 2012 21:25
Quote: "the thing is that i tried loading up 500 of the same object by loading them from harddrive, and by cloaning, and took exactly the same time (about a minute)."


If they genuinely took the same amount of time then the hard drive access can't be the bottle neck here.

The other thing you could try would be to make a mesh from the object (make mesh from object MeshId, ObjectId) so that the mesh is in memory and then make further objects from that mesh (make object ObjectId, MeshId, ImageId).

My other suggestion would be to ensure you are using .dbo files for faster loading. If you aren't already then you can convert .x or .3ds files fairly easily by loading them in and then using 'save object Filename$, ObjectId' to save and making sure the filename extension is '.dbo'.


Previously TEH_CODERER.
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 4th Nov 2012 21:41 Edited at: 4th Nov 2012 21:43
Quote: "the thing is that i tried loading up 500 of the same object by loading them from harddrive, and by cloaning, and took exactly the same time (about a minute). "


In agreement with the previous post, if I might add; the command, Instance Object, may also provide faster update results, but such objects share the same mesh in memory.

I think you will find that Instance Object will do the duplication 10 to 20 times faster than Clone Object.

There are many ways to skin the cat; as stated try alternative methods using meshes and memblocks.

Maxi
13
Years of Service
User Offline
Joined: 20th Jul 2012
Location:
Posted: 4th Nov 2012 23:43
Thanks alot andrew,

I wrote a short converter, so that my objects would be .dbo, and it loaded the same map as before, which took a minute at first, in about a second
Andrew_Neale
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 5th Nov 2012 13:23
No problem, I'm glad it helped!

DBPro definitely seems to handle its native format a heck of a lot better than .x or .3ds. From memory this is because, behind the scenes, when you load a .x or .3ds it actually gets converted to .dbo format first anyway, so this cuts out that whole step.


Previously TEH_CODERER.
Zotoaster
21
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 5th Nov 2012 13:49
Isn't instance object supposed to be more efficient than clone object?

"everyone forgets a semi-colon sometimes." - Phaelax
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 7th Nov 2012 17:31
I still get texture issues with .dbo... could just be 3DWS... which no longer works for me in Windows 8... Any workarounds? [ie. texture fix]

Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 7th Nov 2012 17:57 Edited at: 7th Nov 2012 18:00
Clone object will create a new, seperate copy of the object.
With a Cloned object, you can have different textures, animations etc applied to them. Good for NPC's etc.

Instance object will use the same data.
With an Instanced object, they all have the same texture, animation etc. Good for foliage, trees etc.

Use Clone object when duplicate objects will change in some way, and Instance object when they will never change.


*edit* Got them the wrong way around!

I live for video games! (And beers, and football, and cars!)
See what I live for here: [url]http:\\www.TeamDefiant.co.uk[/url]
Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 7th Nov 2012 17:59 Edited at: 7th Nov 2012 18:00
Quote: "Isn't instance object supposed to be more efficient than clone object?"

if i remember right, it just making a mirror of the object. so it doesnt acts like a single object on its own

edit

Quote: "With an instanced object, you can have different textures, animations etc applied to them. Good for NPC's etc."


didnt know that

Advanced Updater for your games!
Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 8th Nov 2012 01:50
A good concept to also build on this is the idea of a Cache.

You can benefit from loading objects you know you will need or are likely to need in advance. Hide/Exclude from view these objects. Then Clone them when ever they become needed.

Login to post a reply

Server time is: 2026-07-10 08:39:35
Your offset time is: 2026-07-10 08:39:35