SOLVED Bug occurs only in the emulator

uni00

Member
Hello. Until now, the game worked fine even if I used AVD to run it, but when I try to make another turn today, it doesn't work properly, and the game doesn't work properly because of bugs. .. ..
It works fine when tested on windows, but is still buggy with AVD. .. .. I have no idea what the cause is. .. ..
In the game, you can move the character, but the hit judgment will be off, or the instance that should follow will not come.
The API level of GMS2 is 28, and the minimum sdk is all included. .. ..
Is there anything I can think of?
 

rytan451

Member
What did you change? What was supposed to happen? What actually happened? What was happening before you changed this?
 

Liam Jacobs

Member
It's hard to diagnose what could be causing the issue with just a few of the bugs. Could we have a sample of your code where one of these bugs is occurring?

The one thing that I can think of is that GML needs to follow some certain rules when exporting cross-platform. Things like semi-colons and correctly-placed braces used to be required if you wanted your game to work without issue when exporting to other platforms.
 

uni00

Member
What did you change? What was supposed to happen? What actually happened? What was happening before you changed this?
What did you change? What was supposed to happen? What actually happened? What was happening before you changed this?
I can't put up with many bugs.
The button for specifying the language does not appear, and the button for returning to the title is displayed.
I made a scaffold to prevent the character from slipping when it falls, but the judgment is a little higher.
The lights work only on both ends of the room, and only on both ends of the room.
And many bugs are happening. Works fine in windows.
It worked fine yesterday, but today I lowered the API level and started the game with another AVD, but the bug still occurs.

It's hard to diagnose what could be causing the issue with just a few of the bugs. Could we have a sample of your code where one of these bugs is occurring?

The one thing that I can think of is that GML needs to follow some certain rules when exporting cross-platform. Things like semi-colons and correctly-placed braces used to be required if you wanted your game to work without issue when exporting to other platforms.
Then, while the character that should accompany you is moving, it is left alone, and when it finishes moving, it warps. It works only at both ends of the room and disappears in the middle of the room.
GML:
o_lamp
--step--
if(keyboard_check(vk_left)){
x=o_player1.x-27;
y=o_player1.y+17;
}
else if(keyboard_check(vk_right)){
x=o_player1.x+30;
y=o_player1.y+17;
}
First one

Anyway, even if you specify the position, there are many bugs such as shifting and following only at certain places.

Should I take a screenshot of the game?
Is the setting of android studio wrong?
 

rytan451

Member
In regards to your code, it looks like the o_lamp is set to a certain position relative to o_player1, but only when the left or right arrow keys are pressed. If your o_player1 moves while the arrow keys are not pressed, then o_lamp would not follow it (unless there's code elsewhere doing that). If that is a problem, then you'll probably have to redo this code, since it's very inflexible. If you made the o_lamp instead simply move towards o_player until it's within a certain range (taking, I assume, gravity into account), then the o_lamp should have a more natural movement, and also be able to handle the o_player1 moving outside of when the left and right arrow keys are pressed.
 

uni00

Member
In regards to your code, it looks like the o_lamp is set to a certain position relative to o_player1, but only when the left or right arrow keys are pressed. If your o_player1 moves while the arrow keys are not pressed, then o_lamp would not follow it (unless there's code elsewhere doing that). If that is a problem, then you'll probably have to redo this code, since it's very inflexible. If you made the o_lamp instead simply move towards o_player until it's within a certain range (taking, I assume, gravity into account), then the o_lamp should have a more natural movement, and also be able to handle the o_player1 moving outside of when the left and right arrow keys are pressed.
The character cannot move unless the move key is pressed. There is no way to move other than pressing the left and right keys.
Added. When I tested it again with avd, O_lamp came along. However, it is full of bugs. I was able to do it yesterday. .. ..
I set the API level down so as to support various models, but I stopped it because a bug started to occur, I restored it to the original, but is that not possible?
 

rytan451

Member
So you're saying that when testing it on a physical Android device, o_lamp moved as you intended. But when you tested it on an Android Virtual Device, o_lamp also moved as you intended, but some other bug occurred. What other bug?
 

uni00

Member
Is the language in GMS2 not properly compiled in AVD, or is the sdk or API settings wrong? I don't know what to check. I've been worried since morning...
 

rytan451

Member
Given that I don't know what your problem is, I also don't know what to check. Help me help you. In regards to the bug with the o_lamp, what is the problem? Is it moving weirdly? Is it displaying weirdly? You say that it "came along" and also "However, it is full of bugs." I don't know what the problem is. Can you help explain it?
 

uni00

Member
There are instances that brightly illuminate the area around the character. It doesn't work and stays much darker. It works when you go to the edge of the room, but it's pitch black otherwise.
GML:
o_surface_Light
(create)
surface=-1;
depth=-10000;

(draw)
if(surface_exists(surface)){
    
    var _cw = camera_get_view_width(view_camera[0]);
    var _ch = camera_get_view_height(view_camera[0]);
    var _cx = camera_get_view_x(view_camera[0]);
    var _cy = camera_get_view_y(view_camera[0]);
    
    //target
    surface_set_target(surface);   
    
    //drawing
    draw_set_colour(c_black);
    draw_set_alpha(1);
    draw_rectangle(0,0,_cw,_cw,0);
    
    gpu_set_blendmode(bm_subtract);
    
    with(o_lamp){
    
    draw_sprite_ext(sLight,0,x-_cx,y-_cy,0.5+random(0.05),0.5+random(0.05),0,c_white,1);
    
    }
    gpu_set_blendmode(bm_normal);
    
    //reset
    draw_set_alpha(1);
    surface_reset_target();
    draw_surface(surface,_cx,_cy);
      
    //reset
 
        
}

if (!surface_exists(surface)){
    var _cw = camera_get_view_width(view_camera[0]);
    var _ch = camera_get_view_height(view_camera[0]);
    
    surface = surface_create(_cw,_ch);
    
    surface_set_target(surface);
    draw_set_colour(c_black);
    draw_set_alpha(0.6);
    draw_rectangle(0,0,_cw,_cw,0);
    
    surface_reset_target()
 

rytan451

Member
Hmm... You're using alpha subtraction to punch holes in a darkness surface which is later drawn on of the view...

In the AVD, are you able to see anything through the darkness, or is it just pure black?

(By the way, in regards to lighting, I actually prefer to start with a black surface, use additive blending to add whiter areas near lamps, and then use multiplicative blending when drawing the lighting surface on top of the view. This provides a more natural-looking light)
 

uni00

Member
Hmm. .. ..
Yesterday: The game worked fine with AVD.
Today: API level is lowered from 28 to 25 in GMS2 to support various machines. At this time, Minimumsdk dropped to 14, and this didn't work, so I rewrote it to 16.
Targetsdk also went down, so I rewrote it to 28.
The number of compilesdk also dropped, so I rewrote it to 28. After applying it and starting it with Nexus 5, there were many bugs, so I returned both API Level and sdk to the original values.
And when I re-started it with the normal Google Pixel 3a, many bugs occurred.
I haven't messed with the GMS2 object code, so I don't think the code is a problem. Because yesterday moved normally.

Hmm... You're using alpha subtraction to punch holes in a darkness surface which is later drawn on of the view...

In the AVD, are you able to see anything through the darkness, or is it just pure black?

(By the way, in regards to lighting, I actually prefer to start with a black surface, use additive blending to add whiter areas near lamps, and then use multiplicative blending when drawing the lighting surface on top of the view. This provides a more natural-looking light)
It's pitch-black in AVD. When you move the character to the edge and stop it, the lights will finally come on, but it will only work at both ends of the room.

スクリーンショット (199).pngスクリーンショット (198).png
 

rytan451

Member
Ah, so you didn't change any source code in GMS, only your compile environment. That's extremely useful to know. Perhaps create a brand-new AVD with your desired parameters and see if it works. Be careful when messing around with your compile environment. It's usually much harder to fix if you mess it up. Perhaps use backups.

Beyond this advice, I now know enough about your problem to know that I can be of limited help.
 

uni00

Member
I also looked at the version of the build tools in Android studio and filled in GMS2. What should I do. .. ..

Have you cleared the compiler cache? The broom icon at the top of the IDE.
Hello. Is it the mark on the right of this image? Of course I did.スクリーンショット (203).png

Please help someone! !! I don't rewrite the game code. However, the game worked normally yesterday, but now it is full of bugs. .. ..



MOD EDIT: I have just merged your last three posts. I have already merged (and sent notifications) about using the EDIT button and not bumping topics. If you continue to double or triple post and bump the topic against the forum rules (you must wait 48 hours before bumping) then I will be forced to close the topic.
 
Last edited by a moderator:

uni00

Member
Excuse me. I don't understand English, so I rely on Google translation.
When I searched all night, I erased the semicolon and wrote a semicolon, and it was cured. Mystery
Thank you everyone.
 
Top