API

Feb 13, 2019 at 2:34 PM
API
  • ArcadeBoard API

    NOTE: This version of the API is still under construction ,so is its documentation



    Introduction(top)

    The ArcadeBoard API works similar to any other game API out there. If you ever created games you will most likely recognize design patterns you can find in this API.

    Games are individual JAR files placed in the 'games' folder of the plugin. The server version of the plugin will load these games on startup.

    Of course the graphics are very limited, however the API provides a vast majority of tools that can help you extend these graphics with resource packs. The main types of games this API is created for are 'Tile based games'. If you are not familiar with this concept I suggest reading it here: https://en.wikipedia.org/wiki/Tile-based_video_game

    In short: the games you create are drawn on a low resolution raster. However the things you draw on each pixel on that raster can be high detail by the use of resource packs. The use of resource packs is very well integrated in the API and explained later.

    Github: https://github.com/Maximvdw/ArcadeBoard-API

    Understanding the main concept(top)

    There are three main concepts you have to understand of the API.

    GamePlayer(top)

    A player that is added to a game is called a 'GamePlayer'. This is basically a player that is playing the game. With multiplayer games you can have multiple players.

    Canvas(top)

    The canvas is the area you draw on. Each player can have his own canvas, however it is possible to set a global canvas so each player sees the same thing.

    Every frame you can choose to draw on the canvas. The canvas is not reset on every update, you have to reset (parts) of it, or do not update it at all (if no change happens).


    Game(top)

    The game is the class you extend when creating a new game. The game has a game loop that is fired every frame. Default the frame rate is set to 20, however you can increase this up to 30FPS.

    In the game loop you do everything you want that results in a canvas to be altered. You can move an object across the canvas or do whatever you want. As a developer you have to calculate when changes have to happen. If you only want a change to happen every second, but you have an FPS of 25 you only need to trigger this every 25 frames.

    Understanding the technical aspects(top)

    There are some technical aspects you have to keep in mind when creating a game.

    Frame delay(top)

    On Minecraft versions lower than 1.13 there is a frame delay of three frames. Meaning that when you change something, it will not be shown for 3 frames. Usually this is not a big problem, seeing for an 25 FPS game this is only 120ms - however it is something to keep in mind when using inputs.

    Screen dimensions(top)

    The screen dimensions depend on a few things. You can have a max amount of lines of 15 + 1 title. The width however is variable:

    • For a 1.8-1.12 server the width is about 72 when each pixel has a different color
      • However the width can increase when not all pixels have a different color when using monochrome games or resource pack intensive games.
    • For a 1.13 server the width is unlimited

    Music and Sound(top)

    The API provides the ability to play music and sound. Sound is similar as in Spigot/Bukkit where you just select a sound and define its volume and pitch. You can also specifiy your own ogg sound files that will be included in the resource pack.

    The music is different, it allows you to play NBS files (Note Block Sounds) you generated from midi files.

    Resource packs(top)


    The API provides the ability to import PNG files that are automatically generated in a resource pack and sent to the player when they want to play your game. That way you can create sprites and tiles.

    You can also include custom fonts, custom sounds and music to use in your game.

    Understanding the scaleability of the API(top)

    The API is very scalable. It includes classes and tools for drawing on the screen, .. creating music, ... but the possibilities are way greater than that. The API also provides some basic 2D game dynamics to calculate vectors, drawing specific objects or sprites - but you can also use your own game engine.
  • Loading...
  • Loading...