[DEV] Gameplay v0.12 - Plugin Bootstrapping Using Persistence [431]

Discussion in 'WIP and Development Status' started by NathanWolf, Feb 12, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    NathanWolf

    Gameplay is an API library that will encapsulate a few core gameplay-related systems. These will start with systems that I have written already (mostly from Spells, a little from Persistence) that I would like to keep in a common place so I can use them across various plugins.

    Contents
    Description
    Current Features
    Persistence
    Planned Features
    Downloads
    Getting Started
    TODO
    Tip Jar
    Changelog

    Description
    Since Gameplay is a separate library, you can easily link to and use it! Get started easily with the javadocs.

    Current Features

    An early version of the undo system from Spells

    BlockData : A persistable representation of a Block. This is also used to maintain previous block state when a BlockList is used as in an undo queue.

    BlockList : Encapsulates a list of BlockData objects. This list implements Container, but is backed by 3 objects:
    1. A simple ArrayList of Blocks. This is mostly for persistence, which isn't working fully for BlockList yet anyway. I'm hoping to get rid of this, it's an unneeded extra list.
    2. A HashSet of Blocks, for easy iteration and quick contains() checks
    3. A BoundingBox, which auto-grows on add() for quick early-out contains() checks
    This object will be persistable, but I have some Persistence kinks to work out with storing a contained object that has a list (or, ideally, storing any kind of Container directly and re-storing the proper type on load....)

    BlockData and BlockList both have an undo() function, which restores the block(s) that the data corresponds to to the state stored in the BlockData objects.

    I will also be adding a per-player undo queue management system to Gameplay to further support the use of BlockLists as undo lists, as well as scheduling BlockList undo for use in simple animations or temporary world modifications.

    A System for Recursing over Blocks

    BlockRecurse : An object that can be used to perform recursive actions over blocks.

    BlockRecurseAction : An interface, passed to BlockRecurse to perform actions on a block during a recursion operation.

    ReplaceMaterialAction : A simple implementation of BlockRecurseAction, will recurse over all blocks of the same material (type and data), and change them to the targeted material.

    BoundingBox : An all-purpose persistable BoundingBox, using two BlockVectors. Has some handy utility functions such as getFace, fill, and getBlocks.

    MaterialData : A persistable representation of a material- including type and data. Generates a hash id to maintain uniqueness.

    MaterialList : Currently just an implementation of HashSet<MaterialData> with some added functions (such as it stores MaterialData, but implements add() and contains() for Material as well). This is meant to be persistable, eventually.

    CSVParser : A simple CSV parser utility. Can parse out lists of strings, numbers, or a MaterialList.

    Persistence
    Gameplay requires and takes advantage of Persistence, which includes the following features:
    • Built-in multiworld support
    • Data persistence, of course
    • A command-dispatch system that encapsulates, and auto-generates help for, trees of commands and sub-commands. This system uses the built-in Bukkit command system, so you still put your base command(s) in your YML file to make Fill and Bukkit happy. Persistence abstracts the complexity of command handlers and senders away, so you just write callback functions like you're used to doing with listeners.
    • Persistence also supports data-driven CommandSenders. You can add a new classname to the "sender" table, and (provided there's a way to actually send from that sender), commands will get dispatched automatically to the appropriate callback, which can accept the correct, custom sender class directly as a parameter (in place of "Player" or "CommandSender")
    • A data-driven message system, featuring Java string formatting and multi-line. Soon to have auto-paging support. All Persistence-enabled plugins that take advantage of this system provide their admins with the ability to modify ALL in-game text.
    • A set of core data objects to reference if you want, such as PlayerData, WorldData, BlockVector (a built-in Bukkit object, made persistable by Persistence), and more.

    Planned Features
    • A universal targeting system for blocks and entities, using Bukkit's block iterator. Will allow extreme customization, including specifying what blocks/entities to look for, and what types of blocks are okay to target through.
    • An easy-to-use encapsulated Creature interface for spawning and checking types. This will take advantage of the built-in Bukkti API, and add whatever is missing (currently only an encapsulated way to deal with Creature types, and .... giants)
    • An undo queue manager using BlockLists that is persistable per-player.
    • A block animation system, allowing for complex series of events, or simple temporary world modifications- also using BlockLists.

    Feel free to post here with ideas and suggestions if a core gameplay system is something you'd be interested in!

    Downloads
    Required
    Gameplay.jar (source git link javadocs)
    Persistence.jar (thread source javadocs)

    Note that Gameplay.jar is a library, not a plugin. Persistence.jar is required at runtime, and will need to be distributed with your plugin- Gameplay.jar will be embedded in your plugin (if you set up Maven properly), you don't need to distribute it.

    Getting Started
    I'm putting up a tutorial, with sample plugin code that you can use as a bootstrap to get going with Persistence and Gameplay.

    See: Getting Started With Bukkit Plugin Development

    To get going with Bukkit plugin dev in general, I suggest the "Getting Started" section of the Bukkit wiki.

    Tip Jar
    If you really love my stuff, and you're feeling generous, I'd more than appreciate a donation. Go here if you're interested!

    Changelog

    v0.12 : Add BlockList, BlockRecurse, MaterialData, MaterialList, BlockData.
    v0.11 : Add BlockRequestListener- needs to be refactored to use a BlockList.
    v0.10 : First release, BoundingBox support
     
  2. Offline

    EvilSeph Retired Staff

  3. Offline

    NathanWolf

  4. Offline

    NathanWolf

    Released!

    I decided to make Gameplay a library- there's really no need for it to be a plugin.

    Using Maven, it's really easy to get going with this- check the OP, I'm going to have an in-depth tutorial and sample code available soon!
     
  5. Offline

    NathanWolf

    0.12 Released!

    Lots of really cool new features here.

    There's the beginning of an undo system, including a really useful BlockList that is backed by a HashSet and a BoundingBox.

    There's also a simple Block recursion system, which can make for some really cool effects (see: the new recurse spell in Spells)

    Otherwise, there are a bunch of new data objects to support this, such as MaterialData, MaterialList and BlockData.

    All of this is meant to be persistable- but BlockList and MaterialList are not, currently. Please also update to Persistence 0.51!
     
  6. Offline

    NathanWolf

    Ok, fair warning- I'm killing Gameplay.

    Persistence 0.75 will re-integrate all of this functionality, so when I release that I will kill this thread and the Gameplay library.

    Gameplay functionality now exists in the "Utilities" library, which is bundled in the Persistence plugin.

    If you're currently using Gameplay, the switchover should be easy- delete Gameplay.jar, update your pom and update your include classpaths as necessary (Eclipse can do this for you with Alt+Shift+O).

    This is hopefully going to be soon, so head's up!
     
Thread Status:
Not open for further replies.

Share This Page