Comments (11)
dont use the reset when an agent is stuck, use env.change_level(new_level=LVint). feel free to ask more questions
from gym-super-mario.
But I should reach enough score to change level, or it would say env has no attribution:change_level. How to solve it ?
from gym-super-mario.
I had these same issues, I am using this for a genetic algorithm and specifically need to train on each level, getting to a base score as this env does now is of no use to me. I have a branch on my repo that has as few changes as I could to achieve the functionality I needed. The only reset indicator I use is if the distance increase in a number of steps.
maxDistance = 0
oldDistance = 0
bonus = 0
bonusOffset = 0
staleness = 0
done = False
env.change_level(new_level=LVint)
while not done:
ob = env.tiles.flatten()
o = genome.evaluateNetwork(ob.tolist(),discrete=True)
ob, reward, done, _ = env.step(o)
if 'ignore' in _:
done = False
env = gym.make('meta-SuperMarioBros-Tiles-v0')
env.lock.acquire()
env.reset()
env.locked_levels = [False] * 32
env.change_level(new_level=LVint)
env.lock.release()
distance = env._get_info()["distance"]
if oldDistance - distance < -100 :
bonus = maxDistance
bonusOffset = distance
if maxDistance - distance > 50 and distance != 0:
maxDistance = distance
if distance > maxDistance:
maxDistance = distance
staleness = 0
if maxDistance >= distance:
staleness += 1
if staleness > 80 or done:
scores.append(maxDistance-bonusOffset+bonus)
if not done:
done = True
oldDistance = distance
I use this is a chunk of code from my current project (you can find this code in my jobtrainer function) to reset and change levels through all 32 levels as well as save scores through pipes, it is rather complicated because the only way to tell if mario has warped through a pipe is checking if his distance jumps more that 50 units, there might be a better unit but this works in practice. again this is using the env branched on my repo, it is hacky and gross but it works. In the future I would like to rewrite this to not have a base score needed to move to the next level and have windows support... big dreams here.
from gym-super-mario.
@koltafrickenfer I have tried your branch and solve this problem perfectly, but there are some little issues:
- It seems like your branch also use 'Tiles' version, but the running speed is much slower than original version, is there any way to improve it?
- Can I remove the mainmenu and just give mario one life to speed up my game?
- Could you please share the main points you modified from original version?
from gym-super-mario.
I believe only my instructions in my readMe specify to use the tiles version, just remove "-tiles-" from the env string.
If it is running slower than the original I have not noticed??? I run this in a 12 core opteron server with a gtx 1080 and if there is some issue with my branch causing a drop in performance I would love to resolve that.
In ppaquette_gym_super_mario/nes_env.py
look for line 51, self.cmd_args = ['--xscale 1.5', '--yscale 1.45', '-f 0','--opengl 1.5','--sound 0','--nogui']
, you can set the cmd line arguments for fceux here. maybe enable your gui / change openGL settings.
from gym-super-mario.
I merge the original NesEnv class and your MetaNesEnv class and solve the speed issue. And is there no way to change the source code of the game, such as set mario in a specified position? Or I can implement this via lua script?
from gym-super-mario.
you could implement that in the lua script.
from gym-super-mario.
Are you familiar with this lua script? I tried to modified its curr_page
and curr_x_position
, but I can only move mario in current screen, namely from 0 to 256.
from gym-super-mario.
I am familiar with the script but I have almost zero knowledge of the inner workings of the emulator/nes hardware.
from gym-super-mario.
Oh, I have solved this problem by reading fceux help files. Thank you very much!
from gym-super-mario.
How did you solve it? @shinshiner
A code snippet would be very appreciated!
from gym-super-mario.
Related Issues (20)
- Error UnregisteredEnv('No registered env with id: {}'.format(id)) HOT 1
- Env fails when creating temp lua file
- Emulator freeze HOT 2
- How about adding a function to move mario to a specified position?
- Training time of openai gym is too long, what is the good way to accelerate it? HOT 2
- How train Mario game with OpenAI gym in the cloud, and download this agent, and run this agent on myself computer ? HOT 3
- Modifications required to fit latest gym version HOT 4
- gym (0.9.3),,ImportError: No module named client, from gym.scoreboard.client HOT 5
- will it compatable gym latest version? HOT 1
- Install Without `gym-pull` HOT 3
- Mario Distance HOT 1
- NotImplementedError HOT 1
- Type Error 'int object is not subscriptable' HOT 1
- AttributeError: 'MetaSuperMarioBrosEnv' object has no attribute 'disable_out_pipe'
- Unusually large reward on first step
- Run on windows HOT 1
- Action Space doesn't allow sampling for random starts
- Error in gym-super-mario-bros package
- Only returning pixel data not Tile Data
- Cannot disable GUI for FCEUX HOT 19
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gym-super-mario.