Closed dougietubby closed 3 months ago
GameMaker's split screen feature (achieved by using multiple views) works by drawing the entire room for each view. This means you're drawing each Bulb renderer for each view. This is not what we want.
You can use view_current
to check which GameMaker view is currently being rendered. You can then check against view_current
when drawing your Bulb renderer to the screen with .DrawOnCamera()
. If view_current
is 0 then only draw the first renderer; if view_current
is 1 then only draw the second renderer.
Thanks for the help Mr. JujuAdams.
I added the check for current view within the following "Draw End" event. I fixes the issue for 2 and 4 player split screen (since all viewports have the same resolution), but distorts the lighting surface when there's 3 players. Video is here.
var _t = get_timer();
// Update Lighting System based on camera
if (global.Cameras != undefined){
var _height = array_length(global.Cameras);
for (var i = 0; i < _height; i++){
if (view_current == i){
lighting.UpdateFromCamera(global.Cameras[i]);
lighting.DrawOnCamera(global.Cameras[i]);
}
}
}
drawEndTime = get_timer() - _t;
Do I add a check for 3 players and try rendering it differently? Or would you recommend simply making 3 players all have the same viewport resolution?
Thanks again, Dougie (BIG FAN!!!!)
I don't know. It is likely that you're setting the wrong surface dimensions for the widescreen player but that is something you will need to diagnose.
I'll give it a shot. Thanks again for the help!
Video of Issue: Here
I've gotten Bulb to work in split screen (using Juju's Input) but when players get close to each other, the surface from one viewport is drawn a second time on the other, causing this weird visual glitch. Without using updating the surface dimensions to the camera, the lighting surface only will apply to one viewport.
The following is the added code I've used to create split screen cameras.
Begin Step
Here is the scr_create_camera script: