trAInsported

Show off your games, demos and other (playable) creations.
Post Reply
Germanunkol
Party member
Posts: 712
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: trAInsported: Alpha testers needed

Post by Germanunkol »

Actually, I just had a friend test on a win PC last night and she had the exact same problem (that and the fact that she couldn't find the AI folder at first because it is hidden).
I have no idea what's wrong with it, but it might be that the paths are messed up on the windows version. The problem should be somewhere in ai.lua, but it's quite a complex setup.
If you don't want to poke around give me a few days and I'll try to work it out...

Edit: Maybe you could try it once more and give me the console printout (after trying the "reload"-button) when you start with the --console option?
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
gennn
Prole
Posts: 5
Joined: Mon Feb 18, 2013 11:59 am

Re: trAInsported: Alpha testers needed

Post by gennn »

Hi!
I have the same problem. I think this is the relevant part i get in the console:

Code: Select all

scriptName      C:/Users/hp3015/AppData/Roaming/LOVE/trAinsported.love\AI\trAins
ported.love\AI\TutorialAI1.lua
Err: Scripts/ai.lua:86: attempt to index global 'fh' (a nil value)
Your game looks beautiful, looking forward to play it! :awesome:
LuaWeaver
Party member
Posts: 183
Joined: Wed Mar 02, 2011 11:15 pm
Location: Ohio, USA

Re: trAInsported: Alpha testers needed

Post by LuaWeaver »

EDIT: I found the bug! Windows uses both backslashes and forward slashes when talking about directories, but only one at a time. It prints "scriptName C:/Users/Ben Zastawnik/AppData/Roaming/LOVE/trAInsported\AI\TutorialAI1.lua", and the differing slashes cause Windows to have a panic attack and not open the file.

EDIT 2: Damn, you beat me to it! I spent too long fiddling with the PATH variables instead of just modifying love.conf.
Last edited by LuaWeaver on Mon Feb 18, 2013 5:01 pm, edited 4 times in total.
"your actions cause me to infer your ego is the size of three houses" -finley
Germanunkol
Party member
Posts: 712
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: trAInsported: Alpha testers needed

Post by Germanunkol »

@ gennn: Thanks, that was indeed the problem!
@ LuaWeaver: You're right, I messed up there. The error is actually occurring much earlier in the process: I set the wrong path to the AI folder on windows systems.

I did not know Löve/Lua handle the path's slashes for me. So I thought I had to differ between the two and use \ for Windows and / for Unix systems. I was wrong there, I should be using / for both.

I've sent a version to a friend to test. If you want to test it yourself, in main.lua, replace this:

Code: Select all

		AI_DIRECTORY = love.filesystem.getSaveDirectory()
		if AI_DIRECTORY:find("/") == 1 then		-- Unix style!!
			AI_DIRECTORY = AI_DIRECTORY .. "/AI/"
		else
			AI_DIRECTORY = AI_DIRECTORY .. "\\AI\\"
		end
with this:

Code: Select all

		AI_DIRECTORY = love.filesystem.getSaveDirectory()
		AI_DIRECTORY = AI_DIRECTORY .. "/AI/"
This has not been confirmed to work yet - if it does, please tell me! Otherwise I'll wait for confirmation by my friend and upload a new version once that's sorted out.
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
LuaWeaver
Party member
Posts: 183
Joined: Wed Mar 02, 2011 11:15 pm
Location: Ohio, USA

Re: trAInsported: Alpha testers needed

Post by LuaWeaver »

Yes, it does work on my machine now! I can get past the tutorial now just fine.
"your actions cause me to infer your ego is the size of three houses" -finley
Germanunkol
Party member
Posts: 712
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: trAInsported: Alpha testers needed

Post by Germanunkol »

Great! Thanks for reporting. WIll update the .love file in the first post sometime tomorrow, probably.

@Ronald_Yonaba: I think at some point I'll try to implement your pathfinding into an AI... it looks very solid: https://github.com/Yonaba/Jumper :D Or does any one else want to give it a try?
Right now I still don't allow "require" in AIs, as that will be hard to work with when uploading -> I only want to allow one file to be uploaded at a time.
Any thoughts on this? Any ideas how I could allow the require function?
Only way I can think of right now is to parse the file, look for "require" calls, then copy+paste those files into the file where the require call was...? But when? Maybe upon upload? Anyone with enough php knowledge for this?
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
User avatar
Taz
Prole
Posts: 11
Joined: Tue Feb 12, 2013 3:36 pm

Re: trAInsported: Alpha testers needed

Post by Taz »

@Germanunkol

Isn't it possible to just upload a zip file to your server and read all the related .lua-files out of it ? Here is a library that can load .zip files : http://www.keplerproject.org/luazip/manual.html

Hope this helps :nyu:
Germanunkol
Party member
Posts: 712
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: trAInsported: Alpha testers needed

Post by Germanunkol »

That's a good idea, but then people would have to zip the files correctly - which is simple enough, but another hurdle to overcome. Also, upon zipping, hierarchy may be lost... in case someone includes a file from somewhere else.

The longer I think of it, the more I like this approach:
When a user chooses a file to upload, the script searches the file beforehand for "require" statements. All the files found are copied into the main source file (but only the copy which is to be uploaded - the file on the computer stays the same). Then I'd only have one file uploaded and this would be a fully functional AI - no need to change my server code. It's already ugly enough as it is, because it has to work with a mysql database to load the files.
But I'd really have to dive even further into javascript/php for this.
So I'll give it more thought and maybe go for your .zip idea...
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: trAInsported: Alpha testers needed

Post by Robin »

Germanunkol wrote:When a user chooses a file to upload, the script searches the file beforehand for "require" statements. All the files found are copied into the main source file (but only the copy which is to be uploaded - the file on the computer stays the same). Then I'd only have one file uploaded and this would be a fully functional AI - no need to change my server code.
Good grief, that is ugly.
  1. If you do this, at least wrap the included scripts in do ... end blocks, otherwise locals will break.
  2. I don't know how errors are handled, but if the uploader gets to see tracebacks when something goes wrong, this approach renders them nearly useless.
  3. Ugh.
Help us help you: attach a .love.
Germanunkol
Party member
Posts: 712
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: trAInsported: Alpha testers needed

Post by Germanunkol »

Good point.
I was going to use functions instead of do ... end blocks, because that way a object oriented approach in the form of:

Code: Select all

object = {}
function object.new()
   ...
end

return object
would not be destroyed.

How about this approach: The upload script looks for all the require calls and then automatically zips those files and uploads the zipped file? That way users wouldn't have to deal with it...
No idea how to do this though.
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
Post Reply

Who is online

Users browsing this forum: Hugues Ross and 0 guests