Page 1 of 2
Custom tiles crash my game

Posted:
27 Feb 2015, 05:02
by dexnim
So I got the supertux editor up and running, and I decided that I wanted to add in some customized tiles that I could use for fun, and maybe even contribute a bit. I figured out how to add tiles to the editor list in tiles.strf, and the formatting that that uses. The tiles show up in the editor exactly how I wanted them to, but when I place them in a level and run the level for a little test run, the game crashes(it leaves the editor open though). This ONLY happens with my tiles. I've tried it without my tiles, with different ids for my custom tiles, and it has the same result. Without my tiles it runs fine, with them it crashes, no matter their id. Here's the code I used to add them to tiles.strf:
(tilegroup
(name "Custom")
(tiles
9000 9001 9002 9003
9004 9005 9006 9007
)
)
(tiles
(width 4)
(height 2)
(ids
9000 9001 9002 9003
9004 9005 9006 9007
)
(attributes
1 1 1 1
0 0 0 0
)
(image "tiles/custom/custom.png")
)
The 1 makes it solid and the 0 makes it have no properties(I think) ... (I hope).
They're just simple tiles. Variations of the basic snow tiles. 32x32 pixels, 4 tiles wide and 2 tiles tall in the image (128x64 pixels). No other tile exists with ids 9000 or above.
Is there something else I need to do to get custom tiles to work? Help would be greatly appreciated.
Re: Custom tiles crash my game

Posted:
28 Feb 2015, 01:36
by GiBy
Hi,
Please, precise which editor you are using (the mono in C# or flexlay)
Stupid question, have you add them in your supertux data?
For such a question the IRC would be better… for contrib tiles maybe have a look at this
http://supertux.lethargik.org/wiki/Worlds
Re: Custom tiles crash my game

Posted:
28 Feb 2015, 01:44
by Tobbi
Hey,
is there any output in the SuperTux debug log / console window? If not, can you please give me a diff file? If you have git installed, simply put that level in the same directory, supertux is in, then run git diff > level_crash.diff and attach the .diff file to this thread, then I can take a look.
Thanks!
--Tobbi
Re: Custom tiles crash my game

Posted:
28 Feb 2015, 04:04
by dexnim
The console window says about a billion of this:
[WARNING] /building/buildd/supertux-0.3.4/src/supertux/tile_set.hpp:53 Invalid tile: 9001
By the way, 9001, 9002, 9003, 9004, 9005, 9006, 9007, and 9008 are the ids I assigned to my tiles.
git diff > Test_crash.diff didn't work (Test is the name of my level) is there something else I need to add to the command?
Re: Custom tiles crash my game

Posted:
28 Feb 2015, 10:31
by Tobbi
In that case, please attach your tiles.strf and your level to this post and I will take a look.
Thanks!
Re: Custom tiles crash my game

Posted:
28 Feb 2015, 12:16
by Tobbi
EDIT: I just noticed something.
In tiles.strf, you find the next tile ID at the bottom of the file.
Currently it says this
;; next-id: 3261
Can you please continue with 3261, 3262 for the tile IDs? Thank you!
Re: Custom tiles crash my game

Posted:
28 Feb 2015, 18:14
by dexnim
Using different ids didn't help for some reason. I even tried more arbitrary ones, but that didn't help either. The result was that the game crashed immediately, and didn't even let me see what was wrong.
I had to rename both files with the .txt extension because it wouldn't let me upload .stl or .strf.
Re: Custom tiles crash my game

Posted:
28 Feb 2015, 23:36
by Tobbi
Re: Custom tiles crash my game

Posted:
01 Mar 2015, 01:36
by dexnim
Oops, that was the wrong level. I forgot to add the tile to it. Upload the actual level. Sorry for the inconvenience.
Re: Custom tiles crash my game

Posted:
01 Mar 2015, 12:56
by Tobbi
I believe I also need your graphics file to proceed.
If anything, this shows we definitely need a better process for creating levels.
Re: Custom tiles crash my game

Posted:
01 Mar 2015, 22:33
by dexnim
By graphics file you mean the image I used for the tiles, right? If so, here it is.
Yeah, and maybe a system for adding custom tiles that is easier for non-computer-minds to understand. (My brother wanted to do it too but has no clue what he's doing, so I have to do it for him)
Re: Custom tiles crash my game

Posted:
02 Mar 2015, 01:21
by Tobbi
Hey,
I will add your tiles to the tiles.strf file and tell you when it's done. Alternatively, I can give you a patch file that should work.
Re: Custom tiles crash my game

Posted:
02 Mar 2015, 01:41
by Tobbi
I added your tiles to the SuperTux resource file. It seems to be working fine. Please update your SuperTux from Git or take the attached tiles.txt file, rename it into tiles.strf and replace it. Please move the png file to tiles/snow/custom.png.
The new tiles have the IDs 3261-3268!
Re: Custom tiles crash my game

Posted:
13 Mar 2015, 00:28
by dexnim
Sorry for the delayed response. Now I can't even open any levels. I believe the problem is that the tiles.strf file is under root only permissions, but I ran chmod 777 on the file and it still gives me the two errors. Here they are:
Error title: Error loading level: Exception has been thrown by the target of an invocation.
Details:
"Exception has been thrown by the target of an invocation."
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
at System.Reflection.MonoCMethod.DoInvoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000] in <filename unknown>:0
at LispReader.LispRootSerializer.CreateObject (System.Type Type) [0x00000] in <filename unknown>:0
at LispReader.LispRootSerializer.Read (Lisp.List list) [0x00000] in <filename unknown>:0
at LispReader.LispSerializer.ReadType (System.Type type, Lisp.List list) [0x00000] in <filename unknown>:0
at LispReader.LispSerializer.Read (System.IO.TextReader Reader, System.String Source) [0x00000] in <filename unknown>:0
at LispReader.LispSerializer.Read (System.String FileName) [0x00000] in <filename unknown>:0
at Application.Load (System.String fileName) [0x00000] in <filename unknown>:0
--Caused by--
"Couldn't load resource 'images/tiles.strf'"
at Resources.DefaultResourceManager.Get (System.String ResourcePath) [0x00000] in <filename unknown>:0
at Util.Load (System.String Filename, System.String RootElement) [0x00000] in <filename unknown>:0
at Tileset..ctor (System.String Resourcepath) [0x00000] in <filename unknown>:0
at Level..ctor () [0x00000] in <filename unknown>:0
at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
--Caused by--
"Access to the path "/usr/share/games/supertux2/images/tiles.strf" is denied."
at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0
at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean isAsync, Boolean anonymous) [0x00000] in <filename unknown>:0
at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess)
at Resources.DefaultResourceManager.Get (System.String ResourcePath) [0x00000] in <filename unknown>:0
Error title: Unexpected Exception: Object reference not set to an instance of an object.
Details:
"Object reference not set to an instance of an object"
at PropertiesView.CreatePropertyWidgets (System.String title, System.Object NewObject) [0x00000] in <filename unknown>:0
at PropertiesView.SetObject (System.Object NewObject, System.String title) [0x00000] in <filename unknown>:0[/spoiler]
After I close the two error report windows, the supertux editor remains as it was when I opened it. That is, it's ready to edit a level, but no level is loaded to edit.
Re: Custom tiles crash my game

Posted:
13 Mar 2015, 17:54
by Tobbi
Can you try running the editor with sudo?
So, it should look like this:
sudo mono <...other parameters...>.
Re: Custom tiles crash my game

Posted:
13 Mar 2015, 21:54
by dexnim
When I run it as root it gives me this error:
The data path could not be calculated.
You must install a newer version of Supertux to use this version of the editor or specify the correct path to the supertux2 binary.
and is has Edit and (X)No as options. When I click edit it brings up the editor settings. When I click No it returns me to the editor, and then gives me those same two errors from before when I try to open a level.
Re: Custom tiles crash my game

Posted:
14 Mar 2015, 01:03
by Tobbi
Please see if you can set the editor path manually in /home/USERNAME/.config/supertux-editor/settings.xml or somewhere else.
I'm really sorry for this being so cumbersome.
EDIT: As an alternative, please try to restart the editor. There's a longstanding bug on the bugtracker that says you probably need to restart for changes to take effect.
Re: Custom tiles crash my game

Posted:
14 Mar 2015, 04:34
by dexnim
Well I was able to locate the file and change the path, but it still gives me those two original errors.(I changed the path from "supertux2" to "/usr/games/supertux2". That's right, right?) I've tried restarting the editor countless times already and it hasn't helped.
I ran the editor from the console with this command(mono /home/USERNAME/supertux.editor/supertux-editor.exe), and got this output:
INFO: Using configfile: /home/USERNAME/.config/supertux-editor/settings.xml
INFO: Supertux is run as: /usr/games/supertux2
[INFO] /build/buildd/supertux-0.3.4/src/supertux/main.cpp:223 [/home/USERNAME/.supertux2] is in the search path
[INFO] /build/buildd/supertux-0.3.4/src/supertux/main.cpp:223 [/usr//share/games/supertux2] is in the search path
INFO: Data files are in: /usr//share/games/supertux2
DEBUG: UndoManager.MarkAsSaved() called when UndoStack was empty. #This error appeared after I attempted to create a new level
(supertux-editor:4270): GLib-CRITICAL **: Source ID 707 was not found when attempting to remove it
#These errors appeared when I tried to open a previous level.
#I tried opening a level before(directly above the DEBUG error), and it gave me no error.
#Then I tried creating a level and that failed, so I tried opening again and it gave me these errors.
#(I'm repeating myself to attempt to be clear as to what I did to get these errors)
(supertux-editor:4270): GLib-CRITICAL **: Source ID 706 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 705 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 2681 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 678 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 680 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 695 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 682 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 679 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 697 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 694 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 681 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 699 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 696 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 683 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 701 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 698 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 687 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 685 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 700 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 684 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 702 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 686 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 704 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 689 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 691 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 703 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 688 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 693 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 690 was not found when attempting to remove it
(supertux-editor:4270): GLib-CRITICAL **: Source ID 692 was not found when attempting to remove it
Re: Custom tiles crash my game

Posted:
14 Mar 2015, 10:20
by Tobbi
EDIT: You can ignore those issues. The IDs given there do not correspond to anything in tiles.strf but have something to do with GLIB, an underlying library that we use. In order to create a new level, please press the New button (blank sheet).
Re: Custom tiles crash my game

Posted:
14 Mar 2015, 19:04
by dexnim
Okay, just making sure. But it still gives me those two errors from before no matter if I open an old level or create a new one.
Re: Custom tiles crash my game

Posted:
14 Mar 2015, 20:04
by Tobbi
Please disregard those debug messages for now. See if you can create a level and save / run it.

Re: Custom tiles crash my game

Posted:
15 Mar 2015, 02:28
by dexnim
I did. And that gives me those two errors from before.
Error title: Error loading level: Exception has been thrown by the target of an invocation.
Details:
"Exception has been thrown by the target of an invocation."
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
at System.Reflection.MonoCMethod.DoInvoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000] in <filename unknown>:0
at LispReader.LispRootSerializer.CreateObject (System.Type Type) [0x00000] in <filename unknown>:0
at LispReader.LispRootSerializer.Read (Lisp.List list) [0x00000] in <filename unknown>:0
at LispReader.LispSerializer.ReadType (System.Type type, Lisp.List list) [0x00000] in <filename unknown>:0
at LispReader.LispSerializer.Read (System.IO.TextReader Reader, System.String Source) [0x00000] in <filename unknown>:0
at LispReader.LispSerializer.Read (System.String FileName) [0x00000] in <filename unknown>:0
at Application.Load (System.String fileName) [0x00000] in <filename unknown>:0
--Caused by--
"Couldn't load resource 'images/tiles.strf'"
at Resources.DefaultResourceManager.Get (System.String ResourcePath) [0x00000] in <filename unknown>:0
at Util.Load (System.String Filename, System.String RootElement) [0x00000] in <filename unknown>:0
at Tileset..ctor (System.String Resourcepath) [0x00000] in <filename unknown>:0
at Level..ctor () [0x00000] in <filename unknown>:0
at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
--Caused by--
"Access to the path "/usr/share/games/supertux2/images/tiles.strf" is denied."
at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0
at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean isAsync, Boolean anonymous) [0x00000] in <filename unknown>:0
at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess)
at Resources.DefaultResourceManager.Get (System.String ResourcePath) [0x00000] in <filename unknown>:0
Error title: Unexpected Exception: Object reference not set to an instance of an object.
Details:
"Object reference not set to an instance of an object"
at PropertiesView.CreatePropertyWidgets (System.String title, System.Object NewObject) [0x00000] in <filename unknown>:0
at PropertiesView.SetObject (System.Object NewObject, System.String title) [0x00000] in <filename unknown>:0[/spoiler]
It doesn't even let me create a new level. Just gives me the two errors.
Re: Custom tiles crash my game

Posted:
15 Mar 2015, 12:48
by Tobbi
Did you "make install" the editor? Can you please try to run it from a different directory, such as your home directory?
Re: Custom tiles crash my game

Posted:
16 Mar 2015, 21:11
by dexnim
I can't even find the editor on my system anymore. What directory is it supposed be in?
Re: Custom tiles crash my game

Posted:
16 Mar 2015, 22:34
by Tobbi
After you run make, it should generate an exe file in a subdirectory of the cloned git dir...called "Debug" or something? You should find the supertux-editor.exe there, iirc.