Jump to content
Live Updates

We are currently updating our website to the latest IPB version - please be patient whilst we update the A'therys theme to work with this.  Some areas of our website may look distorted, please don't panic, this will be rectified.


The Boring Dev Log

Recommended Posts

Alright, so this is something that will not appeal to most people. In fact, I would say hardly anyone would get much out of reading this. Unless you're interested in the nitty gritty technical details of programming and plugin development, you can skip this one.




The entire point of the boring dev logs is to give you an insight into how we're going about developing A'therys plugins.


Since we've decided to go modded, we have to run a Forge Server. However, this brings with it some unfortunate implications, including having to use Forge to create... well, anything, really. I, for one, do not want to be making mods when the functionality is best described as a server-side plugin, thus I don't see the point in using Forge for any of our gameplay mechanics.


Luckily, we have Sponge ( Found at https://www.spongepowered.org/ ). It offers a higher-level abstraction atop Forge which makes it so much easier to work with. Of course, this comes with limitations, but so far I will say that I have not felt limited by Sponge in 99% of cases, and it's only in some corner cases where Sponge has proven to be lacking. But even then, I've managed to find workarounds which have worked just fine.


Great, so we have our starting point then, right? Well, not quite. Sponge offers a beautiful abstraction, but for our needs we need more than just a plugin framework. The elephant in the room is Persistence, with Sponge not offering any high-level solution for this. But there are other, smaller things which could improve the speed with which we develop our plugins. Thus, something I've nicknamed the "A'therys Framework" is born out of these needs.


This first Boring Dev Log is going to cover what the A'therys Framework is, and why it's necessary.




In actuality, the A'therys Framework is represented by a single plugin: AtherysCore ( Found here: https://github.com/Atherys-Horizons/AtherysCore ). Core provides all the tools and utilities we need to make A'therys plugins better, faster and stronger. And that's all it does. It has no functionality in it. For all intents and purposes, it is nothing more than a library built atop Sponge.


Annotation-Based Command API


In Sponge, the way you'd traditionally go about creating a command is described here ( https://docs.spongepowered.org/stable/en/plugin/commands/index.html ), and it's a process that often times requires several classes ( not just the one it's described in ), plus more code relating to the command that's placed in the plugin main class. Overall, it creates a very disjointed feeling to command creation, with code being split up in several places. This makes it not only harder to read, but also harder to maintain.


The Annotation-Based Command API is described here ( https://github.com/Atherys-Horizons/AtherysCore/wiki/The-Command-API ) and it's quite a simple abstraction atop Sponge's commands, yet it makes it so much easier to work with.


Gson Utilities


Gson is a library that Minecraft ( and therefore Bukkit/Spigot and Sponge also ) uses to parse json into meaningful objects that it can use. Specifically, any time you describe something in JSON that has to be read by the game ( see: data packs in the latest updates ), Gson will be used. It's a great library written by Google and it works well for 90% of cases. The problem is the other 10%.


More specifically, Gson has issues with polymorphic structures and inheritance. If you have a ClassA interface/abstract class, which is inherited by ClassB and ClassC, you have to describe that relationship explicitly to Gson otherwise it's not going to be happy. It will try to instantiate abstract classes during deserialization, which obviously results in errors. The fix for this, as provided by Gson, is a class lovingly named the RuntimeTypeAdapterFactory. I shorten this to RTAF.


In the RTAF, you provide the abstract class, and link it to several possible implementations. Gson will then embed the implementation type into the serialized data, so it knows for the future which implementation to use for the json it's deserializing. Overall, this is a swell strategy, but it results in some boilerplate which is not very pleasant to look at.


The result therefore is the TypeAdapterFactoryRegistry class ( https://github.com/Atherys-Horizons/AtherysCore/wiki/TypeAdapterFactoryRegistry ), which will store multiple RTAFs and create Gson instances using them. The result is much more organized code, and less boilerplate.


Interaction/Attachment Service


This is something @Rynelf wrote to solve yet another issue with commands. Sometimes, a command needs to be more interactive. For example, you might need to write a command, and hit a block or an entity in order to achieve something.


The details of it are pretty straightforward and you can read the code here ( https://github.com/Atherys-Horizons/AtherysCore/tree/hibernate/src/main/java/com/atherys/core/interaction ), so I won't go into too much detail.




Plugin configuration in Spigot was a pain in my opinion. And in Sponge, despite best efforts, it's still not the easiest thing in the world to set up a configuration file. That's why the PluginConfig class exists. It offers an abstraction atop Sponge's Configurate library, which is really nothing but the boilerplate required to setup an ObjectMapper and a ConfigurationLoader.


Question API


Another simple addition is the Question API which allows one to easily create text-based question-and-answer forms. Underneath it uses Sponge's Text API to create a question under the form of "Question? [Answer1] [Answer2] ... [AnswerN]". The player can then click on any of the answer buttons to execute some code.


Sound Utilities


Makes it easier to create and send sounds to a player.


Alright, and now we come to the big daddy of them all...


Persistence( JPA/Hibernate )


Persistence means storage, essentially. For example, you create a town, and you want that town to still be there after the server restarts. Might seem simple enough from a user perspective, but it falls under the massive field of persistence. And for this, we've gone several different directions in the past, gone through multiple iterations of each, until we've finally arrived to where we are today: JPA and Hibernate.


Originally, the Core plugin didn't offer any persistence abstractions. Each plugin was responsible for handling it's own, which proved to be inefficient at best. The first abstraction was based off of the NoSQL database MongoDB, which has been proven to be robust and high-performance. Over the course of 5-6 months, in became clear that the simple abstraction atop Mongo simply wasn't enough, and we'd need something better: an ORM.


An ORM stands for an Object-Relational Mapper, and what it does is translate memory data structures into database data, without the programmer having to do much for it. And in the beginning, we used Morphia, which is an ORM for MongoDB. We ran with this for a good 3-4 months, until it became clear that MongoDB in and of itself was simply not a good solution to our needs.


With that revelation, I decided to finally just go for the big one: Hibernate and JPA ( short of Java Persistence API ). It will take any Java object, and store it into an SQL database almost as if by magic, with minimal effort on the programmer's part. The only thing that I did was write a simple 80-line abstraction atop JPA which gives access to basic JPA functionality, such as CRUD operations, criteria and other such ( including JPQL queries ). What I intentionally missed out on were native queries which, while fast, lock the implementation of the database to a single driver ( such as Postgre or MySQL ).


And speaking of drivers, the default database I've chosen to go for is PostgreSQL. It's much faster than MySQL, though still an SQL database, and even offers additional potentially useful features such as JSON support, partitioning, and others.




To conclude this long boring dev log, I would like to say that you can still find all of the source code for our plugins at https://github.com/Atherys-Horizons. And specifically the AtherysCore plugin at https://github.com/Atherys-Horizons/AtherysCore. I don't know if I'm going to make a second one of these. It depends a lot on the time I might have or would want to spend on writing long threads like these, as opposed to writing code. So, we'll see. Take care for now!

  • Like 4
  • Thanks 2
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Our picks

    • A'therys Evo Returns (Plugins and Player Data Included!)
      Hello everyone, new and old! 

      As you may or may not have heard, we have brought back a functional build of A'therys Evo onto the server. We've noticed that a lot of people have been wanting a taste of the A'therys experience and having a place in-game to relive some of your favourite memories will go a long way towards achieving that. 
        • Haha
        • Like
      • 11 replies
    • December 24, 2018

      So with the website returning to it's dark theme, we've made a bunch of improvements to the lorelanding!

      Added a MAP to the lorelanding!

      This map (see below for all 5 playable nations lit up) will light up a nation when you hover over it; and allow you to click into it to go to the nation's overview page!


      Original Map Artistic Render by @cicetil

      Overlay graphics and new HoriRule [the nifty divider in the lore sections] by @Xathas

      Coding by @Rynelf (HTML, CSS, and JavaScript!)
        • Like
    • December 22, 2018

      Small Governmental Update put in today!

      Added Government of the Gennaian Isles

      Governmental Concepts originally by @Xathas

      Very long-winded Isles Chat with @Foe, @Tristan_vr, @raxiam, @Dani, and @redninja685 . Fortunately there were no casualties. 🤯

      Compiled by Xathas; Edits and Revisions by @Foe
        • Thanks
        • Like
    • Wiki Entry Wednesday - January 10, 2018
      It's that time of week again!

      Today we explore the city risen from seafoam, Glasscastle.

      Added the cty of Glasscastle to Atvoria

      Original draft by @Xathas

      Critiques and edits by @RuddyF , @Rynelf , and @Kmartinator
        • Thanks
      • 0 replies
    • Wiki Entry Wednesday: January 3, 2018
      Happy New Year, and Wiki-Entry Wednesday!

      This week marks a return to new nation info, specifically: Dalkun-Tir

      Added Technology of Dalkun-Tir to the Wiki

      Original draft by @Dani

      Second draft by @Xathas

      Critiques and edits by @Dani , @Foe , and @Kmartinator


      Added Marao's Fall to the Wiki

      Original draft by @Xathas

      Critiques and edits by @RuddyF , @Foe , and @Kmartinator
      • 0 replies

About Us

A’therys Horizons is an upcoming Minecraft Modded RPG Server, a world truly unique with many experiences for Roleplayers, Pvpers, Builders & Merchants alike.

Our community will always be what makes A'therys.

Important Information

By using this site, you agree to our Terms of Use, Guidelines and Privacy Policy