Hi everyone.
I’m Rob, I’ve worked as a python web developer for about 10 years with a few years hiatus. I’ve come back and discovered a bunch of new technologies that I’m excited to learn. I’m using Sanic to build a browser game, mostly as a learning experience, but more for fun.
Nice to meet you Rob!
When ready, share with us the game
Good luck !
Awesome! Can you tell us more about the browser game? I have one (or two) of those side projects also kicking around.
At the moment it’s a low graphics open world explorer. I have a visual admin page where I can add towns and change terrain. It will be a long-running mass-muliplayer kingdom warfare game.
I had gotten to the point where player cursors could be moved around a map (by manipulating database records) and viewed by a long polling admin app. It was very slow and clumsy and I knew I needed something better for the player client. So, now I’m currently rewriting part of what I have done on top of Sanic.
Welcome to the Sanic world! Assuming you are coming from something like Django, I suggest you try Sanic’s websockets for the client communication. Perhaps also use Redis pub/sub (aioredis
for asyncio or redio
for trio) for inter-client communication. rather than SQL database (if that was what you were using). These allow blazingly fast communication without polling and yet are remarkably simple to use.
@Tronic I 100% Agree.
It took me a few days to tailor a WS solution (based on the pubsub feed provided by @ahopkins), but now that it’s working, its REALLY working. I’m sending much less data, and getting much more done w/ WS than with using a ton of AJAX requests. The code is more modular too. I don’t need to build callbacks for every little request.
Websockets truly are the best friend of modern web apps.