Stuck in rewrite hell
Added 2021-07-28 06:57:23 +0000 UTCHello everyone,
I wanted to leave a sort of blogpost letting people know that I am still actively working on EliteMobs (usually over 12 hours a day) but am currently stuck doing a lot of rewrites.
I wanted to keep to the 1–2-week public release schedule, but it is pretty evident at this stage that this rewrite will require a decent amount of testing before it is ready for full release.
This has also moved the release schedule of EliteStructures a bit, which is unfortunate but necessary.
The short version of why this rewrite is necessary is because 1.17 changed the way that entities spawn in worlds in a subtle yet EliteMobs-breaking way. This is part of the issue that people experienced with NPCs, and it is the reason why sometimes regional bosses seem to become insanely tanky / several bosses appear when only one should be present.
I am working ~16 hours a day on this issue to make sure that we can get past this as quickly as possible and get back to working on adding new content. However, I am currently rewriting:
- The NPC system
- The Elite Entity system
- The Custom Boss system
- The Regional Boss system
- The Phase boss system
- The persistent entity system
- The configuration system for Custom Bosses
- The new main configuration engine for EliteMobs
- ... and I am still working on the new Custom Events system
(This is not the full list, there's a lot more but you'll see that when the devlog is finalized)
I was hoping that this update would just be about Custom Events, but due to the issues diagnosed with 1.17 I was forced to either patch the issue with yet another ugly fix, or finally change the system to a better, more scalable implementation.
For those uninterested in hearing about the more technical side of EliteMobs, you can hop off now. Just know that I hope to start with tester builds for this version late this weekend of early next week, depending on how well the new structure works the first time I plug it in.
This month happens to have been the most successful month for EliteMobs in daily downloads and financial backing, so I feel like I owe you guys a more in-depth explanation about how things are going behind the scenes.
First, let's start off with some history. EliteMobs was never meant to be a Custom Bosses plugin. As a matter of fact, custom bosses were only added in EliteMobs 7.1 in late 2019, built on top of the existing Elite Mobs structure.
It's also worth mentioning here that I have no formal education in programming. I am entirely self-taught in the area, and 95% of what I know I learned by implementing it in EliteMobs.
As you might imagine, the original implementation of Custom Bosses was... rough. It worked, and it worked consistently, and it fulfilled its initial goals just fine.
However, as time passed, it became clear that it was necessary to have Regional Bosses, as a dungeon system would only be possible with a robust spawning and respawning system.
This was then built on top of the already precarious Custom Bosses system, itself built on top of Elite Mobs rather precariously.
Then, later, phase bosses became a fairly highly requested feature, and one I was very interested in making.
As you might imagine, this system was implemented on top of the rest, however it managed to fit, which was rather poorly.
All in all, until the end of 1.16.5, these systems worked in tandem just fine. They did not use too many resources, and it worked without causing any issues, at least for 99.99% of cases.
However, as the list of features and requirements kept growing, it became harder and harder to add new features to the very shaky foundations of this system.
To get technical for a minute here, Elite Entities were built from the ground up around the concept that they had a living entity, and that this living entity was alive and valid for the entirety of the time that the Elite Entity existed, and if it stopped existing then so did the Elite Entity.
This was fine back when Elite Entities were the only kind of mob in the plugin, as they could never survive things such as chunk unload / reloads.
Later, with the advent of Custom Bosses, it became necessary for elites to survive unloads, and that was a big issue. A system was built to keep a special entity registered in the system, waiting for the chunk to load again to create a new elite entity again.
Then later yet, with regional bosses, it became necessary for elites to not necessarily be alive for the entire duration of their runtime, which the system was built essentially against. This meant that the regional boss system had to be built outside of the EliteEntity system, which was less efficient and a massive headache to implement and maintain.
Later still, phase bosses were added. This is where things got kicked into overdrive. Suddenly Elites had to be swapped around, data had to be transferred, some messages went from always being shown to only sometimes, some fields suddenly had to be ignored... all of this outside of the Elite Entity system, because it could not be tied in any way with the way it existed.
I had planned to rewrite this system from the ground up in the eventual future, always dreading it, as it represents a rewrite not only of these systems, but also of all the systems around them.
1.17 forced me to move my plans up, which is probably a good thing. The Elite Entities system even now is built from the ground up to be far more isolated from Minecraft, which all big plugins tend to move towards.
Adding layers of isolation from Minecraft is a great thing. It makes the plugin easier to update for specific versions, it makes it easier to maintain, but most of all, it makes it easier to add features to.
This means that the new implementation of Elite Entities, Custom Bosses, Phase Bosses and Regional Bosses will be less prone to bugs, easier to fix and most importantly here, extremely flexible. They are built with the concept of "whatever, whenever" in mind - meaning that an Elite Entity can become anything at any time by hopefully simply running a single method.
It is important to note that thorough testing and bugfixing will be required to bring it up to the standard I am mentioning here.
Another important thing to mention here is performance. The new format will make server startup/reloads and dungeon installs for servers using large amounts of EliteMobs worlds significantly faster, as EliteMobs will no longer attempt to load the chunks the bosses are on on startup and will instead only queue spawns for when the chunks load. The new format will also use significantly less memory per elite, though that should only really matter once we start getting into the hundreds of thousands of regional bosses loaded.
As per usual, I will investigate improving the performance of other aspects of the bosses, and several tweaks have already been employed that should help, however the biggest improvement will be the reliability of the system.
In general terms, EliteMobs is pretty good performance-wise in its current form, so it is unlikely you will notice much of a difference, but these changes should make it easier to transition from a model that can easily handle thousands of entities to a system that can easily handle tens and perhaps hundreds of thousands of entities.
Another thing I've mentioned several times but not really spent enough time explaining is the new configuration system. This system will not require you to modify any of your configurations, as the changes are purely internal, though I might take the opportunity to tweak a few of the default/recommended settings.
This sounds like a boring thing to keep mentioning, but it is incredibly important because it is actually a centralized system for loading every configuration setting. The reason why this matter is feature parity between config folders.
Feature parity means that you can expect features to work identically throughout the configuration files. Though you may not have realized it, different configuration files in EliteMobs can tend to work slightly differently, because each configuration file up to now had its own system to interpret the data.
Now that the system is centralized, the idea is to make it so if a configuration reading possibility is added in one place, it is added everywhere.
The best example of this is that I recently added the ability to add colored leather to Custom Bosses. You will be able to use the same format to set colored leather for GUI items. The same entry that would set a player head in a GUI will also be able to set the player head for a Custom Boss. (do note that these features will be rolled out throughout future updates, not every configuration file has been moved to this format yet)
In general, this makes it much easier to add configuration settings, as it only needs to be implemented once and the system already comes with built-in error handling and a robust set of helper methods.
I also hope that by making it easier to point exactly to where configuration files are erroring and why, it will make it significantly easier for people to venture into creating their own content for EliteMobs, as currently creating custom content can at times cause the entire system to stop working, which is not ideal.
Once the new configuration system is set up, no matter what you throw into the configuration files, at worse the entry will simply not show up in-game and an explicit warning about the file and the line erroring will be shown on console during startup.
This is already a very long post, so I will cut if off here. I hope that by this time next week we will be enjoying the new Custom Events system and using the new and improved Elite Entity system.
Until then, thank you again for all the support. I mentioned this before, and the patreon page doesn't really reflect it, but this has been the best month for EliteMobs.
This is very reassuring for me, as I have now finished my studies and EliteMobs represents a big part of my current income. I have tried to bring the plugin to the next level, and I think it is heading down the right path.
I was going to release another premium Lair this month, but I will hold off until all the new systems stabilize. This means that just like there were two Lair releases this month, next month might have a Lair release (Viking Ruins) and a Minidungeon release (Vampire Manor), on top of the planned Custom Event Premium releases! What time to be alive.
Alright, that's all for now, happy adventuring!
- MagmaGuy!