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 / is it possible to create a new camera in DB?

Author
Message
Santi
21
Years of Service
User Offline
Joined: 9th Dec 2002
Location: Spain
Posted: 9th Dec 2002 16:57
Hi. I am trying to program a Car Race game, but I don't know a way to program a 2 player mode because I don't know how to "divide" the screen so that a player has his car in the part of above and the other player in the one of down. Could you help me?.
Thank you very much.
jotomicron
21
Years of Service
User Offline
Joined: 17th Nov 2002
Location: Portugal
Posted: 9th Dec 2002 18:27
I think ir's not possible in DB v1.x
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 9th Dec 2002 19:00
It's very possible in DB 1.x, there are tutorials that show you how to do it, I just dont know where they are
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 9th Dec 2002 20:11
its possible in DB 1.x ... however there are some dangers to useing it.

And the most common method is alternate loop rendering, (render screen 1 loop 1, screen 2 loop 2, screen 1 loop3, etc...) this will cut back your framerates considerablly - so to get a decent 30fps you'll need the game itself to run at 60fps.

Check Codebase (link on Darkbasic.co.uk) as it has a good example of howto achieve multiple cameras

Anata aru kowagaru no watashi!
jotomicron
21
Years of Service
User Offline
Joined: 17th Nov 2002
Location: Portugal
Posted: 10th Dec 2002 17:48
Can u, Raven Vegeta, tell me where is the good example?
tnx...
Santi
21
Years of Service
User Offline
Joined: 9th Dec 2002
Location: Spain
Posted: 10th Dec 2002 18:08
THANK YOU VERY MUCH!!!!!

Thank you very much indeed guys

Dazzag
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Cyprus
Posted: 14th Dec 2002 14:09
Best example was that car racing game that was viewed 3rd person, from above. Nice good split screen stuff.

Basically, if I remember rightly, it is the set camera view command. My game does it alright, but it's downstairs, and I can't be bothered getting out of bed.

Essentially you do a set camera view ONCE per sync. You alternate between players every sync. So something like...

set camera arrays for pos on screen etc.
do
Input handling code etc
camview=1-camview 'Toggles player
set camera view <use camera arrays with camview>
sync
loop

The advantage of the above pseudocode is that you don't do any IFs, so min. processing.

Do not use more than one set camera view in one sync loop though! Will flicker badly. Even if it works fine on your computer, just don't do it, as it will be a fluke, and go horribly wrong on everyone elses PC.

Note that the fps is misleading. You will set up 2 cameras and fps will still be the same as 1. Which is true. But don't forget that each camera is using up one sync. So divide the FPS by the number of cameras to achieve the correct FPS per camera. And set the sync rate to the normal rate times the number of cameras to get a very close speed setting to the single camera mode. Although it's likely your PC will start really slowing down above 2 cameras.

Note that I haven't touched DB in around a year, so a bit rusty (the DBP editor plugins don't count, was all VB and didn't program one line of DBP to test them), but should be ok, unless I have forgotten the real name of the camera command.

Cheers

I am 99% probably lying in bed right now... so don't blame me for crappy typing

Login to post a reply

Server time is: 2024-03-29 01:41:23
Your offset time is: 2024-03-29 01:41:23