I added two new assets: BedwarsTeam and BedwarsMap
The first one defines bedwars teams, letting you assign a colour and a name to each of them.
The second one stores neccesary metadata about bedwars maps, such as the amount of teams it can support. It is automatically created when you create a bedwars map with a command. Getting this to work took a lot of struggle and my time. For some reason trying to save the asset to a file was locking up the entire server.
After a lot of debugging, I realized hytalemodding.dev was wrong, and made me think my code is executing async, while it was executing on the world thread (which caused the problem). I sent a PR to them to correct that, and adjusted my code, which solved the problem. I in the end I heavily reworte the involved code. First I removed the use of CompletableFutures, because they annoyed me. Then I made it use Kotlin coroutines, after learning how to use them, which finally made the code more bearable. I also changed the error handling to use a custom exception to contain a formatted, translatable message.
While not very much productive for the features, this session did a bunch of good things for the code, which should accelerate things in the future.
PS: I made the /bw map list command work by using the new map asset
Log in to leave a comment
You can now exit the edited bedwars map, and then return it. This took longer then expected to implement due to some issues with world lifecycle management and teleportation. The code responsible for managing maps also got some better organization.
Log in to leave a comment
A friend said.
I agreed.
I hope he was right.
Kotlin is pretty weird in my opinion, like Java + Python, but it also had to do a bunch of things in its own way, without s clear reason why. But it has null safety without having to write @Nonnull everywhere, and dunks on java getters and setters which are pure boilerplate (and were starting to annoy me). That + a nudge from a friend is enough for me to go for it.
So yeah, I refactored the project into Kotlin and I hope it pays off in the long term.
Note that I deleted some unused files, so the added to removed ratio is off, I didn’t save whole 250 lines just by switching to Kotlin.
Log in to leave a comment
Or 10 of them?
I fixed the generators disappearing after server restart.
The culprit of it was NetworkId component, which assigns an unique integer id to every entity, and lets the server communicate to the client which entity it is talking about. The problem? They are manual! You need to assign a NetworkId when you spawn an entity (which I did), but you also need to assign one, once the server loads the entity from storage!
After I added an ECS system to do so, a bunch of generators, which were saved, just not visible, showed up.
Log in to leave a comment
The work on item generators continues, and I’m baffled to see that this devlog is representing 9 hours of coding - time passes quickly.
There is however a nice list of changes:
/bedwars spawn generator command, instead of using the entity tool, which is a side effect of moving generators to code.Log in to leave a comment
And it is flying away!
But it is working, dropping items as it should.
The reason it is flying away is that entities made with json need a movement type, and by default the “Fly” type keeps going forward it seems. I’ll find a fix for it.
On the recording items are also spawning in slightly incorrect location, which is already fixed.
The setup is done, so the development can finally take off, and the devlogs will be actually interesting and more frequent now.
We are starting with a /bedwars command fresh from the oven. The command will be used to manage bedwars maps, and to start a game without using the API.
I have not explored Hytale modding much yet, but I do love it already.
I just registered the commands structure, and look what I get for free - an entire help menu for my command that is automatically generated.
Log in to leave a comment
So, how long does it take to setup the dependencies and run something that released 2 days ago in a dev environment?
5min? 10min? 15min?
Yes, it is 15 minutes, unless you are also running your IDE inside flatpak, using the kotlin build scripts for the first time, and trying to follow two different templates at once, which happens to be me.
In that case it takes 2 hours.
And then, the next day I find myself deleting all the changes I made, because a gradle plugin got released in the meantime, which does the same job better.
The plugin had few little things missing, so I spent some time working on it, made a PR, and talked a little with the author.
Today I also made another PR, which instantly got closed, becaused I and the author coded the exact same feature in the exact same time. 😆
With all the changes made the gradle plugin has all the features it needs, and thus I present to you:
The smallest, cleanest build.gradle.kts file you have ever seen
Log in to leave a comment
As I am writing this, we are 2 hours apart from Hytale release. This means that the main work will soon be able to take off.
In the time from project start to now, I have made the BedwarsTracker tool (which is also available to try out on github btw.), wrote the code for an item generator, and most importantly spent much time experimenting with json, to get a good hang of what will work well as Hytale Assets for configuring the plugin.
For example teams will be data driven, meaning you can create as many (or few) as you want.
Log in to leave a comment
I’m creating an exact replica of the Hypixel Bedwars, which means I need to know how fast iron and gold spawns in generators.
I tried to count this by hand but it was very cumbersome and error prone. I also had to sit in the forge which meant so I couldn’t defend the bed. So I created a Minecraft mod, that will do this for me.
First I tried tracking items being added to the player’s hotbar, and it worked, but I still had to sit in the generator.
So with second attempt I started tracking item entity spawns, which didn’t rely on the player. After implementing that I could play as long as I didn’t go too far away from the forge, because then the items would not spawn client side. The server spawns them back after coming back close, which I also had to account for, to not have duplicated data.
The mod generates a CSV file with raw data, that needs to be analyzed. So I
wrote a python script which:
Seeing a chart lead to an interesting discovery:
Did you know that generators are at least 2x faster during the first 30 seconds of the game? I certainly didn’t.
In the end, this yields us the attached charts.
Note: As you can see the algorithm stops working very well after you upgrade the forge, because the data is a bit weird. I might spend some time later to fix that, but for now this is enough.
Log in to leave a comment