Community
Message Board

Chat room - users
Game Over
( 394431 downloads)
Work In Progress
( 523201 downloads)
Links

Code Exchange
Downloads
Tutorials
Add to Favourites

Submit news

DIV ARENA FORUMS
Not logged in [Login - Register]
Go To Bottom

Printable Version  
Author: Subject: Possible bug with let_me_alone function
josepgames
Loyalty card holder
******


Avatar


Posts: 66
Registered: 31-10-2016
Location: Barcelona - Spain
Member Is Offline

Mood: Happy

[*] posted on 5-12-2016 at 10:04 AM
Possible bug with let_me_alone function


Hi,

I've noticed a possible bug with let_me_alone function. In many of my games, when I finish a level (or user wants to go back to main menu) I execute let_me_alone() process in order to kill all running processes and load next level (or main menu level).

In some cases, after running let_me_alone process and running debugger I see a negative number of running processes. This makes next "frame" command to exit game (I guess is because it has an inconsistent number of processes to render). I attach some screenshots. I'll try to create a sample program to reproduce the error. I detected It running New-Pacman game (http://div-arena.co.uk/forum2/viewthread.php?tid=151) by:

1) Ener 1st level
2) Play a while until pacman shield disappears
3) Open debugger and add a break at "menu_principal" process
4) Hit "Esc" key to go back to main menu
5) You'll see negative processes and when rendering next frame program crashes

I'm compiling games with latest nightly build under Windows 7.

Any help will be appreciated!

Thanks

Josep


newpac_after_let_me_alone1.png - 41kB




JosepGames
View user's profile Visit user's homepage View All Posts By User
BreadCaster
Loyalty Card Holder
******


Avatar


Posts: 321
Registered: 2-3-2016
Member Is Offline


[*] posted on 5-12-2016 at 12:09 PM


Hi Josep

From what I can see, the let_me_alone is inside a function - functions by their very nature are self terminating and are used to grab quick pieces of information/return certain results rather than keeping on running in the background, so what's likely happening is your function there is self terminating and then there's nothing to keep the program running. If you use let_me_alone inside a process with a Loop and Frame you should be fine :)




~*~ Princess of Pies and Pastries ~*~
View user's profile View All Posts By User
josepgames
Loyalty card holder
******


Avatar


Posts: 66
Registered: 31-10-2016
Location: Barcelona - Spain
Member Is Offline

Mood: Happy

[*] posted on 5-12-2016 at 12:37 PM


Hi BreadCaster,

Thanks for your quick reply. No, I'm not calling let_me_alone inside a function, it's always under the main program section.

I attach source file, in case you want to take a look...

Thanks!!

[Edited on 5-12-2016 by josepgames]

Attachment: NEWPAC.PRG (119kB)
This file has been downloaded 2094 times





JosepGames
View user's profile Visit user's homepage View All Posts By User
josepgames
Loyalty card holder
******


Avatar


Posts: 66
Registered: 31-10-2016
Location: Barcelona - Spain
Member Is Offline

Mood: Happy

[*] posted on 5-12-2016 at 12:42 PM


Some more info... Game worked fine when it was compiled under DIV 2 & MSDOS this bug only raises under DIV DX compilation and Windows 7 (same source code compiled). So it seems to be a DIV DX bug

Thanks!




JosepGames
View user's profile Visit user's homepage View All Posts By User
josepgames
Loyalty card holder
******


Avatar


Posts: 66
Registered: 31-10-2016
Location: Barcelona - Spain
Member Is Offline

Mood: Happy

[*] posted on 5-12-2016 at 04:20 PM


Hi,

I found what causes the crash and a possible workaround.

The problem is I was calling stop_scroll and let_me_alone:

Code:
let_me_alone(); stop_scroll(SCROLL_CELDA);


As the documentation states, stop_scroll sends a kill signal to all its inner processes. The same is done by let_me_alone procedure, but for all processes except the one who calls it. It seems there's a conflict between these two calls which returns a negative number of processes (maybe counts scroll process delete twice), and DIV DX fails when you start the process which returns the process counter back to 0.

The workaround for this code (in my case) was to run only stop_scroll and call let_me_alone only before an exclusive process (like rendering a new level or showing main menu).

Even though I made it work, this is an issue related to stop_scroll or let_me_alone. One of those two functions (when called sequentially) decreases process counter below 0 and should be fixed to avoid further errors. Hope this gives you enough info for the fix.

I'll be glad to help if you need further info!!

stop_scroll_and_let_me_alone.png - 27kB




JosepGames
View user's profile Visit user's homepage View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 6-12-2016 at 01:01 AM


This is an interesting bug and fixing it probably fixes some other issues with games that quit.

Thanks for the report!
View user's profile View All Posts By User
josepgames
Loyalty card holder
******


Avatar


Posts: 66
Registered: 31-10-2016
Location: Barcelona - Spain
Member Is Offline

Mood: Happy

[*] posted on 6-12-2016 at 07:16 AM


Thanks mike!

Just to clarify, div exits when raises the process which sets process counter back to zero. However, process which set process counter below zero should be fixed anyway.

If there's anything I can do to help fixing it or testing I'll be glad to help!




JosepGames
View user's profile Visit user's homepage View All Posts By User

  Go To Top

Powered by XMB
XMB Forum Software © 2001-2012 The XMB Group
[Queries: 18]