• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

After updating to latest version: 310/359 outputs a result of 0 ?!

Ronchon

Member
Hi!
After updating to latest version, i've witnessed a few weird corrupted calculation results in my game.
No errors, just odd values.
After narrowing one down, i diagnosed it with debug messages and found out the variables involved were in an apparently corrupted state. Neither a real, nor a string, nor undefined, nor NaN. Not throwing errors, still acting up as a normal real in most cases except for some calculations, for unknown reasons.

Below is the case i diagnosed, involving 2 variables called sc_state_cltr (=310) and sc_tot_cltr (=359).
Can anyone explain these results? What the hell is going on here ? :eek:

Code:
show_debug_message("sc_state_cltr: "+string(sc_state_cltr)+"    is real? "+string(is_real(sc_state_cltr))+"    is string? "+string(is_string(sc_state_cltr)) ) 
show_debug_message("sc_tot_cltr: "+string(sc_tot_cltr)+"    is real? "+string(is_real(sc_tot_cltr))+"    is string? "+string(is_string(sc_tot_cltr)) )           
show_debug_message("0 - "+string(  sc_state_cltr)+"/"+string(sc_tot_cltr) )           
show_debug_message("1 - "+string(  sc_state_cltr/sc_tot_cltr   ))   
show_debug_message("2 - "+string(  sc_state_cltr/sc_tot_cltr*100   )) 
show_debug_message("3 - "+string(  round(sc_state_cltr/sc_tot_cltr *100)   ))
show_debug_message("4 - "+string(  2*( round(sc_state_cltr/sc_tot_cltr *100)-50 )    ))       
show_debug_message("5 - "+string(  real(sc_state_cltr)/real(sc_tot_cltr)      )) 
show_debug_message("6 - "+string(  real(string(sc_state_cltr))/real(string(sc_tot_cltr))      ))

sc_state_cltr: 310 is real? 0 is string? 0
sc_tot_cltr: 359 is real? 0 is string? 0
0 - 310/359
1 - 0
2 - 0
3 - 0
4 - -100
5 - 0.86
6 - 0.86



________________________________________________________________
UPDATE:
After tracking the "path" of these variables to see at what point they became corrupted, i found out the potential buggy cause.
At one point these variables values are transferred to the client via a buffer ( multiplayer game ).
The corruption seems to be originating from the buffer_read function, when setting the variable's value on the client from the received buffer.
These variables were of the buffer_s16 type.
It seemed to affect only some specific types of values and not all. Maybe even just buffer_s16. hard to tell at this point.
I'll add a " real" failsafe on all these functions to try fixing the issue for now.

buggy function:
buffer_read(sc_buffer,buffer_s16)
changed to this to fix, adding real() as a failsafe to uncorrupt the buffer_read results:
real(buffer_read(sc_buffer,buffer_s16))
 
Last edited:

Ronchon

Member
Hi, good to know! Thanks!
Though your bug report does not mention buffer_read which seems to be what's causing the error on my case, so it might not be the exact same issue.
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
Hi, good to know! Thanks!
Though your bug report does not mention buffer_read which seems to be what's causing the error on my case, so it might not be the exact same issue.
buffer_read on integer types returns int64 (which is currently the only integer type), so that's the exact issue I believe.
 
Top