1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

What should a Minigame API look like

Discussion in 'Development' started by Legoboy0215, Nov 17, 2016.

  1. Legoboy0215

    Legoboy0215 Witch

    Messages:
    64
    GitHub:
    legoboy0215
    What should it look like? Currently, I'm making everything as abstract as possible, but I want to add commonly used code like arena management, player management, stats etc. Should I do that? If yes, how would I actually apply it?
     
  2. BalAnce

    BalAnce Silverfish

    Messages:
    22
    GitHub:
    YaBoiBalAnce
    Create a core set of classes that have commonly used Minigames functions and then extend it in your actual Minigame class (Example i see is like a Arena.php)?
     
  3. Legoboy0215

    Legoboy0215 Witch

    Messages:
    64
    GitHub:
    legoboy0215
    What if the class uses another base class? For example, BaseArena.php includes a line of code (new BaseArenaHandler) what would I do? In an actual plugin I would need to use a new class called ArenaHandler that extends BaseArenaHandler.
     
  4. BalAnce

    BalAnce Silverfish

    Messages:
    22
    GitHub:
    YaBoiBalAnce
    unless you override the function that initiates the BaseArenaHandler i dont see why it wouldnt still intiate
     
  5. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    I think something like DynamicHub is good. (Look at the part about matches)
    Make an override-able function that returns the class name of the implementation class?
     
  6. imYannic

    imYannic Baby Zombie

    Messages:
    113
    In my opinion those plugins with ArenaManager.php are not overviewable enough - for me, the developer will probably don't have problems with them.
    I personally used arrays, where I saved all the games and their important keys like status and more. But I switched to objects, because they are better in every fact. My minigames have 3 classes at least, Main.php - where I manage all events and games and call things in the Game.php script file. As I said Game.php - Where I manage the game itself, it contains the API of the game. And the third one, Task.php - the universal task.
    Players are getting managed in the game file itself, things like kills, deaths, killing spree are saved in a player array and managed in the game. I like with my minigame API.
     
    HimbeersaftLP likes this.
  7. Legoboy0215

    Legoboy0215 Witch

    Messages:
    64
    GitHub:
    legoboy0215
    I like classes. I create a class for everything, TBH.

    ArenaManager, ArenaTimer, Arena, TimerTask etc.
     
    HimbeersaftLP likes this.
  8. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Please clarify that you mean associative arrays, not real one-dimensional fixed-size arrays as commonly understood in software engineering.
     
  9. imYannic

    imYannic Baby Zombie

    Messages:
    113
    Oh okay
     
  10. Jack Noordhuis

    Jack Noordhuis Zombie Pigman Poggit Reviewer

    Messages:
    618
    GitHub:
    JackNoordhuis
    There's no certain set of classes that you should stick to for any purpose, it's all personal preference. I recommend to just start writing your game plugins and you'll soon find the classes and functions you need/want in a core.
     
    SOFe likes this.
  11. Kenner

    Kenner Spider Jockey

    Messages:
    25
    GitHub:
    Enzoomet
    EXACTLY!
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.