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 Discussion / Programming a level progression?

Years of Service
User Offline
Joined: 25th Nov 2002
Location: Canada
Posted: 5th Dec 2002 11:38
The game I am working on is nearly complete. Presently it sits on my hard drive as about a dozen seperate pieces, all that remains to be done is to assemble them into the full game.

The game itself progresses in a linear difficulty pattern like an arcade game so level 1 always comes first, then 2, then 3, etc. until the player runs out of lives. Then the game runs a high score routine and returns to the main menu.

Each of my levels is saved as a seperate .dba file. While a lot of code is repeated, I found it easier to manage the differences in levels by coding them each seperately.

The Challenge:
At this moment the main .dba file is the opening menu screen What I'm trying to wrap my head around is how to call each of the sub levels from within my main loop.

Once the player beats the first level I'm required to exit the level_1() function and come back to the main menu .dba (without actually loading up the menu itself). From there I have to load level_2 seamlessly.

Also once gameplay is completed I need to reload all of my menu graphics and sounds (which were dumped at to make room for the levels being loaded) so the player can exit or play again.

I guess what I'm asking is if anyone here has had experience with building games that use multiple levels and what techniques you think are best to accomplish this in Dark Basic.

Bear in mind that this isn't the same level being played over and over at higher difficulties. Each level needs to be loaded seperately and all the graphics discarded before loading the next one.

Any ideas or information you guys have to offer would be really helpful. My game is still in easy to manage chunks so it should be flexible to any ideas you come up with. Thanks for the help!
Years of Service
User Offline
Joined: 6th Dec 2002
Posted: 7th Dec 2002 03:59
First of all make sure your loadlevel() functions include the code to load the graphics and have a loadmenu() function. Then have a variable called state or something that and change it to menu or levelx as required. In the main loop just say if state=menu then loadmenu().

Shadow Robert
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 7th Dec 2002 06:05
Firstly transfer all the most used functions into the main DBA ... then move all similar used functions in to seperate DBAs which are included.

Right there you've gained speed - not nessary but good none the less.

Now I'd suggest that you edit each of the levels to run fron pre-set data so each level can be a set of figures in binary ... allows for samller subfiles, also allows for quite speedy access.

Without knowing what the game is and the possible level arcitecture i wouldn't be able to begin explain howto acomplish this ... however if you make sure the functions you call regularly are close, preferably written in the order most called directly after the main game loop then everything should be fine.

Remember steer clear of function levels, just use values because you'll do nothing but suck speed otherwise

Anata aru kowagaru no watashi!

Login to post a reply

Server time is: 2023-09-29 03:44:38
Your offset time is: 2023-09-29 03:44:38