设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 65|回复: 0

[转载发布] Graphical Object Global Reference

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    5778

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    25563
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    32235

    灌水之王

    发表于 前天 12:08 | 显示全部楼层 |阅读模式
    Graphical Object Global Reference VX

    (game.exe crash debugger)​

    by Mithran​

    NOTICE: This is the VX version of the script. For the VX ACE Version go HERE

    Introduction

    Getting seemingly random and yet occasionally predictable Game.exe crashes?
    "Game.exe has encountered a problem and needs to close"

    This is one of the most frustrating errors to deal with in RPG Maker VX as it seems to come and go at random, only affecting certain people or setups, and the actual cause of the error is hidden to you.

    If your project is getting persistent Game.exe crashes or even occasional Game.exe crashes across more than one system, this may be worth a read. Hell, even if its not, it might still be worth a look. This script addresses one specific issue that can cause an unhandled exception leading to an eventual Game.exe crash. Your mileage may vary.

    SpoilerThe cause of a given Game.exe crash could be any number of things - anything that
    doesn't create throw an error in Ruby, but causes an unhandled exception in one
    of the 'hidden' classes.

    After extensive testing, I was finally able to recreate the circumstances leading
    up to one such exception that, if left unhandled, could lead to Game.exe crash.

    1. A "GO" - Graphical Object (Sprite, Window, Plane, or Tilemap) is created
    2. The Graphical Object is assigned a Viewport
    3. The Viewport is disposed, but the sprite is not
    4. The Graphical Object is claimed by GC (garbage disposal)*

    * - Newly Discovered: attempting to dispose a sprite that has a disposed viewport
    will occasionally also crash. (v 1.1)
    Note that this particuar crash only seems to occur if screen draws have taken
    place (any of the Graphics methods) between the time the viewport is disposed
    and the sprite disposal is attempted.

    Due to the way GC is implemented, you are unlikely to see an immediate effect
    when the situation comes up. It could be several scene changes down the line
    before the crash finally happens. To make matters worse, following the exact
    same course of action will yield completely different results, making it seem
    as though the crashes are random. In addition, there is yet another circumstance
    which I have still been unable to pinpoint, but I suspect has something to do
    with the order in which assets associated with the Graphical Object are claimed
    by the GC, or the amount of screen rewdraws that have taken place,
    that allows the GO to be cliamed without causing an exception and
    thus making it even harder to find.

    In essence: you could be suffering from an unstable game and not even know it.

    So that is where this little script comes in. This does the following:

    1. Creates a global variable backreference to every Graphical Object created.
    This prevents them from being marked by the GC so long as the reference exists,
    circumventing the final condition to cause this version of the crash.

    2. Removes reference to the Graphical Object once it has been disposed.
    This reallows the object to be marked by GC for disposal (once all other
    references are removed). Since the GO is disposed, condition 3 is no longer met
    and the object is deemed 'safe'.

    3. Report on potential issues to the user.
    This allows the user (given limited scripting knowledge) to identify potential
    errors and fix them outright.

    4. Prevents further Game.exe crashes caused by this specific issue.
    Includes a 'lazy' fix that cleans up offending Graphical Objects when the scene
    changes.*

    * v 1.1 'Lazy' fix has been superceeded to prevent crashes caused by disposal of
    these errant sprites. Lazy fix only works if debug criticial disposal has
    been disabled.

    Version History:

    v 1.1
    Discovered a new condition for a Game.exe crash. Updated script to trap and log
    this error also.

    v 1.01-1.05
    Minor bugfixes, improved logging, added consideration for Plane objects viewport method error

    v 1.0
    Initial Release




    Features
    - Identifies and reports a prevalent, and generally very easy to fix, cause of Game.exe crashes.
    - Creates a global reference to every graphical object created until it is disposed to prevent the error from causing this specific Game.exe crash while it is running
     
    Script
    http://pastebin.com/raw.php?i=rW9qkbxT

    How to Use
    Install on its own script page in the materials section of the script editor above main and below default scripts. If using a script that creates sprites at startup (eg. Woratana Simple Mouse System), this script must come after it on the list.


    FAQ
    Q: Game.exe crashes for me constantly and this didn't help!
    A: As explained, this only prevents Game.exe crashes caused by the specific set of circumstances outlined. Crashes caused by memory faults or other errors may still remain, but if there is an in-game reason for it (read: crashes happen after x set of actions are taken with a fair degree of consistency, or across several computers) feel free to leave a post here.

    Q: I'm using a cracked version and..
    A: Support will not be given for non-official versions. Using a cracked version is also against the forum rules, among other things, and will get you banned.

    Q: I found another way to force a Game.exe crash in a seemingly stable game.
    A: I'd love to hear about it. Drop a post with the details.

    Credit and Thanks
    - Mithran

    Author's Notes
    May be distributed with a link to these forums, original unedited script, and with credit. May be used in any project, so long as the credit in the script remains intact (individual credit in the project as a whole is not required).

    Bug Reporting
    If you encounter an error, please provide the complete error code as well as a short description on how to reproduce.


    本贴来自国际rpgmaker官方论坛作者:Mithran处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/graphical-object-global-reference.1067/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-7-26 03:50 , Processed in 0.086921 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表