Testing Levels with PGE Causes Problems with Sprite Overrides

This is the place for discussion and support for LunaLua and related modifications and libraries.

Moderator: Userbase Moderators

Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on topic/appropriate?
-Are you posting in the right forum/following the forum rules?
Sambo
Snifit
Snifit
Posts: 211
Joined: Fri Jan 24, 2014 6:43 pm

Testing Levels with PGE Causes Problems with Sprite Overrides

Postby Sambo » Mon Aug 15, 2016 7:05 pm

I have a sprite override that runs in onDraw (only once). For some reason, if I start a test in SMBX from the PGE editor, it gives me this error:
Image

It works fine if I start the test directly from SMBX.

Kevsoft
Ripper II
Ripper II
Posts: 375
Joined: Sun Jul 27, 2014 8:03 am

Re: Testing Levels with PGE Causes Problems with Sprite Overrides

Postby Kevsoft » Tue Aug 16, 2016 11:03 am

Please test if the image is valid. I could only think that Graphics.loadImage somehow fails

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Testing Levels with PGE Causes Problems with Sprite Overrides

Postby PixelPest » Tue Aug 16, 2016 12:15 pm

Could you maybe post the code?

Sambo
Snifit
Snifit
Posts: 211
Joined: Fri Jan 24, 2014 6:43 pm

Re: Testing Levels with PGE Causes Problems with Sprite Overrides

Postby Sambo » Tue Aug 16, 2016 1:59 pm

Kevsoft wrote:Please test if the image is valid. I could only think that Graphics.loadImage somehow fails
The image is valid. As I said, the override is successful unless I start the test using "Test in SMBX" function of the PGE editor. I just tested to make sure, and no matter where I start the test from, the image loads. Unless a test from PGE makes it load the image in the wrong format somehow, this is not the problem.
PixelPest wrote:Could you maybe post the code?

Code: Select all

function layers.draw()
	if layers.debug then
		for _,v in pairs(nodes) do
			Graphics.drawImageToScene(debugImg, v.x, v.y)
			textblox.printExt(v.id, {x = v.x + 16, y = v.y + 16, font = textblox.FONT_SPRITEDEFAULT3X2, bind = textblox.BIND_LEVEL})
		end
	else
		if not frame then
			Graphics.sprites.background[anchor].img = Graphics.loadImage(Misc.resolveFile("blank.png")) -- Add this file to a folder in luaScriptsLib
			frame = true
		end
	end
end
This function is part of an API, and it is registered to the onDraw event.
debugImg is an image resource, and anchor is the ID of a BGO.

Actually, that's not the only problem I have with this API. What this API does is, it introduces a position-based layer movement system to SMBX. The trouble is, the layers don't want to stop moving once they start moving. It sets the x and y speeds to 0.0001 when I tell them to stop. This slowly but surely messes up the positions of the layers. Sometimes, the layers will just "twitch" like crazy instead of stopping, sending Mario flying to the left or right at high speeds when he touches them. The only thing I can do is continually set the speed to move the layer back to the desired position, but this sometimes causes an overflow crash.
Here is a paste of the whole code:
http://hastebin.com/ekofuqarud.lua

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Testing Levels with PGE Causes Problems with Sprite Overrides

Postby PixelPest » Tue Aug 16, 2016 6:36 pm

Ah. Your argument in square brackets for Graphics.sprites is wrong. It should be an ID instead of a Lua Image Resource. You should also just be do local blank = Graphics.loadImage("blank.png"); at the top of your file as well instead of loading it every time. You also don't really need Misc.resolveFile() in that either

Sambo
Snifit
Snifit
Posts: 211
Joined: Fri Jan 24, 2014 6:43 pm

Re: Testing Levels with PGE Causes Problems with Sprite Overrides

Postby Sambo » Tue Aug 16, 2016 10:26 pm

PixelPest wrote:Ah. Your argument in square brackets for Graphics.sprites is wrong. It should be an ID instead of a Lua Image Resource.
It is an ID.
I, Sambo, wrote:... anchor is the ID of a BGO.
PixelPest wrote:You should also just be do local blank = Graphics.loadImage("blank.png"); at the top of your file as well instead of loading it every time. You also don't really need Misc.resolveFile() in that either
It only loads the image on the first frame, and if it didn't do that every time, it would work even less than it does now. The reason that it has Misc.resolvefile is so it can load the image from the LuaScriptsLib folder.

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Testing Levels with PGE Causes Problems with Sprite Overrides

Postby PixelPest » Tue Aug 16, 2016 10:29 pm

Have you debugged anchor to make sure it isn't nil when it's run through Graphics.sprites?

HenryRichard
Reznor
Reznor
Posts: 2843
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: Testing Levels with PGE Causes Problems with Sprite Overrides

Postby HenryRichard » Tue Aug 16, 2016 11:14 pm

The way PGE does testing is weird; it doesn't copy absolutely everything needed (like images in the episode folder). It's because of PGE and not your code.

Wohlstand
Chargin' Chuck
Chargin' Chuck
Posts: 2008
Joined: Tue Feb 11, 2014 4:44 pm
Flair: [ˈvoːlˌʃtant], 狐エンジニア
Pronouns: he/him
Contact:

Re: Testing Levels with PGE Causes Problems with Sprite Overrides

Postby Wohlstand » Wed Aug 17, 2016 4:33 am

HenryRichard wrote:The way PGE does testing is weird; it doesn't copy absolutely everything needed (like images in the episode folder). It's because of PGE and not your code.
That was in legacy testing implementation. Latest version in the laboratory (you also must load latest dev build of the LunaLUA!) supports direct test launching without copying of the stuff, therefore new testing system (now named as LunaTester) will send level data and will refer episode path that is real, and will don't generate dummy episodes that needed only for vanilla SMBX without LunaLUA. I'll release it with updated PGE Engine which now waiting my new better physical engine implementation

HenryRichard
Reznor
Reznor
Posts: 2843
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: Testing Levels with PGE Causes Problems with Sprite Overrides

Postby HenryRichard » Wed Aug 17, 2016 4:48 pm

Ah, okay. I haven't updated PGE in a while, so I guess that's what my problem is.

Sambo
Snifit
Snifit
Posts: 211
Joined: Fri Jan 24, 2014 6:43 pm

Re: Testing Levels with PGE Causes Problems with Sprite Overrides

Postby Sambo » Wed Aug 17, 2016 6:09 pm

I moved the override to onStart and it fixed the problem. I still don't understand what the problem was, though.
Wohlstand wrote:That was in legacy testing implementation. Latest version in the laboratory (you also must load latest dev build of the LunaLUA!) supports direct test launching without copying of the stuff, therefore new testing system (now named as LunaTester) will send level data and will refer episode path that is real, and will don't generate dummy episodes that needed only for vanilla SMBX without LunaLUA. I'll release it with updated PGE Engine which now waiting my new better physical engine implementation
So, to use this, do we need the SMBX Integration config pack? Because with the full config I can't launch a test in SMBX if the editor isn't opened.

Wohlstand
Chargin' Chuck
Chargin' Chuck
Posts: 2008
Joined: Tue Feb 11, 2014 4:44 pm
Flair: [ˈvoːlˌʃtant], 狐エンジニア
Pronouns: he/him
Contact:

Re: Testing Levels with PGE Causes Problems with Sprite Overrides

Postby Wohlstand » Thu Aug 18, 2016 3:29 am

Sambo wrote:So, to use this, do we need the SMBX Integration config pack? Because with the full config I can't launch a test in SMBX if the editor isn't opened.
Yes, you need SMBX Integration pack (take from laboratory because other is incompatible), especially to point your actual SMBX directory. In-Editor test runner is outdated and buggy because SMBX's iternals and lacks of right detection of opened SMBX Editor (on LunaLUA side is required to make extra shared memory to tell that editor is started (for example, keep hwnd of the editor window))

Sambo
Snifit
Snifit
Posts: 211
Joined: Fri Jan 24, 2014 6:43 pm

Re: Testing Levels with PGE Causes Problems with Sprite Overrides

Postby Sambo » Thu Aug 18, 2016 6:36 pm

The SMBX Integration config is the same as the full SMBX config, except that it uses the previously installed SMBX directory, right?


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari