Greetings again, all.
My third person action adventure is nearing completion, but today I come to you with a whole smorgasbord of questions and observations, mostly aimed at improving the efficiency of my game engine.
So, without any further ado, here I go!
1. Efficient Vertical Sync
My first issue comes in with the refresh rate of fullscreen applications in DBPro. Due to no vertical sync being applied to the application, screen tearing becomes a real eyesore. Setting
SET DISPLAY MODE 1024, 768, 32, 1 removes the screen tearing, but makes the in-game movement rather jerky, and plays havoc on any timer-based movement routines I add. My question here is: Is there an efficient way to manually set up vertical sync in my program?
P.S. I was delighted to discover the undocumented command
SET DISPLAY MODE Width, Height, Depth, VSyncOn, multisampleSize, multiMonitorMode. Antialiasing in SET SCREEN MODE? Yes!
2. Delayed text
My next question is about improving my method of displaying text on screen after a delay. Currently I am using this method: (psuedo code)
...
textdelay=0
...
DO
INC textdelay
IF textdelay=100
TEXT "The Delayed Text"
textdelay=0
ENDIF
...
...
SYNC
LOOP
This gets the job done rather nicely, but isn't there a more efficient way of doing it, though?
3. Grid-Based Movement
This one is for an upcoming project. It requires the characters to smoothly move from one 100x100 grid block to the next, snapping to the grid, as it were, and not overshooting it, not interfering with the execution of other game events.
This code gets the basics down, but due to the FOR...NEXT loop, it disallows the execution of other game events...
IF FacingDirection = NORTH
if checkCollision(NCol) = 0
for moveit = 1 to 100 step 4
move object Kraken, 0.4
sync
next moveit
endif
endif
So, what would be the best way to implement a system like this? I need a routine which stays within grid boundaries, and smoothly moves from one grid square to the next, without interfering with the execution of any other events. Should I use the same method as I use for the delayed text, just counting up an integer and increasing it by each step instead of using a FOR...NEXT LOOP?
So, there we have it. I believe I have covered everything that has been nagging at me (hopefully). Your help and advice would be greatly appreciated.
Regards,
Kafoolwho