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 / Vertical sync, delays, grid-based movement and other things...

Author
Message
Kafoolwho
10
Years of Service
User Offline
Joined: 16th Oct 2013
Location: The Deep
Posted: 24th Feb 2015 09:41
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)



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...



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
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 26th Feb 2015 04:47
1. Efficient Vertical Sync

I have been using DBPro for several years. Screen tearing has never been an issue regardless of how syncing is set. Sorry too say, you must be doing something wrong.

2. Delayed text

This will depend on sync and backdrop setting. This snippet hopefully will help.



3. Grid-Based Movement

If you study the snippet, I think you should be able to figure this out. Notice how I utilize variables, control structures and the select case structure to call functions to do something different with only one call to sync in the source.
Kafoolwho
10
Years of Service
User Offline
Joined: 16th Oct 2013
Location: The Deep
Posted: 26th Feb 2015 06:59
Hi WickedX. Firstly, thank you very much for that snippet of code. I feel a bit like an idiot now lol. Timer! How did I not see that, since I have been using it in other functions?

As for the screen tearing when VSYNC is off, I actually doubt that I am doing something wrong. Running any fullscreen DBPro app with VSYNC disabled (expecially 3D ones) on my LG 700s CRT monitor causes screen tearing. My other friends with CRT monitors seem to have the same problem if I send them programs to test. Granted, my testers with LCD monitors do not seem to have the same problem.

Just to be certain, I sent some precompiled DBPro demo programs to some testers.

Running them on a Samsung 245BW LCD monitor looks great, but the problem persists on a Samsung 793s CRT.


But thank you for your input and your awesome piece of example code. It really helps quite a bit!
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 28th Feb 2015 03:27
My first two years using DBPro were with a NEC CRT monitor. I can’t recall screen tearing being an issue. Could you possible supply a short snippet that demonstrates the problem.

Login to post a reply

Server time is: 2024-03-28 17:16:41
Your offset time is: 2024-03-28 17:16:41