BGMC 14 | Jetpack platformer

Thanks, this one gave me a lot of ideas for my current project and also finally forced me to get on with learning to use python classes properly, as the classless FSM I used in this game was a real pain in the neck! :smiley: I ended up declaring all variable for every state at initiation and then updated them every time there was a change of state.

I originally posted because I was looking at networking this as a demo.

I made some progress (clients could see one another), but a slight difficulty is that client state has to be pushed manually to the server before clients can see it, (mainly for the animation state, position) which I’d rather handle server-side (but prediction isn’t really possible at this stage).

If you’re interested in looking at helping me try this out (a slow project), then i’m committing here https://github.com/agoose77/bge_network_addon/test_game

At the moment, I’ve disabled most of the game, because most features aren’t distinguished for client/server.

Ideally, I’d like to make the following changes:

  • All particle effects occur client-side, requiring that they are triggered from “client state” (state that we send to the server, to be replicated)
  • All controls occur client side, except map owned interactions (i.e doors, elevators). These must run on the server.
  • Add map switching when players all finish

The new multiplayer addon (same repo) is what I’m using for this project. It’s mostly self explanatory, and there are video/written docs that outline what each aspect does.

Any player-controlled state is sent by an RPC call to the server, which can use it to set replicated properties. In the case of position and orientation, the actual worldPosition of the object on the server is what is replicated. Other state (like player_ob[‘player_state’]) needs to be sent to the server and then stored on a separate network attribute.

There’s a template class being used for player_ob so that we know if it’s a local player or not (that information is available from Python, so I just intercept it to write to a property)

Oh, cool. Although I didn’t write it originally with ideas of multiplayer I did try to keep things as simple and modular as possible.

One area which might cause problems is that some of the weapon damage is caused by particles, which is not ideal I guess. If the particles are resolved client side, the weapon damage effects should probably be be handled separately. Most of the particles are just for show, you could turn them off with no ill effects, but the rocket launcher, laser, flame thrower and bullet particles are the ones which have interactions with other objects.

I’m also not sure if I set any state changes to be dependent on animation timing. In my most recent project I had some states change once an animation finished, or when it reached a certain frame, but I found even in single player there were issues with this (if the armature goes out of the camera frame animation updates stop and the character gets stuck in that state). So… it would probably be best to make any state changes dependent on a timer, rather than on animation frame numbers.

If you have any questions or needs, just ask me. :smiley: It’d be fun to see this used as a multiplayer demo.

Wow that sounds awesome, I´d really love to see a working multiplayer game with the bge. I know there are some, but this game with multiplayer would definitly kill it :D. Hope you can get this to work.