Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How To Enjoy!!! #8

Open
nanqiaoyoumu opened this issue Mar 7, 2024 · 5 comments
Open

How To Enjoy!!! #8

nanqiaoyoumu opened this issue Mar 7, 2024 · 5 comments

Comments

@nanqiaoyoumu
Copy link

I am a beginner from China. I really want to know where this env is added, or where it exists to edit, and which file to run. I really hope to join you.

@PWhiddy
Copy link
Owner

PWhiddy commented Mar 8, 2024

Hi, welcome!
There's instructions in the main repo:
https://github.com/PWhiddy/PokemonRedExperiments

Essentially you'll use it like this:

def make_env(rank, env_conf, seed=0):
    """
    Utility function for multiprocessed env.
    :param env_id: (str) the environment ID
    :param num_env: (int) the number of environments you wish to have in subprocesses
    :param seed: (int) the initial seed for RNG
    :param rank: (int) index of the subprocess
    """
    def _init():
        env = StreamWrapper(
            RedGymEnv(env_conf), 
            stream_metadata = {
                "user": "some_username", 
                "env_id": rank,
                "color": "#0033ff",
                "extra": "", # any extra text you put here will be displayed
            }
        )
        env.reset(seed=(seed + rank))
        return env
    set_random_seed(seed)
    return _init

@Neya45
Copy link

Neya45 commented Jun 1, 2024

Hod do you find the env_id ?

@PWhiddy
Copy link
Owner

PWhiddy commented Jun 30, 2024

@Neya45
when you are initializing the environments (the linked code example uses a list comprehension), you essentially just assign the index of each env as the env_id. they can be anything really, just as long as theyre unique to each env

@Michch333
Copy link

Hey @PWhiddy - This is amazing.
I'm also confused at how to get this running.
I am able to run_pretrained and that all works fine.

I have set up the StreamWrapper as above, but what do i 'run' in python to start this??
Any help is greatly appreciated!

@PWhiddy
Copy link
Owner

PWhiddy commented Jan 22, 2025

Hey!

When you say "what do I run to start this", do you mean run a training script with the stream wrapper streaming to the shared map server, or do you mean running your own private local map streaming server?

For the former, see the v2 training script an example which now automatically does this by default.

For the latter, you'll want to serve the files in the root directory with a simple http server, and you can use node to run the websocket server which is in the ws-server directory.

Note if you're running your own map server you'll need to adjust the websocket url in the stream wrapper to point to your version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants