Previus room stays drawn in new room

C

carlosagh

Guest
In my project i have an object that serves as a persistent manager object created in the game's intro, this object has some enums and macros inside its create event and has step event code and draw gui code dependant on the room. My problem is that when i change to the game room, the previus room is still drawn and is mixed with the draw gui code applied to the game room which means i have the players healthbar mixed with the menu, the room is the game room and rhe player is not drawn at all, there are no signs of freezzing, in fact, the debugger says the player exists, but no sounds related to the player are reproduced. I have checked the code multiple times in the room_start event, there are no loops involved when going to another room and just in case, i converted my if statements for the room into switches, nothing works
 

TsukaYuriko

☄️
Forum Staff
Moderator
Are you drawing a background in the new room? You should, otherwise whatever was drawn before will stay drawn.
 
C

carlosagh

Guest
Are you drawing a background in the new room? You should, otherwise whatever was drawn before will stay drawn.
The intro room and the menu room only have background colors and the game room is the only room with background assigned

The intro room and the menu room only have background colors and the game room is the only room with background assigned
Also, the buttons in the menu are indivivual items

Found the cause of the problem: When there is only 1 player in the game room, the "fusion" happens but when there are 2 players (by the way, it's a fighting game) created at the same time, the problem does not happen. I don't know how to solve it though, because none of the code written causes that. I checked EVERYWHERE and tryed EVERYTHING i could think of
 
C

carlosagh

Guest
Found the cause of the problem: When there is only 1 player in the game room, the "fusion" happens but when there are 2 players (by the way, it's a fighting game) created at the same time, the problem does not happen. I don't know how to solve it though, because none of the code written causes that. I checked EVERYWHERE and tryed EVERYTHING i could think of
Fixed it with a workaround: I create both players in the room start, but with visible=0 and the room draws correctly, I have continued to work thanks to this, however, I still don't know what caused this behavior in the first place.
 

TheouAegis

Member
I would say it's a camera issue, but I've never experienced that. That effect usually happens if the view or surface isn't cleared every step.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Could you share some images of what is happening? Also some images of the room editor for each of the rooms would help... ALso, sharing any and all relevant code would help a lot too! I know it's a lot to ask, but the more information we have, the more likely we are to be able to help you solve the issue without the need to resort to workarounds and hacks. :)
 
D

Deleted member 16767

Guest
This is happening too in my painting software. It says something in the lines of failed layer_create().
 
C

carlosagh

Guest
Could you share some images of what is happening? Also some images of the room editor for each of the rooms would help... ALso, sharing any and all relevant code would help a lot too! I know it's a lot to ask, but the more information we have, the more likely we are to be able to help you solve the issue without the need to resort to workarounds and hacks. :)
This is how it looks like before the workaround:
issue1.png
issue2.png
→ The healthbar and staminabar are only shown in the game room and not in the menu so, the sh... is happening here.
→ This is a networking project, the host player is supposed to sit tight in the game room alone waiting for the client, and the client that connects to the server gets the host player's position in the room and creates both the host projection and the client player on the client side, and since they are created at the same time that is why the room in the client side is OK.

This is how it looks like with the workaround:
issue10.png
→ Both players are created but with 0 visibility and some other stuff to prevent execution of the step event and the draw event.
→ Visibility and the rest of the stuff are enabled to make the player(s) operable using the Networking mumbo-jumbo.

This is the game room:
issue4.png
→ In this room I only create the camera object and the floor object.
→ When I saw this happen, i first thought it was the camera, i ran multiple tests and even disabled the usage of camera usage and even resized the game room and it kept happening.

I also tried removing the floor object, delayed the creation of instances with an alarm, nothing worked, i also have a shader for the player object, i disabled that too, sh** still happens...

This script jumps to the game room, but before that, it checks if the assigned gamepad is connected
GML:
script_configuration_read();
with object_controller
{
    gamemode=gmode.localgame;
    if script_input_gamepad_connection()
    {
        if global.error_gamepad=true then global.error_gamepad=false;
        room_goto(room_game)
    }
    else
    {
        global.error_gamepad=true;
        alarm[0]=room_speed*10;
    }
}
This script is executed by a button in the menu room, that is why it runs code on a with
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Okay, you haven't by accident flagged any of the instances as persistent by any chance? to me this looks like the object that's drawing the health/stamina may have that flag checked, which would explain why it's being "carried over" into other rooms.
 
C

carlosagh

Guest
Okay, you haven't by accident flagged any of the instances as persistent by any chance? to me this looks like the object that's drawing the health/stamina may have that flag checked, which would explain why it's being "carried over" into other rooms.
Indeed, I have a persistent "object_controller" that is created in the intro room (the user cannot return to this room), this object initializes all of the constants and the enums and executes lots of room dependant code in its StepEvent and DrawGUIEvent. At first when this issue first popped up, I changed the room checks from if statements to switches and it kept happening, I also removed all of the networking code from a RoomEnd event it used to have and placed it elsewhere and it still happened.
 
Top