Minecolonies & Quality of Gaming

in #utopian-io5 years ago

Hi everyone, as I'd mentioned in the last post, Minecolonies is finally getting really stable which means it will be sure time for some nice new features. But, before that, I wanted to fix some general unpleasant things to improve the balance and the experience for the player.

I will separate this post into fixes, balance updates, and updates for the quality of playing.

The fixes:

One of the long-awaited fixes was that our random teleport commands don't teleport players outside of the world border.

Which would result in an instant death.

Another bug was that players were able to hire infinite workers at a building by abusing a GUI glitch.

That was fixed by updating the GUI after every action.

Another fix was that the builder requested more banners than he needed when building which we fixed by adding another placement handler for that and adding it to the list of placement handlers.

Another nice bug I found by chance when I was analyzing the number of inventories our buildings return and I found out that the value was much more than what I was expecting.
I figured out that our racks were returning a new inventory every time we'd ask them which would confuse the handler which sorts out duplicated item handlers.
This is extremely important for a future update which is why I fixed this already.

This also probably had quite an impact on the performance of inventory checks.

I fixed this by creating this combined item handler only once.

and then create it when it is required or get it from the neighboring rack.

A small bug one player noticed was a crash since a job of a guard was null.

I fixed this by guaranteeing we created a job before querying it always.

A small glitch I fixed was the problem that people would sometimes, when teleporting, get dropped off too low and would glitch into blocks.

By always returning the block above the solid block I improved this a bit.

Then, I finally tracked down why the deliveryman would sometimes fail to dump. It was because when checking if he can stack items in the warehouse he would check for the general max size and not the max size of the particular item.

Some items can't be stacked until 64

Game balance:

One of the game quality improvements was adding a method to make it building defined if the worker will work during the rain (and not hardcoded anymore).

Until now this was only activated for guards, but we now added the ability for cooks and students as well, so they can serve hungry citizens or study while it rains as well (since they work indoors anyway).

Game quality:

In terms of quality of gaming, we made workers decide by chance if they want to go to bed or stop working when it's raining (get out of bed and start working after rain as well).

This makes the colonists a bit less robot-like, balances the performance costs of having to path to their buildings all at the same time and gets them less stuck with each other on the way.

We did this by introducing random delays in the calc of this.

The whole code for this is not so easy to understand which is why I will focus on the most important bit.

Which will make sure that they only check for the condition once every minute (by chance).

This also decreases the cost in terms of server performance which is a nice extra.

Another game quality update was finally re-adding the rendering of the colony border.

Around a year ago when we updated our rendering to improve the performance we had to remove this feature.

I updated it by scanning in a nice schematic, calculating the colony border and then sending this to the rendering methods I created in the past updates (for example to render waypoints).

private void calculateColonyBorder(final WorldClient world, final ColonyView view)
    {
        final Chunk chunk = world.getChunk(view.getCenter());
        final BlockPos center = new BlockPos(chunk.x * BLOCKS_PER_CHUNK + BLOCKS_PER_CHUNK / 2, view.getCenter().getY(), chunk.z * BLOCKS_PER_CHUNK + BLOCKS_PER_CHUNK / 2);
         final int range = (Configurations.gameplay.workingRangeTownHallChunks * BLOCKS_PER_CHUNK) + (BLOCKS_PER_CHUNK / 2);
        for (int i = 0; i < (Configurations.gameplay.workingRangeTownHallChunks * 2 + 1) * BLOCKS_PER_CHUNK;i++)
        {
            if (i % BORDER_BLOCK_INTERVAL == 0)
            {
                colonyBorder.add(BlockPosUtil.findLand(new BlockPos(center.getX() - range + i, center.getY(), center.getZ() + range - 1), world).up());
                colonyBorder.add(BlockPosUtil.findLand(new BlockPos(center.getX() - range + i, center.getY(), center.getZ() - range), world).up());
                colonyBorder.add(BlockPosUtil.findLand(new BlockPos(center.getX() + range - 1, center.getY(), center.getZ() - range + i), world).up());
                colonyBorder.add(BlockPosUtil.findLand(new BlockPos(center.getX() - range, center.getY(), center.getZ() - range + i), world).up());
            }
        }
    }

To check for the colony border I iterated through the total width of the colony which is the number of blocks per chunk times the number of chunks + half a chunk.

Then I'd add the position in an offset to avoid rendering too often (might look goofy) and then we added it for all 4 directions to get all 4 border lines rendered.

Then I'd hand that to the method which is responsible for the rendering alongside with the schematic to be rendered.

Another nice thing we added is that the colony now notifies the player if colonists can't spawn because of the lack of space.

<Mysterious Voice> Colonists can't arrive at your colony because there is not enough space around the town hall!

Overall, this was a very nice update which was very welcomed by a lot of players.
Stay tuned!

Repository:

https://github.com/ldtteam/minecolonies

Pull Requests:

https://github.com/ldtteam/minecolonies/pull/2992/files
https://github.com/ldtteam/minecolonies/pull/2995/files
https://github.com/ldtteam/minecolonies/pull/3000/files
https://github.com/ldtteam/minecolonies/pull/3002/files
https://github.com/ldtteam/minecolonies/pull/3008/files

Sort:  

Thanks for the contribution, @raycoms! It's great that Minecolonies is becoming more stable, as new features are one of the most exciting things about playing games in my opinion.

All the fixes look great, and you did a good job on explaining what you fixed an how. As always, a great contribution - keet it up!


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]

Thank you for your review, @amosbastian! 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 12.56% 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

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!

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.034
BTC 63815.31
ETH 3124.40
USDT 1.00
SBD 3.99