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 / Implementing a loading screen

Author
Message
KTCO_Tonesy
15
Years of Service
User Offline
Joined: 6th Mar 2011
Location: dark_basic
Posted: 25th May 2011 14:14
Not sure this is the correct place for this, so i apologise if there is errors on this!

My problem lies in a loading screen which is to act as the bridge between my menu and my game... All other images load as i planned but when i get to "splash screen" the image fails to load and i get a black screen.
I've tried texture backdrop followed by imag num and no luck with that... Any help on how i can get the image onscreen would be much appreciated!!!

Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 25th May 2011 16:45
Sorry i don't have much time, just some tips:
- Put the syncs to the right places
- Forget about the Wait command in loops...

-In.Dev.X: A unique heavy story based shoot'em ~25%
-CoreFleet: An underground commander unit based RTS ~15%
-TailsVSEggman: An Sonic themed RTS under development for idea presentation to Sega ~15%
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 25th May 2011 18:45
Isn't there a plugin for DBP for multithreading? That would help a lot when making something like a loading screen, since you can load everything in a seperate thread, and have the main thread display a cool animation and what is currently loaded.

TheComet

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 25th May 2011 18:48
I agree in principle to Quel here but this is a splash screen so some waiting might be wanted, just not everywhere you have it. What's worse is you have a goto from within a loop to outside that loop which is a NO! Better to use "exit"...

Here's an example using your code:

...then you might want to goSUB your menu code before you start your game loop.

I hope that helps?

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 25th May 2011 18:52
Quote: "Isn't there a plugin for DBP for multithreading? That would help a lot when making something like a loading screen, since you can load everything in a seperate thread, and have the main thread display a cool animation and what is currently loaded."

I think I saw something regarding multi-threading but for some reason it is very unstable. I wouldn't personally risk it but it's a nice idea to have a cool animation while loading... maybe you could have a seperate exe that displays data output from the main exe as it loads the media?

Kind of off topic, would make an interesting debate in a new thread though?

Penfold
22
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: RED postbox houses of parliment
Posted: 25th May 2011 20:56
also you could load the splash screen in the background when your menu comes up so that its ready for when you need it.unless its a huge splash screen it should have loaded before your user can make a menu selection therefor saving on wait time after the selection has been made.

ala

load menu
load spash
user menu input
paste splash to screen
sync off
load all your gubbins
sync on
continue

'Ooh 'eck chief'...'crumbs'
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 25th May 2011 21:50
The first DO/LOOP is pointless since it just goes through each command and leaves the DO/LOOP when the GOTO is hit. The GOTO itself is pointless too since it goes a few lines down and only skips REM statements.

For SYNC to be seen at all you first have to turn on syncing by using SYCN ON. Then every time you change the screen every time you want a change to be seen you have to SYNC (like Quel mentioned and Baxslash shows). If you don't have a SYNC after every change to the screen the user will never see any change. The first WAIT is annoying... who wants to stare at a blank screen for just under a minute? And the last two TEXT commands are pointless because right after them is a CLS command that clears the whole screen.



It's better to not use an absolute path like that with SET DIR because none of us have that path. Use the directory that the user puts your program in instead. You can load things like images with "media\conversation.png" if you want that particular image in the Media directory inside the main program directory (whatever that may be).

To pause the action and wait for a key to be hit by the user it's better to just use WAIT KEY instead of checking for the spacebar to leave the DO/LOOP on the splash screen. You don't even need a DO/LOOP there unless you want it to constantly paste that image and show that text over and over again till the user hits the spacebar.

KTCO_Tonesy
15
Years of Service
User Offline
Joined: 6th Mar 2011
Location: dark_basic
Posted: 25th May 2011 22:51
Cheers for the insight guys Im sorry for my poor programming skills, Im just learning at the moment and obviously not 100 percent like you!

After taking in all the valuable experience n reshuffling my code, I've managed to speed up the game so I thank you for that ! However, even after I took your advice, this still doesn't work! Here's what I put together with your advice :
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 26th May 2011 10:11
Again there's no need for the loop here... when it's something that runs once then ends don't put it in a loop unless you need to run it again later in which case put it in a sub-routine or function:



KTCO_Tonesy
15
Years of Service
User Offline
Joined: 6th Mar 2011
Location: dark_basic
Posted: 26th May 2011 13:50
Thanks @ baxslash! Finally undertsand what everyone was teeling me now! I thought the DO...Loop was something you had to use for everything. As i say I'm still a little new to this. Im only at college and this is the first solo project we've been assigned

So apologies once again lol! I have now reorder and polished off the rest of my code and it seems to work a lot faster still. However, once again I get no image on the screen, just the text!) , I'm not meaning to be a nusiance here, just this problem seemss way bigger than it should be. Considering I have the game up and running this is a trivial error which I cant overcome.
Does it help/would it affect anything if i said I was using the "Code surge" compiler to impelement my code ? I used this so that I could have seperate codes A seperate file for my misc codes and menus.
Thanks in advance
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 26th May 2011 16:19
I cant figure out anything now, do you just want a splash screen upon starting the game?,
why not load the image before any do loops

LOAD IMAGE "\media\image1.bmp",1

then make it your backgrouns, aka backdrop, like this

TEXTURE BACKDROP 1

then you can go on to loading your menu and replace the background with anything you want, I am still working on this, so I will make updates on this background thing as time goes by, I will have some real stuff regarding it once I get my new company website up and running just need that darn SSL connection for HTTP get data to work ^^

(I am no pro ad DBPro as of yet, only startes since I been registerred on these forums, Hands On Dark Basic books are a real good helper I bought the PDF editions as i hate fiddling with hard copies all the time and they wear and tear lol but yeah those books are well worth the money)

also you might want to take a look at STYX I bought it recently, and I love the splash screen it has, I am yet to figure out how I can measure loading % values...

hope this helped

SH4773R
16
Years of Service
User Offline
Joined: 18th Jan 2010
Location: AMERICA!!!
Posted: 27th May 2011 10:06
@mtV

For % loading why not just divide 100 by the number of things you need to load then add to the % each time you load somthing?

Example: load 4 images
100/4=25




My software never has bugs, it just develops random features.
C4: silly putty for men.
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 27th May 2011 10:35 Edited at: 27th May 2011 10:51
@ Commico Inc

I shall give it a go, however there is no info about how to place the loading bar

However I want to add "I always knew I would fall hyperthetically in love with you" in other words thank you so much

I just had a fish around in my projects folder and found a styx folder... why didnt I think of this before... let me think... oh it was never mentioned

thank you none-the-less Commico Inc, hope i can get advice from you more in near future

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 27th May 2011 10:56 Edited at: 27th May 2011 10:57
Here is some code I use for loading bars:


MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 27th May 2011 11:01
I had a look at the styx loading splash, i can just about understand the syntax, in fact its all there for me really, but... umm well, I can not understand the images... maybe I should just replicate them haha and make my own details... oh well...

its just those dual images that confuse me... (points to loading bar image)

KTCO_Tonesy
15
Years of Service
User Offline
Joined: 6th Mar 2011
Location: dark_basic
Posted: 29th May 2011 15:37
Cheers for all support and help guys !

Will let you know how it goes

Login to post a reply

Server time is: 2026-07-11 02:36:57
Your offset time is: 2026-07-11 02:36:57