https://github.com/defgsus/lovebot
Botlove python server and client + webclient
https://github.com/defgsus/lovebot
bot botwars client love server simulation websocket
Last synced: about 1 year ago
JSON representation
Botlove python server and client + webclient
- Host: GitHub
- URL: https://github.com/defgsus/lovebot
- Owner: defgsus
- Created: 2018-07-09T15:54:42.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-18T03:20:48.000Z (almost 8 years ago)
- Last Synced: 2025-02-05T07:31:50.653Z (over 1 year ago)
- Topics: bot, botwars, client, love, server, simulation, websocket
- Language: Python
- Size: 80.1 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Lovebot
This is a lovely robot simulation running on a webserver.
`loveserver.py` starts an http server that delivers a website to view the arena
and a websocket server for observers and robot lovers.
A simple client controlling a few bots is in the `examples` folder.
Bots live in a 2D world, constrained by solid objects and are themselves just circles
with [Braitenberg vehicle](https://en.wikipedia.org/wiki/Braitenberg_vehicle)-style
wheels. The wheel-speed can be set individually for both wheels.
The world can be [ray traced](https://en.wikipedia.org/wiki/Ray_tracing_(graphics)) to
find intersections with objects or bots. More precisely, the world is described by
simple geometric objects that allow the efficient calculation of the distance
to the next object's surface at any given point,
a technique called [sphere tracing](https://duckduckgo.com/?q=sphere+tracing).
Basically, a client looks like this:
```python
from lovelib.client import LoveClient
class MyLoveClient(LoveClient):
def on_connect(self):
self.bot = self.create_bot(name="Dieter")
def on_event(self, name, data):
pass
# called regularily
def on_update(self, delta_time):
# test distance to object at fixed location
d = self.world.distance_to(1, 2)
# find surface closest to bot in a certain direction
t = self.bot.trace_front()
t = self.bot.trace_degree(45)
# control movement
self.bot.set_wheel_speed(3, 4)
MyLoveClient("host", "user", "password").mainloop()
```