Sea battles and telescopes - Archipelago


Introduction

Up until now the pirate ships haven't acted as much of a threat. They moved around the map nicely and would jump on cargo ships that strayed within range. But generally they were easily avoided and on the odd occasion they did manage to catch a cargo ship nothing actually happened.

Two changes to improve their functionality:

  • Pirate ships now scan a certain range of tiles in all directions (with a telescope / spyglass obviously) and will move towards cargo ships in visual range even if they cannot reach them on that turn.
  • When pirate ships catch a cargo ship a sea battle ensues with resulting damage and loss of cargo for the loser.



Screen Shot 2018-05-16 at 19.53.52.png

Phase 2 of Archipelago development (Resources, Goods, Building, and Trade Contracts) is now well underway.

For a full view of the current state of the game development see my github-hosted page.
https://miniature-tiger.github.io/archipelago/

Please note that the game is not yet complete - you can see current progress and test functionality but you will have to wait a little longer to play!

Background details of the project can be found at the end of this contribution post.


Repository

The repository for Archipelago can be found here:
https://github.com/miniature-tiger/archipelago


New Features covered by this Contribution

Adding telescope to pirate ships
Previously pirate ships would only look for cargo ships that they could reach within one turn. This led to circumstances where a pirate ship might be only two tiles away from a cargo ship but then decide to move away from the cargo if the wind did not allow them to reach it immediately.

In this change an additional step is added to the the logic of pirate ships. The sequence of priorities now becomes:

  • Look for cargo ships within wind range (i.e. that can be reached that turn) and move to attack them.
  • Look for cargo ships within a 5 tile radius in all directions and move as far as possible towards any cargo ship found (this is the new step).
  • Move as far as possible in the direction of the wind to seek out new opportunities.

An example is shown below. Rather than moving as far as possible with the wind towards the North-East (starting from the empty tile amidst the red tiles) the pirate ship now moves North-West in pursuit of the Green Team cargo ship.


Screen Shot 2018-05-16 at 20.15.30.png

Pirate ship in pursuit!

The code changes for the above new feature can be found here:
https://github.com/miniature-tiger/archipelago/pull/52/files

The change required a rewriting of the logic used to find the paths over which ships move. Previously only paths that could be reached within one turn were investigated. Now all efficient paths up to the localMaxMove boundary (5 tiles in all directions) are captured. Only tiles within the move cost allowance are activated (turned red) but the information stored on other paths can be used by pirate ships to move towards cargo ships beyond the activated range.

The change also required a method be added to find the last active tile on a given path, so that pirate ships move along the path towards a cargo ship but do not travel beyond the active range.

Sea battles!

If a cargo ship is within wind range then a pirate ship will move towards it and attack.

This change adds the functionality for the ensuing sea battle. The change takes the following steps:

  • Pirate ship stops one tile short of cargo ship.
  • Ships turn parallel to each other.
  • Simulation of cannon fire.
  • Losing ship is damaged - the mast is broken and the oars come out.
  • Cargo ship goods are taken by pirate ship if pirates are victorious!

An example gif is included below:


pirateBattle.gif

Orange team repel the boarders!

The code changes for the above features can be found here:
https://github.com/miniature-tiger/archipelago/pull/53/files

The main change required were:

  • Addition of a new graphics method "damageShip" to convert the sailing ship SVG to rowing
  • Addition of a method shipConflict to animate the sea battle, calculate the winner, and transfer any stolen goods
  • Update of the game flow logic for conflicts and the priorities of pirate ships

Proof of Work Carried Out

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


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


Details of the Archipelago Project

What is the Project About?

Archipelago is a new project that I have been working on. The aim is to develop a seafaring and trading turn-based strategy game. Players will guide their ships around the islands, searching for goods to aid construction of ships and their bases, trading with the Kingdom settlements and avoiding hazards like pirates and whirlpools.

Technology Stack

The project is a browser based game:

  • Mechanics: Javascript
  • Visuals: HTML and CSS initially but now moved across to Canvas and SVG.

Roadmap

Phase 1 - the first main goal of getting ships on the board and moving at different speeds under the influence of the compass is complete.

The graphics overhaul is also now complete.

Work is now ongoing on Phase 2 which is resource discovery, goods production, building and the trade contracts that underlie the game.

Work has also begun on adding pirates and conflicts.

Phase 1 - Board and ship movement: COMPLETE!!!
  • Board set up - COMPLETE
  • Basic ship creation: functionality and graphics - COMPLETE
  • Manual ship movement and board updating - COMPLETE
  • Basic compass creation: functionality and graphics - COMPLETE
  • Turn based activity of ship movement - COMPLETE
  • Logic of length of longer moves around obstacles - COMPLETE
  • Chaining together transitions to allow graphics of longer moves - COMPLETE
  • Separation of board layers (Canvas base layer, Canvas activation layer overlay, SVG piece overlays) - COMPLETE
Phase 2 - Resources, Goods, Building and Trade Contracts

Resources

  • Add Resource tiles (forest, ironworks, flax, gold etc) - in progress: forest, ironworks, quarry, plantation added
  • Discovery of resource tiles - COMPLETE
  • Claiming of resource tiles - COMPLETE
  • Dashboard of player pieces - COMPLETE

Goods

  • Creation of new goods each turn - COMPLETE
  • Loading, unloading and transportation of goods - COMPLETE
  • Dashboard of goods pieces - COMPLETE
  • Goods icons - COMPLETE
  • Variable quantity of goods to be loaded / unloaded - COMPLETE

Contracts for delivery:

  • Semi-random (equitable) generation of trade delivery contracts - COMPLETE
  • Creation of trade settlements - COMPLETE
  • Dashboard for contracts - COMPLETE
  • Mechanics for contract sign-up - COMPLETE
  • Mechanics for contract delivery - COMPLETE
  • Island naming: for describing location of trading settlements - COMPLETE
  • Graphics of trade routes - COMPLETE

Building (On hold - decide if necessary once contracts implemented)

  • Recipes, time to implement, graphics etc

Scoring:

  • Work out scoring mechanism (linked to contracts)
  • Add score dashboard
Phase 3 - Conflicts

Pirates

  • Add pirate ships - COMPLETE
  • Automate pirate ship movements (basic movement with wind and search for cargo ships) - COMPLETE
  • Search - telescope range of 5 tiles for stronger search for ships - COMPLETE
  • Consider separate cargo and war ships for teams

Forts

  • Add fort icons - COMPLETE
  • Create safe harbour from pirate ships

Conflicts

  • Attack - Develop conflict method between ships - COMPLETE
  • Stealing of cargo - COMPLETE
  • Limping back to harbour
Phase 4 - Game Management and Settings

Settings

  • Settings pop up box created - COMPLETE
  • Options added - In progress - game speed added
  • Local options (player name etc)
  • Game saving and replay
Phase 5 - Central trading centre
  • Develop central market allowing players without resources to trade and fulfill contracts
Phase 6 - One player version development

Artificial Intelligence levels for computer players

Phase 7 - Rules, roll-out, documentation, testing etc

Contact / Contribute

You can get in touch with me on discord if you would like to contribute.

You can find the current state of the game here:
https://miniature-tiger.github.io/archipelago/

The repository for the project is here:
https://github.com/miniature-tiger/archipelago

Have fun!

Sort:  

Thanks for the contribution!

It's really getting there now, it's amazing! Just played around with it a bit, and it seems to be working great! One thing I noticed was the overlay was blocking the end turn button partially (see here). Also, I was wondering if you changed the movement, because before the ships wouldn't stop as often, right?

P.S. the battle and death animation is so good!

Click here to see how your contribution was evaluated.


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

Thanks Amos!

Cheers for pointing out the overlay issue. It looks like the problem is using screen.width to set the border/surround size dynamically which works in full screen on my mac but I guess won't work in all circumstances. Hopefully it should be a quick fix.

For the movement the code is unchanged. I just speeded it up by setting the fast option as default which makes it look like more stops for the ships. Waiting around for all the pirate ships to move every time I made a change was taking forever!

Seems like a simple, easy to play rpg online game.
I was wondering what would determine the wind speed and what the scoring would be based on?
Are players going to upgrade their vessels to improve their battles with carbo ships?
Are players going to be given freedom to choose between being a cargo ship or pirate?

Hey @belemo, thanks!

Wind direction is currently random, with the compass moving a little each turn (or staying the same) and occasionally changing direction completely. Ship movements are much further in the direction of the wind. When I get to game testing I may change this to try and make it as fair to all players as possible - the position of pirates moving directly after Orange team may give them an advantage, or perhaps a disadvantage since the wind is more likely to change over four turns (for Green Team) than one turn for Orange team until the pirates move.

Scoring is to be based on fulfilled trade contracts - it's really a trade game. I still need to add the functionality for contract continuance after the initial agreement. This should be coming soon but I needed to get the pirate ships working first as they will impact trade along the trade routes and potentially break contracts.

Vessel upgrades are a great idea! I haven't started the coding for 'building' - the idea is to let players build extra ships and different kinds of ships but upgrades could be a great way to do this too. Having a choice between building / trading should add strategy decisions which will make the game more tactical.

I don't have plans to let players be pirates but that could be a great spin-off game too! Once I have all the functionality built hopefully it will be sufficiently flexible to try out all kinds of different games.

Thanks for the ideas!

Thanx for your response. The game will be a success, I'll be in touch and would love to play it when its fully developed.

Hey @miniature-tiger
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Contributing on Utopian
Learn how to contribute on our website or by watching this tutorial on Youtube.

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

Vote for Utopian Witness!

Coin Marketplace

STEEM 0.15
TRX 0.16
JST 0.028
BTC 68750.43
ETH 2428.97
USDT 1.00
SBD 2.37