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.

Newcomers DBPro Corner / best way to load stuff in "raeltime"

Author
Message
PAGAN_old
18
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 22nd Feb 2008 11:32
I have been warned previously of the dangers of loading in real time (in a loop)

i began experimenting with this concept. I managed to delete an object without any problem while inside the loop.

I realized that i cant load anything into a loop because it keeps giving me an object already exists error

What i need to do is to stop the loop first, load/delete whatever i need and then resume the loop.

My question is how do you stop/resume the loop?

here is something i tried

sync off
load stuff
sync on

the syncs are completely ignored and object already exists thing pops up.
so that doesn't work.

dont hate people who rip you off,cheat and get away with it, learn from them
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 22nd Feb 2008 12:48
"Object Already Exists" is not a result of a loop. It means you have used the same object number twice.
PAGAN_old
18
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 22nd Feb 2008 13:44
oh, yeah i knew that, just didnt explain it correctly

what i meant to say is because an object is loaded in a loop, the loop will try to load the object again.

dont hate people who rip you off,cheat and get away with it, learn from them
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 22nd Feb 2008 16:13
Don't load it in the loop! Load it at the top of the program before the main game loop.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 22nd Feb 2008 18:24
Yeah! But if you NEED Dynamic Loading - which I doubt considering this forum is for new people - um - Save your models as DBO format...How? Make a program that simply LOAD OBJECT "Model.x" followed by SAVE OBJECT "Model.dbo"

Dbo format (native DB File Format) Loads SO FAST its blinding when compared to other file formats.

If you try to load EACH loop though - well - thats a bad idea.

typically people who need this kind of thing make logic so that the "hiccups" or "Dead spots" (short pauses) are made as infrequently as possible so the game isn't to interrupted - also - smaller the better - trying to load a whole level would be crazy like this!

John Y
Synergy Editor Developer
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: UK
Posted: 22nd Feb 2008 18:27
Alternatively, look into the command 'Exit' in the help system. It also works in FOR loops.

EXIT

This command allows you to break from a program loop at any time. Only control loops that have an uncertain exit condition can use this command such as DO LOOP, WHILE and REPEAT loops. EXIT will have no effect on GOTO loops during the running of your program.

Syntax
EXIT

Synergy Editor - Available for free HERE!
Paul08
16
Years of Service
User Offline
Joined: 20th Feb 2008
Location: Oxford, UK
Posted: 22nd Feb 2008 19:16
couldnt you just put the code for loading your object into a subroutine or function, and then based upon a basic if statement within your main loop just call the function/sub routine?? or am i thinking too linear here
PAGAN_old
18
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 22nd Feb 2008 20:55 Edited at: 22nd Feb 2008 21:22
@ Paul08
this seems like the best solution, but i have trouble accomplishing it.

even if i do call the function, it will have to be called inside the loop and that will bring me back to object already exists error.

also i am not sure how to go about this, Is there a way to make it so an object (loaded inside the loop) gets loaded only once?

i tried

if object exist ()=0
load object
endif

Its not interrupting my program but it doesn't load the object i ask it to load, doesn't load anything.

dont hate people who rip you off,cheat and get away with it, learn from them
Paul08
16
Years of Service
User Offline
Joined: 20th Feb 2008
Location: Oxford, UK
Posted: 22nd Feb 2008 21:09
well i am learning dbpro atm and again dont get me wrong im not great but pseudo code wise i would of thought:

do

YOUR MAIN GAME STUFF HERE

if criteria is met then
-call subroutine for loading object-
end if

loop


subroutine load_object()

load object here

end subroutine


Maybe you understood what I was saying and im just over illustrating what i mean - i dont know.
Paul08
16
Years of Service
User Offline
Joined: 20th Feb 2008
Location: Oxford, UK
Posted: 22nd Feb 2008 21:31
sorry about the above post which will come through soon, it's been a long day and i missed the fact you said you had already tried it. (im still on the "newbies" activation list so have to wait for a post before i can edit it..)
Anonymous User
16
Years of Service
User Offline
Joined: 21st Feb 2008
Location:
Posted: 22nd Feb 2008 23:52
Multi-threading is impossible with loading objects in dark basic pro so your going to have to load the objects in the main loop. Loading small chunks periodically would be the best method performance wise.

However, do you really need to do this? Judging by your join date your pretty new like me, but to tell you the truth hardly any games include real time loading. And those that do are optimized to death and coded for running on multi-core processors.

???
Paul08
16
Years of Service
User Offline
Joined: 20th Feb 2008
Location: Oxford, UK
Posted: 23rd Feb 2008 00:25
As anonymous says, perhaps just load the object, place it out of view, or even use the hide object command, until you need it?
PAGAN_old
18
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 23rd Feb 2008 02:02
i played around with hiding objects a while ago, it didn't help much, the object is hidden but it still exists so it still takes up performance.

dont hate people who rip you off,cheat and get away with it, learn from them
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 23rd Feb 2008 02:37
From what I read in your posts so far, you have told us what you have done but doesn't work, along with what you want to do.

The important thing I want to know is why?

I think that understanding what you are trying to do and the reason for it would help us to answer you question better.

For example - exactly what do you mean by 'real-time'?

If a game has multiple levels, you don't load all the objects for every level at the start of the first level - you only load the objects required at the start of each level. Do you class that as 'real-time'?

TDK_Man

PAGAN_old
18
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 23rd Feb 2008 03:03
Something tells me that this dosen't exactly belong in a newcomers forum, am i right?

What i am doing is, as the character moves through the level, small parts behind the character get deleted (no problem with that), As the character moves ahead, small pieces of the level need to get loaded in front of the character. Since all of this is going on in a main loop, i cant really load anything. I have tried calling functions and subroutines that have the loading commands from outside the loop , but when they are called inside the loop, the loop will try to load them again (because its a loop). I need help with figuring out how to make something load while in a loop.

perhaps pausing the loop then loading then resuming the loop (i do not know how to do this)

or making it load only once somehow. The only thing for this method i came up with is





I did not get any results from this one, perhaps i am missing something

dont hate people who rip you off,cheat and get away with it, learn from them
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 23rd Feb 2008 03:23 Edited at: 23rd Feb 2008 03:41
PAGAN!!! Hiding Object does help - but EXCLUDING OBJECT (Set Object Exclude On ...I think it is) helps ALOT MORE! Takes it out of rendered pipeline - but also the instances that were made from it - good way to hide ALL TREES at once! LOL

[edit]just read your last post closer - creating and deleting objects constantly rears a bug in DarkGDK, DBPro, and likely DBClassic - One thing to do it setting game up - but constantly deleting/creating objects in game is asking your game to crash after a while. Better to load and hide/show exclude on/Exclude off at will.
[/edit]

PAGAN_old
18
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 23rd Feb 2008 03:45 Edited at: 23rd Feb 2008 03:45
@jason

i looked in the index and didn't find the exclude command you were talking about

also tried it didn't work. Is this command by any chance from DarkGDK? because i am using DBpro

dont hate people who rip you off,cheat and get away with it, learn from them
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 23rd Feb 2008 03:53
This is the DBPro forum - you have DBPro?


Help Snippet - In Appearance commands - Basic 3d area - also see Exclude Object Off


PAGAN_old
18
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 23rd Feb 2008 03:58
is this a new feature? I cant find this command and my DBpro is outdated

dont hate people who rip you off,cheat and get away with it, learn from them
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
PAGAN_old
18
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 23rd Feb 2008 05:23
oh my, i just realized that i spelled "real time" wrong in the title of this thread

dont hate people who rip you off,cheat and get away with it, learn from them
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 23rd Feb 2008 05:31
Don't Sweat it - "raeltime" time is what trains use

PAGAN_old
18
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 23rd Feb 2008 07:49
I HAVE A BREAKTHROUGH!

i decided to clean out and reorganize my code and get rid of the extra crap i have, and apparently some piece of trash code was interfering. After i cleaned out the crap, i noticed that i have one piece of terrain that was labeled to load in a loop, so i looked back at my code, and i had an

do
if object exist()=0
load object
end if
loop

so i tried making it load after a certain condition happened in real time And t my surprise, a piece of terrain popped in front of my player just like i wanted.






dont hate people who rip you off,cheat and get away with it, learn from them

Login to post a reply

Server time is: 2024-11-25 07:33:32
Your offset time is: 2024-11-25 07:33:32