Archipelago - Whirlpools!steemCreated with Sketch.

Whirlpools were one of the first ideas that I had as a hazard for players in Archipelago. I included the idea in the initial "read me" overview and on the roadmap but the implementation never made it into the game. Until now!

Introduction

The focus for this week was on adding am entirely new game feature: whirlpools!

Whirlpools act as a hazard for players. Appearing at random each turn of the moon, their destructive power blocks existing trade routes resulting in contract cancellations and setting our navigators' fortunes back a good few steps.

The implementation of this new feature required integration with many different facets of the game. The process I followed was as follows:

  • Creation of SVG graphics and set up.
  • Addition to the board and movement of whirlpools.
  • Interaction of whirlpools with other pieces and tiles.
  • Interruption of trade routes.
  • Transition animation graphics on creation and movement.

archipelagoLogo.png

Repository

The repository for Archipelago can be found here. Background details of the project and the road-map can be found in the read-me file.
https://github.com/miniature-tiger/archipelago

For a full view of the current state of the game see my github-hosted page. Please note that the game is not yet complete - you can see current progress and test functionality and play the basic one-player version but there is still plenty to be added!
https://miniature-tiger.github.io/archipelago/


New Features covered by this Contribution - Whirlpools!

Creation of SVG graphics and set up

As a first step I created the SVG graphics for the whirlpool piece. It's an anti-clockwise spiral with the design aimed at being in keeping with the same sepia tones as the rest of the map.

spiral.png

Whirlpool design

whirlpoolboat.png

Whirlpool and catamaran

The first step also included adding a Hazard constructor, data for the whirlpool piece and all the other elements necessary to make a whirlpool appear on the board.

The commit / code changes are here:
https://github.com/miniature-tiger/archipelago/commit/254fc61be3091fa73a3dbb4a343102f0622755aa

Creation and movement of whirlpools.

Whirlpools appear randomly on the board and then move position at the end of each turn, just before the pirate ship actions. The second step was to implement this random creation and movement.

The initial restrictions on placement included the tile being on the board (not on an invisible tile) and the tile terrain being sea rather than land. In order to keep the game fair I decided to have one whirlpool for each quadrant of the board.

I implemented a new script, whirlpool.js, with a whirlpool object to handle all whirlpool related actions that could not be handled by existing piece / move constructors.

A new movement method (movePieceNoTransition) was also necessary to move the whirlpools, since the current movement for ships - stepwise like piece counters - would make no sense for a whirlpool.

Here's a map showing the initial position of four whirlpools, one in each quadrant:

initialpools.png

Where's whirlpool?

The commit / code changes are here:
https://github.com/miniature-tiger/archipelago/commit/b3b2ef2d8baec3b6fbdd39fed42fcf0f17012106

Interaction of whirlpools with other pieces and tiles.

Next it was time to consider how whirlpools should interact with other game pieces. Clearly a ship move should not be able to end on a whirlpool or to pass through a whirlpool. Contract trade routes should also avoid whirlpools when initialised to prevent them immediately being cancelled.

After implementing these points some stress testing revealed another couple of restrictions would be necessary:

stresstesting.png

Stress testing!

The two problems shown are:

  • Whirlpools being created in safe harbours, stopping ships from docking.
  • Whirlpools being created at the start point of trade routes (the start point and end point of a trade route are fixed for each team so the above implementation could not navigate the trade route around the whirlpool).

Whilst the first problem was simple to solve, for the second I ended up restricting whirlpools from being created next to all land tiles. Some revised stress testing is shown below:

revisedstress.png

All better!

The commit / code changes are here:
https://github.com/miniature-tiger/archipelago/commit/96480c7bdc0b1ac47df830f3c2ab75fb102bc1cf

Interaction of whirlpools with other pieces and tiles.

In previous versions of Archipelago, trade routes were interrupted and cancelled when pirate ships ended their moves on the path; the idea being that boats supplying the goods on the trade route would not reach their destination. However this created the possibility of other players luring pirate ships onto opposition trade routes.

In the new version, whirlpools will take on the role as the interruptors of trade routes. Pirate ships will now simply chase ships and steal cargo.

The contractObstacle method was updated to check for whirlpools rather than pirate ships.

The commit / code changes are here:
https://github.com/miniature-tiger/archipelago/commit/4615e64fd84746a0e64bc2fe52b7adab90810d34

Transition animation graphics on creation and movement

Finally I added some transitions to the creation and movement of whirlpools; spinning and reducing in size when a whirlpool is removed and the reverse when a whirlpool appears. I aim to incorporate more of these kind of transitions in the game in future!

The coding mainly centred on two new methods:

  • spinTransitionDown - new method for spinning transition with decrease in size.
  • spinTransitionUp - new method for spinning transition with increase in size.

Here's a gif to illustrate:

whirlpoolsmove.gif

All complete!

The commit also included some simplification of display piece transitions for scale and rotations.

The commit / code changes are here:
https://github.com/miniature-tiger/archipelago/commit/281e393469771f08863f95cb0b9d1bb8ed4b9b0e


Proof of Work Carried Out

This is the full url to my github account:
https://github.com/miniature-tiger


Contact / Contribute

That is all for this update. If you have any queries please drop them in the comments or contact me on discord.

Have fun!

Sort:  

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? Chat with us on Discord.

[utopian-moderator]

Thanks @helo!

Yes, I thought on the PR link that I could just include that instead of all the individual commits. I will do that next time!

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

Congratulations! Your post has been selected as a daily Steemit truffle! It is listed on rank 10 of all contributions awarded today. You can find the TOP DAILY TRUFFLE PICKS HERE.

I upvoted your contribution because to my mind your post is at least 4 SBD worth and should receive 120 votes. It's now up to the lovely Steemit community to make this come true.

I am TrufflePig, an Artificial Intelligence Bot that helps minnows and content curators using Machine Learning. If you are curious how I select content, you can find an explanation here!

Have a nice day and sincerely yours,
trufflepig
TrufflePig

Hi @miniature-tiger!

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, @miniature-tiger!

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!

Congratulations @miniature-tiger! Your post received a small up-vote from @wod-game as little gift.
We are a small group of people who want to create the next big Video game for Steem.
Want to know more about us?
Steem: @wod-game
Discord: Click here!

Have a nice Day!

Coin Marketplace

STEEM 0.17
TRX 0.13
JST 0.029
BTC 56263.97
ETH 2964.97
USDT 1.00
SBD 2.18