Minecolonis & Getting really stable

in #utopian-io6 years ago

Hi everyone, unfortunately, I don't have much time to keep you updated with the newest things I am coding for minecolonies so the posts come in a bit later after I merged the changes already.
But, this also gives me the chance the bundle a bunch of pull requests into a bigger update report.

Fixes:

Builder GUI:

Builder GUI now scans the whole building to display the missing blocks compared to the required blocks.
Which mainly consisted of streamlining the responsible code by using the item handler of the building.

Entity Dumping

Our workers dumping behavior was not soo smart because it had to run several times through the dumping code before it dumped the whole inventory. This was very costly.

Now we remember the slot we're at in a field.

Also, remember the blocks we didn't dump.

Then, I reworked the dumping completely.
I moved the walking to the building for readability in the front.

Then, we get the stack in the slot (and not iterate through all slots until we reach a block we have to dump)
After that, I added some new code which makes sure that he always dumps some minimum amount (else he might get stuck in a loop dumping forever if he needs all blocks in his inventory)

Then we only return true after we ran through all the slots and are at the last slow.

In the end, we have to clear the list then and reset the counter.


Deliveryman fixes

The deliveryman had some other problems since he was only dumping into the main chest of the worker.
Again this was because he only dumped into the tileEntity and not into the item handler.

Changing this fixed this bug.

tileEntityColonyBuilding.getBuilding().getCapability(ITEM_HANDLER_CAPABILITY, null), stack, ((AbstractBuildingWorker) building)::isItemStackInRequest);

No crash just log

Then, I replaced one of the last places we crash and do not recover.

When a colony would be added twice we would crash the game even though we could tolerate this failure to make the user experience smoother.

This means, if a user will now add the same colony again we will return the old colony to him and log the incident.

Fix getting stuck when picking up

Additionally, I fixed that workers don't get stuck when trying to pick up an item in a spot in their building they can't physically reach. This means if the worker gets stuck we detect this and then pick the item up anyway even though we're not close enough.

Fix for missing cooks

Another issue was that our cooks would after a while not return to their building accordingly.

Therefore, I moved the move to the building code from the end to the beginning of the AI.

Guard Attack list fix

Also, guards weren't detecting which mobs they weren't supposed to attack. This was a quick fix by just filtering them out.

Shepherd overflow

Avoiding the overflow of shepherd inventories by using the right method to dump blocks into his inventory.

Fixing miner crash

Fixing a crash with the miner when he changes the level he works on.

Rack stackoverflow

Only marking the racks as dirty if they really changed:

Fixing the warehoue overflow into other inventories.

This was a tricky one to figure out. The inventories were not properly scanned in the warehouse which lead to the case that the deliverymen would bring overflowing items to other chests.
I fixed this by properly checking if there was space in a rack.

For that, I created a new method which does check the handler correctly if it can dump into it.

Previously it wouldn't consider the stackability of the items correctly.

Job rework:

Who follows my blog knows that I am a passionate refactorer.
These days I wanted to add some code which stores the current state of the worker to the job.
When I opened the abstract job class I couldn't stop right there.

The abstract job class had a reference to all its child's.

This is something which I really couldn't leave there.

Therefore, I created the job registry class.

This class would then get all the registry code of the abstract job class which would, in turn, make the abstract job class way more readable.

Then, I was able to add the new feature to the job.

While also persisting it.


The idea of this was, to make sure that the action tracker is persisted over sessions so that workers actually dump after the right amount of actions and not only after a number of consecutive actions.

Then, I only had to make sure to adapt the job registry calls and get an increment action calls to fit the new location.

Fixing some weird bugs

Lately we had a report which reported a crash with our mod. When I checked into the log files it had appeared as there was a wrong tileEntity where the minecolonies block was. While this was probably not caused by us, I still implemented a workaround to make sure we can recover from this without crashing.

Doing this by resetting the tileEntity.

And by only iterating over the other tile entities if we have the world.

Model Update:

We updated a bunch of our models as well so we don't have to reuse old models. The models were created by one of our modelers a long time ago, but the work of correctly integrating was missing (since the model program exports it wrong)

Additionally, I got the block models of one of our graphics guys and added them into the mod as well (we might see an utopian post from them soon as well).

I had to adapt a few of the generated model files to make sure the things render ingame accordingly.

Pull Requests:

https://github.com/ldtteam/minecolonies/pull/2973
https://github.com/ldtteam/minecolonies/pull/2981
https://github.com/ldtteam/minecolonies/pull/2978
https://github.com/ldtteam/minecolonies/pull/2984
https://github.com/ldtteam/minecolonies/pull/2989

Repository:

https://github.com/ldtteam/minecolonies

Sort:  
  • Stability is underrated! Good job getting to stability in, with refactoring.
  • Looks like you may have run out of things to say? ;-)
  • Great post and story telling, good images.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Oh, sometimes I make a pr and add a few more things and forget to try to add it to the description.
About the newest versions we're almost not getting any complaints at all anymore.
It's time for new features!

Thank you for your review, @helo! Keep up the good work!

Hello! Your post has been resteemed and upvoted by @ilovecoding because we love coding! Keep up good work! Consider upvoting this comment to support the @ilovecoding and increase your future rewards! ^_^ Steem On!

Reply !stop to disable the comment. Thanks!

Hi, @raycoms!

You just got a 17.98% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.

Hi @raycoms!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Just stumbled upon this and I gotta say you caught my interest. Is there a post about the idea of Minecolonies? Is it a server? I want to know more!

It's a modification for Minecraft, for more information you can check out our website: https://www.minecolonies.com/

Thank you! Will do!

Hey, @raycoms!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Loading...

Excuse, I am new here. Can anyone tell me what is utopian-io?

Coin Marketplace

STEEM 0.18
TRX 0.15
JST 0.028
BTC 63064.93
ETH 2468.39
USDT 1.00
SBD 2.55