Giter VIP home page Giter VIP logo

carla-multiplayer's Introduction

carla-multiplayer

Multiplayer Carla using a ghetto game-streaming concept; in summary:

  • A vehicle and a sensor are created in Carla using Carla's PythonAPI
  • Controls are received as JSON via UDP and applied to the vehicle (using the PythonAPI)
    • The controls are originally sourced from a PS4 or Xbox 360 controller
  • Images are pulled (using the PythonAPI), converted to .webp and sent via UDP
    • The images are displayed using pyame

So, all the work and rendering is done server-side, the client-side merely captures input and displays the sensor images.

Install (MacOS)

  • Create a virtualenv
    • virtualenv -p `which python3` venv
  • Activate the virtualenv
    • source venv/bin/activate
  • install the requirements
    • pip install -r requirements.txt
  • Install pygame (special process for MacOS)
    • brew install sdl sdl_image sdl_mixer sdl_ttf portmidi
    • pip install https://github.com/pygame/pygame/archive/master.zip
  • If you're using an Xbox 360 controller; install 360Controller/360Controller

Run

  • Server (for a single client)
    • python3 -m carla_multiplayer.server 13337 13338 vehicle.komatsu.830e 192.168.137.196
      • 13337 = vehicle port
      • 13338 = screen port
      • vehicle.komatsu.830e = vehicle blueprint
      • 192.168.137.196 = client host
  • Client (to connect to a server)
    • python3 -m carla_multiplayer.client 192.168.137.251 13337 13338
      • 13337 = vehicle port
      • 13338 = screen port
      • 192.168.137.251 = server host
  • Coordinator (TODO)
    • Use Pyro4 to create all the required objects and instruct a Player object on what to do

Main components

  • Server (you need one of these per Client)
    • Vehicle
      • Create a vehicle actor in Carla
      • Apply controls to that actor
    • Sensor
      • Create a sensor actor in Carla (attached to the vehicle)
      • Pull images from it
  • Client (you need one per server)
    • Controller
      • Read axis and button data from a PS4 or Xbox 360 controller
      • Send controls to the Vehicle
    • Screen
      • Read images from the Sensor
      • Write them to the local display

Supporting components

  • Looper
    • Provide start/stop semantics for threading w/ before loop, before work, work, after work and after loop calls
  • TimedLooper
    • Same as above but on a strict loop period
  • Threader
    • Provide start/stop semantics for one or more threads
  • UDP
    • Sender
      • Send datagrams with minimal waiting using queues
    • Receiver
      • Receive datagrams and invoke callbacks with minimal waiting using queues

carla-multiplayer's People

Contributors

initialed85 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.