[BGMC29] - Online Retro Zombie Shooter - wkk.py (delayed)

upbge

(Fred/K.S) #41

ey sounds like some heavy work to get this online thing going right :sweat_smile:
But nice update so far!

Fred/K.S


(wkk.py) #42

Indeed :slight_smile:

Both on the client (Blender Game) and server (NodeJS on Heroku).

In the server case, it is mostly because I had to code almost all game logic and dispatch from scratch, as there is nothing like logic bricks or some default gameloop that you can use right away, you got to implement these concepts yourself.

For the client part, in my case I rely heavily on an event-loop for Python, so the trickiest part was to understand how the technology worked in order to have it run inside a Blender Game. At the end of the day, it is not really that hard, but it is not obvious to everybody either. But the advantage of having an event-loop is that it will manage most low level stuff and trigger events when required, which is a very useful behavior when working with I/O, such as network messages.

Once both client and server are set, then a protocol must be designed for both of them to synchronize states and transmit events, that’s another funny part. But the process is rather straight-forward: just try to think about whatever data is needed and send it away, fine tune as required. Oh, and identifiers everywhere.


So yes, since it is not something that is directly provided by the engine, a bit has to be setup on the side for it to work, but it is not that complicated after all.

Most of the technology required for it is already well known and standardized:

  • Blender Game Engine running Python scripts running asyncio (maybe the most edgy here)
  • NodeJS HTTP server hosted on some free platform
  • WebSockets for bidirectional communication
  • Very stupid protocol sending just a bunch of ids around

That’s it, that’s my stack.


So right now I work hard on the gameplay / technical side of it, and once everything is setup, I will be able to focus on making it look nice :smiley:


(wkk.py) #43

Update time!

Finally refactored the server. It looks more and more like a micro game engine of its own, but without UI…

This also allowed me to fix the teamkill issue.

That’s it. Just that.

Refactorings are tiring lol


(wkk.py) #44

Update time!

I tweaked a bit how zombies are moving: They are faster, and they want brains!

They don’t yet attack, but they will move toward the closest player now, aggressively push you, lol

So, if you still have a release build for 0.2.4, please try the game with a friend of yours!

Latest Game Release

On the other hand, I spent most of my time trying to setup a build server for UPBGE, because when I say you can play using UPBGE v0.2.4, I mean the exact release from upbge.org.

Now the issue is that the website certificate expired, making it hard for some people to keep accessing it (on my end I just cannot at all…)

And as I am on Linux, I cannot build for Windows which seems to be used by most people here.

Solution then was to use a CI web service, so I have been doing that.


(wkk.py) #45

Update time!

Went a bit under the radar lately, but it was to take a break after some work I had done over my week-end to build UPBGE. I will have to pick up where I left it at some point too, but in order to breathe a bit I worked on some side features :slight_smile:

The website got improved!

So far I used the web server solely to host the game logic, and it would only dispatch a very simple text, and you had to manually refresh the page to see it updated.

So over the last few days, I worked hard at writing the foundation for a proper small web app that will communicate with the server and update in realtime!

https://bgmc29-server.herokuapp.com

Disclaimer: Heroku shuts down the website after some inactivity, so do not worry if it takes long to load the first time, it might be restarting!

It will now show each connected player (if any…) and their current health.
(although no player is actually taking damage for now…)

For this I had to setup my server to actually serve files to your browser, used React for the frontend code, and webpack in order to serve a very compact javascript bundle file (instead of a lot of little scripts).

It wasn’t really easy to do from scratch, but nothing is when you do it for the first time.

But now it works!

Next, to keep on the web stuff:

  • Add a small PostgreSQL database to track some player stats
  • Display a scoreboard on the website

If I were working in a team I guess the work on the actual game and this side web stuff could be parallelized, but oh well. For now it’s web time I guess :slight_smile: