Minecolonies & The little things in life #3

in #utopian-io7 years ago (edited)

Hey everyone, like I mentioned previously, we're currently working on some small fixes and quality of live improvements in order to get improve our stability.

Therefore, I fixed a total of 6 open GitHub issues and some additional ones which have only been reported on our discord.

Namely issues 2084 to 2087 and issues 2065 and 2091.
I usually go issue over each issue, but since a few of those issues are related and I fixed a bunch of stuff besides that I will do it differently today.


Minecolonies does not only have friendly villagers, to make things more exciting depending on your colony strength a bunch of barbarians visit your colony each every configurable night.

This works great in singleplayer, but on the server, those barbarians never seemed to spawn where they should, and, instead even went to the wrong colonies.

This was a pain since, if you have a colony with 100 citizens it might come visit a colony with only 4, which would result in a lot of tears (depending on the player's age and proximity to the water).

Therefore, we spend 2 whole days logging all over our code to check where they were spawning.

We ended up even writing an event handler just to find out where they were spawning.
Just to find out they were spawning in exact the place they were supposed to.
But when we went there, they almost never showed up.

After a while of debugging on our debug server, I asked myself, what if something during their construction might mess with their position just after they spawn.

So I took a peek in their class and found this in their constructor:

Which sets the colony which they're supposed to haunt.
But, at the time of the construction of the colony, they didn't spawn yet, and therefore, their position was at 0/0/0 in the world. Which basically set the wrong target.

On top of that, the pathfinder noticed that the target was too far away and teleported them over.

What a mess!

Basically what we did was getting the colony only on demand after the entity has been spawned.

After we fixed that we noticed they weren't moving and I wondered what would be wrong now...
Some more hours went by when I noticed this jewel:

In Minecraft 1.11 the correct method name was "continueExecuting" and since it didn't have the "@Override" over it, as it was supposed to.

That's why code style is important like I said here

As you can imagine, a lot of headache for an easy fix, which could've been avoided by following the code quality rules.


Then we had a few issues with our colonist crafting system (Post of that coming soon).

We noticed we had to double check if the colonists can actually craft because players might rob their stuff.

We noticed we have to write id incrementers consistently:

All messages do ++id, so a following id++ will register two with the same id.

Blocking adding recipes when the hut can't learn more.

Checking for contains with the wrong types.

A bunch of formatting and style issues.


Besides that, Minecolonies has a "Build-Tool" which allows players to tell the Builder of the colony to build certain things.

Currently, if the player wants to place ten roads he has to open the tool, select the road and close it again, while this works, it's highly uncomfortable.

For this, I changed that we detect if the player clicks "shift-done" and will leave the window with the right schematic open.

Very easy fix, besides that I only had to turn on that the game will stay running during the window so that the construction markers get placed correctly.

Which works, due to our custom mod windows quite smoothly as well.


Additionally, one of our players and contributors reported that a few of our workers were creating lag. When I checked their code I noticed that we were
calculating the bounding box of his hut quite often.
Therefore, I decided to cache this.

First I added a field in the class which contains this.

And then I added a check, each time it needs the area to look if we have calculated it already, if not it will calculate and store it if so it will just return it.

Trading memory for CPU.

And last but not least, our players were reporting that the color of all our text in all GUIs was black.

I double checked and found this gem:

While debugging some things one of our devs turned it to 0 and all of us failed at finding this in the code review.

I hope you liked this short debug session.
I'm currently thinking about making a video of the next quality of code sessions, what do you think? Comment below and see you the next time.



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Minecolonies! We are so glad you have joined steemit -- looks like you've been here a long time! I used to play with your mods a long time ago!

Now, I am a developer of a new Cryptocurrency that is a hybrid Masternode / PoS / PoW coin, and we are very very interested in paying a good sum of cryptocurrency, perhaps steem or bitcoin or even Ignition, for a mod for Forge or plugin for Sponge/Bukkit that integrates our coin! If interested please respond here, or email @ [email protected]! Thanks.

Could be interesting, you can also talk to us on discord here: https://discord.gg/RmqtQCk
mention @raycoms and @reggaemuffin and we setup a group chat

About what kind of integration have you thought?

Simple integration. Commands such as /deposit -- returns address, /send -address- -amt-, so it can be used like a CLI wallet -- at least for a start ;) Could go as far as some kind of built-in marketplace to trade in-game goods for coins :P and if you build it right, you could market it to all cryptos as they mostly (maybe not steemit) use the same type of json RPC interface

Let's have a talk on discord as @reggaemuffin mentioned, will be easier to sort things out and to share ideas.

Hey @raycoms I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • You are generating more rewards than average for this category. Super!;)
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

I happen to stumble on this post... Coding is hard, you debug something and another problem arises, and then you debug that one and 2 or 3 more turn up, being a coder is hard, and you guys did A GREAT JOB
Keep up with this debug sessions, even though i don't understand very much about coding, but i will surely come back

please do something for newbies!

I loved tnt in MC...tnt cannon the bes

What is this game made of you? You can do better. I'm new to this topic. I'll help you brother. I did not say anything else

muy interesante . ademas de tener mucha utlidad

very information and helpful

thats good .. helpfull