Stencyl 3.4.0 is now out. Get it now!

Suggestion Issue: Pls add "don't create empty list in design mode" to List info in Stencylpedia


Pages: 1

BMJ

  • Subscriber - Stencyl Indie
  • *
March 17, 2017, 09:25:28 am
If it's an intentional decision to allow people to create empty lists in design mode that will crash their games when an item is added to it at runtime, please either add "do not create an empty list in design mode" to "List Gotchas" in Stencylpedia or just disable the ability to leave a list empty in design mode. (Probably the better solution, IMHO.)
« Last Edit: March 17, 2017, 09:31:57 am by BMJ »


rob1221

  • Master Stencyler
  • *
March 17, 2017, 10:13:05 am
I would expect an empty list to work as long as it isn't marked as hidden.  Is that not the case?  A hidden list is considered a null list which is different than an empty list.

In addition to Stencylpedia updates, maybe better error handling for #1009 errors should be considered as it is probably the most common error code posted on the forums.
« Last Edit: March 17, 2017, 10:17:22 am by rob1221 »


Justin

  • Master Stencyler
  • *
March 17, 2017, 04:59:50 pm
There are some Haxe options that allow to catch null pointer errors on desktop, but the last time I tried them it seemed to make games a good deal slower. Perhaps things have changed now. If we can get the error to be thrown with a complete stack trace, we could make it show up in design mode with a red highlight just like compile-time errors are, and even allow you to jump through your design mode code by clicking on each line of the stack.

Of course, it's always possible to set some flags (-D HXCPP_DEBUG_LINK, and optionally -D HXCPP_DEBUGGER, -D openfl_debug, -D lime_debug, depending on just how deeply you need to debug), run the game in debug mode, and then open it in Visual Studio for complete control with breakpoints and code stepping. I've done this often enough that it's not a big deal for me, but seems like it's more effort than should be expected for users.


Justin

  • Master Stencyler
  • *
March 17, 2017, 05:04:02 pm
Though regarding both options, it's unfortunately more difficult to  debug a game running on cppia just because of how cppia works. It would probably be necessary to do a full desktop build in order to get good error detection. Which is kind of sad, because a lot of my ideas about allowing game code to live reload (no need to recompile) work better on cppia. I guess you can't have everything at once?


rob1221

  • Master Stencyler
  • *
March 19, 2017, 07:58:29 am
I was reading a post by Captaincomic about error handling and saw this:
Quote
I think that, for games created solely with blocks, it should be possible to avoid any runtime errors, like null object access. All blocks should check their arguments for null values, and be non-op if an argument is null. To avoid confusion when a block doesn't do anything, it should also create a log message "warning: null object passed to block xy".

Do you think this is a good idea, and would it work with Cppia?


Justin

  • Master Stencyler
  • *
March 19, 2017, 12:18:00 pm
As long as users are only using blocks, we can wrap the generated code in whatever we need to check all objects for null, and it would be platform agnostic. The only issue with that, really, is the runtime overhead it would generate.


rob1221

  • Master Stencyler
  • *
March 19, 2017, 01:14:00 pm
Would it be better to check for null within the Script functions?  Of course that would require changing the code for a bunch of blocks, such as actor.setX becoming setX(actor).


Justin

  • Master Stencyler
  • *
March 19, 2017, 06:33:13 pm
If we really wanted to do something on our end, perhaps a build macro would be better. No need to modify any code, and it can be controlled by a haxe define. Compilation time would increase in addition to any potential runtime overhead, but there would be absolutely no change for people who didn't want to use it (for example, for a release build).

It might be better to try HXCPP_CHECK_POINTER. I haven't used it in a long time, and I don't recall how much of an impact it has on performance. But HXCPP_CHECK_POINTER, a catch block that prints the error, and letting Stencyl read that error and translate it to a position in Design Mode blocks, might fit our needs perfectly.


BMJ

  • Subscriber - Stencyl Indie
  • *
March 25, 2017, 02:34:38 pm
I would expect an empty list to work as long as it isn't marked as hidden.  Is that not the case?  A hidden list is considered a null list which is different than an empty list.

Rob -- it crashes regardless of whether it's hidden or not.


rob1221

  • Master Stencyler
  • *
March 26, 2017, 07:21:35 am
I was testing this issue and I did get an error when using an empty non-hidden list.  However, the error went away after adding and removing something from the list in the scene editor and now I no longer get the error even when making new scenes and new lists.


Pages: 1

Details

  • Reported
    March 17, 2017, 09:25:28 am
  • Updated
    March 26, 2017, 07:21:35 am

  • View Status
    Public
  • Type
    Suggestion
  • Status
    New
  • Priority
    Normal
  • Version
    3.4.0 beta5
  • Fixed in
    (none)
  • Assigned to
    (none)
  • Category
    Stencylpedia

Tags