code: def main(args):
      # Create multiple environments: this speeds up training with PPO
      # We apply two wrappers on the environment:
      #  1) The above wrapper that modifies the observations (takes only the image and resizes it)
      #  2) A reward scaling wrapper. Normally the scenarios use large magnitudes for rewards (e.g., 100, -100).
      #     This may lead to unstable learning, and we scale the rewards by 1/100
      def wrap_env(env):
          env = ObservationWrapper(env)
          env = gymnasium.wrappers.TransformReward(
              env, lambda r: r * 0.01
          )
          return env
  
      envs = make_vec_env(
          args.env, n_envs=N_ENVS, wrapper_class=wrap_env
      )
  
      agent = PPO("CnnPolicy", envs, n_steps=N_STEPS, verbose=1)
  
      # Do the actual learning
      # This will print out the results in the console.
      # If agent gets better, "ep_rew_mean" should increase steadily
      agent.learn(total_timesteps=TRAINING_TIMESTEPS)
  
file_path: ViZDoom/examples/python/learning_stable_baselines3.py
imports: from argparse import ArgumentParser
  import cv2
  import gymnasium
  import numpy
  from stable_baselines3 import PPO
  from stable_baselines3.common.env_util import make_vec_env
  import vizdoom.gymnasium_wrapper
label_desc: Use image node_id 1 for calling a global function with example usage: main(args) and returns: env