m having dificulties with the code again. So i better just say what im trying to do.
The idea is to make a RC car race game over wi-fi. (Think Mario Kart or Rock `n Roll Racing with real cars.). I got the idea from this guy:
so i`m using:
a windows PC that will be the crossbar.io server
The same PC will be a client with a browser and a gamepad. (i`m thinking that it can go up to 10 clients if it works)
each client will send gamepad commands through the browser to a car hooked with a raspberry pi and a camera.
i`m thinking the setup would be:
the “car” will have a python backend (mostly receiving the gamepad and send a message to the server when it makes a lap)
so i made a realm “race” then there will be topics like “pilot1 to 10” and “car1 to 10” and “server”.
the questions are:
Is what i`m thinking correct ?
i`m unsure, wich is best to use, PubSub or RPC to run python commands on the Raspberry Pi ? (from what i read looks like RPC is better)
is there already a standard way to know wich clients are subscribed to wich topic ? i`m asking this because i must know what cars are online, what pilots are connected to wich cars. (it can be set to a default, but the server must know)
in the PubSub model i didnt find a way to broadcast the info. Do i have to send a message to each topic ?
my current problems are:
- migrating the example code you provided for the gamepad from the monitor.js to python, since that`s the only thing the raspberry pi will be needing.
i`m still messing with both, the votes example as suggested by Alexander, and the basic pubsub but its hard since the codes seem different on each one.
- breaking down the array that the gamepad is sending. how is that formatted ?
any help will be greatly apreciated.