Check out the Nox Archaist Forum!

Wednesday, March 30, 2016

New Feature: Boats

Navigate rivers and shoreline in your outrigger canoe.

Or take to the seas in your caravel.

Of course, a larger frigate is best for long ocean voyages; unless of course you can take to the skies...

Tech Talk:
  • There are currently four different water tiles, each representing a different water depth. 
  • Each tile graphic has a unique ID number.

  • The player icon is drawn at the center of the screen based on the tile ID number assigned to the player. As a result, the player icon could take the form of any graphic in the game's tile set. 
  • The tile IDs of the terrain (mountain, trees, etc) on the view screen are stored in an an array.
  • Map objects, such as boats, are stored in a separate array. The map objects array contains the tile ID of the object and the map x,y coordinates of the map object.

Boat Mechanics

Yes, Nox Archaist has boat mechanics. We call them shipwrights. And they'll even fix your -

Wait, no, different mechanics. The Foreman just reminded me I am supposed to talk about the technicals of how boats work.

When the graphics are drawn on the view screen, a loop looks through the tile IDs of each tile in the terrain screen array and draws the graphic associated with it.

After the terrain is drawn, another loop looks through the map objects array and if the map x,y coordinates of the object are located in the region of the map in view screen (determined by player map location), then the tile IDs stored in the map objects array is used to draw the appropriate shape on screen.

Pulling it together. (pull it together tight or the boat might sink)

A player is permitted to board a boat if there is a map object of type boat at the x,y map location of the player). When the player boards a boat, the player icon's tile ID is changed to the tile ID of the boat).

As the player moves, the x,y map location of the boat is updated to match the player's x,y map location. Since the terrain and map objects are stored in a separate arrays, once the player (in boat form) moves, the terrain in the previous location reappears on the view screen. This multi-array setup creates some ability to stack tiles.

No comments:

Post a Comment