BattleRoyale plugin (again ?)

Hi there!

I’m working on a BattleRoyale plugin which is rather a HungerGame plugin :sweat_smile:. At the moment it has very basics features but I think it’s usable to make small games with friends.

The plugin brings features to manage structures (in case an admin wants to setup a map). Its associated commands are available with /brp structure or /brp str commands. Basically, what the plugin does is:

  • Select a structure with golden hoe (same behavior than WorldEdit) ;
  • Save it with /brp structure save "structure name" as a “structure name”.schematic file ;
  • Spawn it with /brp str build "structure name" at the player’s position ;

Of course you can remove saved structures with the /brp rm "structure name" command.

Now, let’s talk a little about the BattleRoyale behavior. There are 3 kinds of player: the fighters, the spectators and the streamers - at the moment, only fighters matters so that I’m not going to tell about the others.

A game is separated into 4 steps :slight_smile:

  1. The LOBBY step (waiting players) ;
  2. The COUNTDOWN step (players are spawned in a circle around the defined spawn) ;
  3. The BATTLE step (when the players try to kill others) ;
  4. The END step (when only the winner is alive) ;

Because automatic behavior is not implemented yet, let’s see together how to setup a game.

How to setup a game?

First of all, you need to build (manually) a structure (use creative mode for this). Then save it as cornucopia. It’s very important to use this name at this point of the plugin’s development. (I’ll provide my cornucopia.schematic file but this i’m not a good builder). To save a structure, select two opposite corners with a golden hoe (left click for the pos1 and right click for the pos2). Then just tape /brp str sv cornucopia. This command is equivalent to this one (without aliases): /brp structure save cornucopia.

Then, travel around the world in order to find a good spawn. When it’s done, place yourself at the position you want to build the cornucopia, then type /brp mks (for make-spawn). If everything is ok, you should see your structure spawned on the ground.

Finally, when all your players are connected, you can type /brp start "seconds" to start the game. seconds is the time players will be freeze around the cornucopia. If everything is ok, the game should start (by the way, don’t forget to fill the chests in the cornucopia to make it more interesting :wink:).

How does the BATTLE step works?

When the countdown is over, the BATTLE step begins. When a player dies, the plugin will check if there’s still more than one fighter. If not, the game will stop and the server will shutdown. On the contrary, if there’s still more than one players, the plugin announce that a player died and how many players are still alive.

What’s next?

There are a lot of features I’d like to add to these plugin to make it complete… but before I would have some developers advice to improve the code quality and to do some code refactoring :slight_smile: For example, I’d like to improve the way I manipulate PlayerData… My code is hugely inspired from CopyPasta example but I think there’s a way to use the DataAPI (which is not fullydocumented…) that might be better…

Here are some features I’ve in mind:

  • A way to automatize game start (players wait in the lobby and when a number of player – specified in the config file – is reached it starts the countdown step – seconds specified in config file too. The spawn would be randomly set in the default world) ; THIS IS THE MOST IMPORTANT FEATURE I’D LIKE TO IMPLEMENT
  • A score system, based on kills ;

GitHub
Jar file

You might want to try Inferno, the Sponge implementation of Flint. I don’t know if it is up-tp-date but I recommend having a look at it. It handles game states, arenas, cooldowns and such for you.