Closed vidurvij closed 4 years ago
Can you specify which file? Because for example, PlayLevel.java reads the first level from SMB which is saved in levels/original/lvl-1.txt
Just compiled the Playgama.java file, it is throwing an exception. Tried to insert the absolute path for lvl-1.txt file from my computer. Didn't work and even tried to copy the text file in the same folder and just used the filename, that didn't work either.
On Mon, May 13, 2019 at 2:01 PM Ahmed Khalifa notifications@github.com wrote:
Can you specify which file? Because for example, PlayLevel.java reads the first level from SMB which is saved in levels/original/lvl-1.txt
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/amidos2006/Mario-AI-Framework/issues/1?email_source=notifications&email_token=AJ4Z7JVOWFBHANAYQNDPNQDPVHJJ5A5CNFSM4HMTLHWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVJRSBI#issuecomment-491985157, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ4Z7JXXLTZVKTMFXZ6NKD3PVHJJ5ANCNFSM4HMTLHWA .
That's kinda weird. Can you tell me what operating system, you are using and also what is the exception being thrown?
Ubuntu 18
and this is the error
java PlayLevel
javax.imageio.IIOException: Can't read input file!
at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1308)
at engine.helper.Assets.getImage(Assets.java:63)
at engine.helper.Assets.cutImage(Assets.java:83)
at engine.helper.Assets.init(Assets.java:35)
at engine.core.MarioRender.init(MarioRender.java:40)
at engine.core.MarioGame.runGame(MarioGame.java:204)
at engine.core.MarioGame.playGame(MarioGame.java:107)
at PlayLevel.main(PlayLevel.java:36)
Exception in thread "main" java.lang.NullPointerException
at engine.graphics.MarioBackground.updateArea(MarioBackground.java:41)
at engine.graphics.MarioBackground.
On Mon, May 13, 2019 at 2:27 PM Ahmed Khalifa notifications@github.com wrote:
That's kinda weird. Can you tell me what operating system, you are using and also what is the exception being thrown?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/amidos2006/Mario-AI-Framework/issues/1?email_source=notifications&email_token=AJ4Z7JTPPX2RMLQMX2BO34DPVHMLFA5CNFSM4HMTLHWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVJTSVA#issuecomment-491993428, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ4Z7JVC5LGTNWZF72DW4Q3PVHMLFANCNFSM4HMTLHWA .
That is not related to the level, that is error about the img folder. and it is not able to find it. Can you test running with no graphics. Try setting it to false in that line.
printResults(game.runGame(new agents.robinBaumgarten.Agent(), getLevel("levels/original/lvl-1.txt"), 20, 0, true));
The second error still persists Exception in thread "main" java.lang.NullPointerException at engine.core.MarioLevel.clone(MarioLevel.java:291) at engine.core.MarioWorld.clone(MarioWorld.java:118) at engine.core.MarioGame.gameLoop(MarioGame.java:235) at engine.core.MarioGame.runGame(MarioGame.java:208) at engine.core.MarioGame.runGame(MarioGame.java:168) at PlayLevel.main(PlayLevel.java:37)
On Mon, May 13, 2019 at 2:47 PM Ahmed Khalifa notifications@github.com wrote:
That is not related to the level, that is error about the img folder. and it is not able to find it. Can you test running with no graphics. Try setting it to false in that line. printResults(game.runGame(new agents.robinBaumgarten.Agent(), getLevel("levels/original/lvl-1.txt"), 20, 0, true));
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/amidos2006/Mario-AI-Framework/issues/1?email_source=notifications&email_token=AJ4Z7JSOEAO3MS3RTFJC4F3PVHOXJA5CNFSM4HMTLHWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVJVBJY#issuecomment-491999399, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ4Z7JTEA3K5DZ65UZQXXHDPVHOXJANCNFSM4HMTLHWA .
That's because the system is not able to find the level file so it reads an empty string.
can you test that code in the main for me instead of the current one? sorry for asking much.
printResults(game.runGame(new agents.robinBaumgarten.Agent(), "----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n" +
"----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n" +
"----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n" +
"----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n" +
"----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n" +
"----------------------------------------------------------------------------------g-----------------------------------------------------------------------------------------------------------------------\n" +
"----------------------!---------------------------------------------------------SSSSSSSS---SSS!--------------@-----------SSS----S!!S--------------------------------------------------------##------------\n" +
"-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------###------------\n" +
"-------------------------------------------------------------------------------g----------------------------------------------------------------------------------------------------------####------------\n" +
"----------------------------------------------------------------1------------------------------------------------------------------------------------------------------------------------#####------------\n" +
"----------------!---S@S!S---------------------tt---------tt------------------S@S--------------C-----SU----!--!--!-----S----------SS------#--#----------##--#------------SS!S------------######------------\n" +
"--------------------------------------tt------tt---------tt-----------------------------------------------------------------------------##--##--------###--##--------------------------#######------------\n" +
"----------------------------tt--------tt------tt---------tt----------------------------------------------------------------------------###--###------####--###-----tt--------------tt-########--------F---\n" +
"---M-----------------g------tt--------tt-g----tt-----g-g-tt------------------------------------g-g--------k-----------------gg-g-g----####--####----#####--####----tt---------gg---tt#########--------#---\n" +
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX--XXXXXXXXXXXXXXX---XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX--XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n" +
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX--XXXXXXXXXXXXXXX---XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX--XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 20, 0, false));
Yup directly copying the text file for the mario level is working.
Game Status: WIN Percentage Completion: 1.0 Lives: 0 Coins: 1 Remaining Time: 11 Mario State: 0 (Mushrooms: 0 Fire Flowers: 0) Total Kills: 3 (Stomps: 3 Fireballs: 0 Shells: 0 Falls: 0) Bricks: 0 Jumps: 15 Max X Jump: 195.28912 Max Air Time: 23
Can you pin point as to what might be the problem ?
On Mon, May 13, 2019 at 2:55 PM Ahmed Khalifa notifications@github.com wrote:
That's because the system is not able to find the level file so it reads an empty string.
can you test that code in the main for me instead of the current one? sorry for asking much. printResults(game.runGame(new agents.robinBaumgarten.Agent(), "----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n" + "----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n" + "----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n" + "----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n" + "----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n" + "----------------------------------------------------------------------------------g-----------------------------------------------------------------------------------------------------------------------\n" + "----------------------!---------------------------------------------------------SSSSSSSS---SSS!--------------@-----------SSS----S!!S--------------------------------------------------------##------------\n" + "-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------###------------\n" + "-------------------------------------------------------------------------------g----------------------------------------------------------------------------------------------------------####------------\n" + "----------------------------------------------------------------1------------------------------------------------------------------------------------------------------------------------#####------------\n"
- "----------------!---S@S !S---------------------tt---------tt------------------S@S--------------C-----SU----!--!--!-----S----------SS------#--#----------##--#------------SS!S------------######------------\n"
"--------------------------------------tt------tt---------tt-----------------------------------------------------------------------------##--##--------###--##--------------------------#######------------\n"
"----------------------------tt--------tt------tt---------tt----------------------------------------------------------------------------###--###------####--###-----tt--------------tt-########--------F---\n"
"---M-----------------g------tt--------tt-g----tt-----g-g-tt------------------------------------g-g--------k-----------------gg-g-g----####--####----#####--####----tt---------gg---tt#########--------#---\n"
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX--XXXXXXXXXXXXXXX---XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX--XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n"
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX--XXXXXXXXXXXXXXX---XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX--XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 20, 0, false));
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/amidos2006/Mario-AI-Framework/issues/1?email_source=notifications&email_token=AJ4Z7JVNVT32A2AMU6YASSLPVHPVXA5CNFSM4HMTLHWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVJVTEI#issuecomment-492001681, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ4Z7JXZBLUU5IELRO4WK4LPVHPVXANCNFSM4HMTLHWA .
So the problem is that relative paths used in the project are not working for some reason on ur machine. It might be because of some security from the OS where it doesn't allow file reading or something related to Ubuntu file system. I need to test on Ubuntu (as I didn't do that) and see a more generic way to file reading so that doesn't happen with someone else.
The project has two places with paths:
1 - The first one which is easy to notice is to load a level file which is PlayLevel.java
in src
.
2- The other is found in the Assets.java
class in src/engine/helper
where it tries to load the game graphics for rendering.
What I did is that I asked you to not depend on any of these to make sure if that is the problem. Disabling the graphics by using false force the framework not to load the graphics so it won't try to read these files. Copying the level text there will make sure that you won't try to read one of the level files.
what platform are you running your code ? I have an agent working but need to present it to someone, Having graphics will be helpful.
I am developing on OSX but I also tested it on Windows 10 machine :)
And can you help with how to do fire action as the action array only seem to show 4 directions of movement and speed up.
On Tue, May 21, 2019 at 7:58 PM Ahmed Khalifa notifications@github.com wrote:
I am developing on OSX but I also tested it on Windows 10 machine :)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/amidos2006/Mario-AI-Framework/issues/1?email_source=notifications&email_token=AJ4Z7JSALN2XXO7YCLPCZWLPWSZGFA5CNFSM4HMTLHWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODV5YB7Q#issuecomment-494633214, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ4Z7JXIVEEOBRXHDEIXUXDPWSZGFANCNFSM4HMTLHWA .
That's more of a Mario knowledge :) Mario fires fireball when he is in the fire state (by getting a fire flower). Everytime u press the speed, Mario fires a fireball. Hope this is helpful :)
Sent via the BlackBerry Hub for Androidhttp://play.google.com/store/apps/details?id=com.blackberry.hub From: notifications@github.com Sent: May 21, 2019 23:42 To: Mario-AI-Framework@noreply.github.com Reply-to: reply@reply.github.com Cc: amidos2002@hotmail.com; comment@noreply.github.com Subject: Re: [amidos2006/Mario-AI-Framework] Cant read the File (#1)
And can you help with how to do fire action as the action array only seem to show 4 directions of movement and speed up.
On Tue, May 21, 2019 at 7:58 PM Ahmed Khalifa notifications@github.com wrote:
I am developing on OSX but I also tested it on Windows 10 machine :)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/amidos2006/Mario-AI-Framework/issues/1?email_source=notifications&email_token=AJ4Z7JSALN2XXO7YCLPCZWLPWSZGFA5CNFSM4HMTLHWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODV5YB7Q#issuecomment-494633214, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ4Z7JXIVEEOBRXHDEIXUXDPWSZGFANCNFSM4HMTLHWA .
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/amidos2006/Mario-AI-Framework/issues/1?email_source=notifications&email_token=AAJ3T76RIVBVMKH226VB3QTPWS6ILA5CNFSM4HMTLHWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODV5Z22I#issuecomment-494640489, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAJ3T723ZAEXM7AR6SRLIS3PWS6ILANCNFSM4HMTLHWA.
So the problem is that relative paths used in the project are not working for some reason on ur machine. It might be because of some security from the OS where it doesn't allow file reading or something related to Ubuntu file system. I need to test on Ubuntu (as I didn't do that) and see a more generic way to file reading so that doesn't happen with someone else.
Hello,
I had the same problem and I fixed it by changing:
1.) The line in PlayLevel.java which calls the printresults() function to printResults(game.runGame(new agents.robinBaumgarten.Agent(), getLevel("../levels/original/lvl-1.txt"), 20, 0, true));
2.) Line 37 in engine/helper/Assest.java to final static String img = "../img/";
I have never worked with java before, so I don't know how secure/good solution it is or if its compatible with other systems, but maybe it helps someone
Ooooh, that sounds pretty good. do you want to make a pull request with that solution :)
Solved in the last pull request.
It is throwing an exception when we try to read the level file.