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 objects on the fly without pausing, can it be done????

Author
Message
Cpt Caveman
23
Years of Service
User Offline
Joined: 29th Aug 2002
Location: New Zealand
Posted: 17th Jun 2003 13:03
In a game like Morrowind the blocks of land load as you cross from one to another and it pauses briefly while it does so. But in GTA3:Vice City, it has a huge city that loads only once and never pauses, and Dungeon Siege loaded at the beginning and you could play the whole game through(if you didnt want to sleep) without it loading anything in again which didnt cause the game to pause. Can this be done with DBPro???
Beta1
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location:
Posted: 17th Jun 2003 13:29
Probably if your a bit clever.

Ask Pneuamticdryll - he's got a pretty good landscape system that works over huge distances.

Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 17th Jun 2003 13:36
It really depends upon the complexity of the objects. If you construct your world from simple objects such as plains and cubes you can deform and retexture meshes very quickly in runtime.

The key to massive scale terrain is re-useability, don't waste a resource, have no object that exists to depict one thing in the world, make a couple of textures for it, some optional limb pieces etcetera and use the object as many times as you can.

If you want to make your world out of complex objects with something like a BSP editor or some such, then you are limited to pre-loading or shuttle-loading pauses.

Pneumatic Dryll
Soyuz
23
Years of Service
User Offline
Joined: 17th Dec 2002
Location:
Posted: 17th Jun 2003 13:53
I sent an email to Lee querying if it was possible to load objects in over a period of code passes - instead of doing "Ahh I now have to load a file so I shall pause everything until this is complete". ie if the loading could be spread out so as not to reduce the visual FPS then this could open up a lot of possibilities.

Sure may be potential problems here but surely the potential gains outways the negatives.

This is Lee's response,

" "
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 17th Jun 2003 13:55 Edited at: 17th Jun 2003 13:55
@Elemenop

Either

1) Ask IanM for his DLL which allows you to load models in in another thread, so the loading does not interefere with the running of your program. It loads it into memblocks whilst your program is running normally.

2) Load the model in, save the mesh out via memblocks, at runtime you can load it and the texture back in via memblocks and meshes and load a static object in < 30ms. I don't think this method would work for animated objects.

I can supply code later if you want.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_103.zip
Cpt Caveman
23
Years of Service
User Offline
Joined: 29th Aug 2002
Location: New Zealand
Posted: 17th Jun 2003 14:13
Thanks for your advice, any code would be greatly appreciated. We have started our Morrowind type game but in a modern setting and are trying to workout how to load in blocks of land without the slowdown associated with it as we are currently having problems with. We have tried loading the blocks into arrays which are called up when needed but more blocks have to be loaded as you progress and this is what is causing the problem with slowdown. So I say again any code that could help us would be awesome. Thanks
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 17th Jun 2003 14:35
Help yourself to the DLL It's on my website.

Here's how it works:
You add a filename to the 'loading' queue (or as many files as you want) and gives you a handle back.
It loads the data into memory and adds the data to the 'loaded' list.
When you want the data, you check that it has loaded (using the handle).
If it has, you can then get the data copied into the memblock of your choice.
The data will hang around on the 'loaded' list until you specifically delete it.

This means that any resource you can make from a memblock can be loaded when you want (meshes/images/sounds etc.)
Cpt Caveman
23
Years of Service
User Offline
Joined: 29th Aug 2002
Location: New Zealand
Posted: 17th Jun 2003 14:41
Thats great, I wonder how much memory I need to load in lots of objects and to avoid the memblock limit
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 17th Jun 2003 15:01
The only time the DLL touches a memblock is when you tell it you want data. It will then clear the existing memblock if there is one, create a new memblock of the required size and then copy the data into it. Then, its job is done.

What you do with the memblock from then on is up to you. You can keep it there forever, or delete it, reuse it for something else, or tell the DLL to load the next set of data there.

You only need to worry about the amount of memory that you need, but if you limit yourself to pre-loading objects that are due to come into view/range, even that should not be much of a problem.
MasterInsan0
23
Years of Service
User Offline
Joined: 14th May 2003
Location: United States
Posted: 17th Jun 2003 21:25
Could you possibly load BSPs with this method? I don't really know much about memblocks, but after looking over the commands, I would figure not. However, it never hurts to ask.

I'm stuck with a static loading screen in my game because when loading the BSP level, it essentially freezes until done. I wanted to make a neat little animated loading screen with the periods going ".", "..", "...", and so forth.

Also, I was once thinking of asking on this board for a dll that allows you to check to see if an object is loaded yet or not. It might work in combination with this (for example, on a slower computer you could bring up a loading screen in a no-pausing world if it wouldn't load fast enough, just in case). I can just imagine what would happen on a really slow computer, or one with a virus scanner running in the background or something. The player would walk into nothingness and fall endlessly, only to see the level appear above them as they fall...heheh.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 17th Jun 2003 21:35
There's currently no way to convert from a memblock to a BSP, so no it won't work for you.
MasterInsan0
23
Years of Service
User Offline
Joined: 14th May 2003
Location: United States
Posted: 17th Jun 2003 21:36
I see...
Oh well.
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 17th Jun 2003 23:44
BSPs load pretty fast, do it the Half-Life way and spread your levels out into smaller BSPs.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_103.zip
The Wendigo
23
Years of Service
User Offline
Joined: 13th Sep 2002
Location: A hole near the base of a tree in the US
Posted: 18th Jun 2003 08:41
Go RobK! That's the way I would do it. As for the many objects thing, the only thing I can think that would be easy is to load in a variety of meshes and the textures to go with the meshes. Then use MAKE OBJECT to load on the fly. It's very fast from what I've seen, but all your objects can only have one texture each. Still, it's the way I prefer to go.

Current Projects: mini BSP maker 50%, Height Mapper with many features 75%, FPS/RTT Nameless at the moment 15%
Cpt Caveman
23
Years of Service
User Offline
Joined: 29th Aug 2002
Location: New Zealand
Posted: 18th Jun 2003 13:20
I had a go at the memblock dll but I just can get it to retrieve the objects(anything really) that Ive loaded into it. Any help would be nice
Soyuz
23
Years of Service
User Offline
Joined: 17th Dec 2002
Location:
Posted: 18th Jun 2003 13:34
I made a post last night which may be relevant here. Creating objects I find takes hardly any time at all in whatever circumstace, it's deleteing them that can be time consuming.

I have a scene with 80,000 polys (max 15,000 vis). If I create a four poly object in this scene it is made instantly. If I then do "DELETE OBJECT" it takes around 0.5 seconds to remove it. Deleting the same object in an empty scene is instant. Imagine you create a bunch of bullets and then want to delete them afterwards - 10 bullets would take 2 seconds to delete - a bad pause for a game (ok you could reuse bullets - this is just an example). The time to delete an object is proportional to the number of polys loaded.
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 18th Jun 2003 17:47
Why delete the bullets? just have an array of bullets, of say 100, when they reach their target, hide them. When the player shoots reposition the bullets back where the gun is, set up direction vectors and show them.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_103.zip
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 18th Jun 2003 17:59 Edited at: 18th Jun 2003 18:00
Elemenop, What you were probably doing is loading the data directly into the memblock from your 'x' object or bitmap etc, but the data needs to be in memblock format in the first place.

Here's example code for you to try:



The file 'example.x' should be created using wordpad from the data I've put into the Code button.

Login to post a reply

Server time is: 2026-07-11 14:56:53
Your offset time is: 2026-07-11 14:56:53