Saturday, June 30, 2018

30 June Updates - Item Definition / Database, Inventory, Ballistic, Camera Movement

Hi!

So, these are the updates so far since the last blog post. As of now, there isn't much UI design, but more to code design and development. That includes a simple event registry pattern for number of things in this update.

Inventory Design

This design is being abstract as possible so it share the same traits for other use, like island merchant inventory, ship inventory, ship side inventory (to store cannons). No UI to show yet, but it's done so far. 

Technically, an inventory only stores ItemEntity, a generic bag for quantity for specific item. At first, I had a dilemma on designing such thing, as different category has different structure of design. Like a Cannon category items have damage value, foods have consumption value and so on. 

This problem was tackled by having the definition (next subtopic) separately, as those values are item specific, and does not change over time. Plus, the inventory now only store a single object per item, as the only purpose is to store the quantity of the item. Which i am happy so far with the design.

Item Definition Design

Basically, this one became major prerequisite to most of the latest updates i've been doing (inventory design, ballistic [which consume cannon balls], side shooting mechanic and so on).

So far I managed to categorize the definition of the item to 7 at least that being :
- food
- livestock
- medicine
- firearm
- ammunition
- resource
- cannon

Bad Pirates is a singleplayer game that revolves around distance based trading. Most of the unique item will be marked as luxury. Luxury item only available at one place at a time (by which the location will be procedurally decided at the beginning of the game). Other than that food, medicine, ammunition are also a big part of your surviving adventure at the sea.

The game is generally inspired by uncharterd waters online. so you can see similar item categorization design there.

Item Database Management Web App

Not sure if this worthy of mention, but in order to cope or scale with the soon ever growing item database, i made a simple web app to add an items. Because doing so in json or plain is totally not fun at all, having different item structures.

Ballistic

The side shooting mechanic of a pirate game. My favorite development so far. So far what has been drafted and developed are like
- independent ballistic side design (so far there's only two sides, left and right. there'll be one more later like front for stern chaser cannons)
- shoot rate
- primary targeting (so your crews know where to shoot)
- accuracy 
  -  to be based on the angle of the side facing the opponent ship(s)). Bigger angle will cause your sailor to stray a lot.
  - the cannoneer type crew will increase this rate
- independent inventory
- rigidbody based projectile.

there'll more, as later we'll incorporate crews mechanic into this design. I am happy with this design so far.

Video is available at

Camera Movement

Was honestly afraid of this development as movement in quaternion, degrees, and angle, is totally not my forte. Tried to look for a youtube help, and some early tutorials, but mostly don't fit with the game. The idea is to be able to move the camera around, and to focus both you and your opponent (or target). Somehow today i managed to tackle the problem by having a basic understanding on how to get the vector of a direction, or apply angle etc. So far what've been developed are like :
- movement around the ship (by holding mouse 2)
- 2 kind of camera locking (focus both on player and target)
  - soft locking, but moving the camera (or using the hotkey) will break the lock
  - hard locking, by tapping the camera focusing hotkey. only allow height movement. pressing the hotkey to break the lock

this movement incorporate a reusable target design (a TargetEntity which is also used by the ballistic mechanic), and as later we'll have more kind of camera focusing. (like questing, island direction focusing and so on).

Video is available at

Event Registry Design Pattern (is there even such pattern?)

Not sure what to call it, maybe event delegation/handling design pattern.

By default most framework of language doesn't really show you a proper direction over how to do things, because I believe that things are mostly business/problem specific.

So far, i've been using such pattern for number of problem i've been facing. Especially in dealing with common events like trigger event and collision event. 

These are kind of registries (or delegator) i managed to design :
- ShipInteractionEventRegistry, to validate / handle the collision events like ballistic (cannon hits), and ship/objects collision, and trigger events like island/npc/etc interaction events.
- MouseSelectionEvent, to validate and handle mouse selection.
  - first event managed to be developed is ship selection event for ballistic primary targeting.
- ButtonPressEventRegistry. To handle numerous hotkey press event.
  - first implementation is the camera focus hotkey

Of course, we can just add a new method and do an if check on every kind of collision / trigger object event that the controller/script component gets, but the code will grow unmanageable, and maintenance will be so damn boring.

As you can see, we have two major methods for every registered event namely
- bool Validate(context), to validate the event (the if checking to be placed here)
- void Perform(context), to handle the event 

The only thing the controller needs to concern now is the registry(s), which only does one thing everytime there's an event (collision/trigger/mouse click/button press etc) by validating all handler. I first used such pattern for my php microframework, which you can find here :
https://github.com/Rosengate/exedra/blob/master/Exedra/Contracts/Routing/GroupHandler.php

=================================================

More progress information can be found by the public trello
https://trello.com/b/8aeV4DXA/bad-pirates

Until next time.
Thanks for anyone who actually read this lol :p

Tuesday, June 26, 2018

26 June Updates - AI Behavior

Hello,


I've been working with number of initial feature aspects, like daytime cycle, simple clouds generation (along with object pooling mechanic), ship interaction events registry, AI ship movements (AI behavior design incorporation) but mostly revolves around codes design and so on. What i would like to highlight here is, the AI behavior which I find challenging so far, due to the level of continuity needed to be designed.

AI Behavior design

The design isn't not using any plugin, or unity animator controller tools, to give more freedom on codes, due to how procedural the gameplay really is. What I find challenging is, the need to classify the kind of behaviour an AI may have.

Passive Behaviors

This behavior will be called all the time. It can be used for features like discovery behavior , surrounding AI interaction behavior and so on. The integral between active and intermediate behavior can happen here.

The current design can have more than one (1) passive behavior at a time.

Active Behavior

The design can have one active behavior at a time. Such behaviors are like
- go to behavior
- patrol behavior
- following behavior

Intermediate Behavior

This behavior overrides active one in term of priority, on which the termination ends this behavior, and continue to active level of behavior (if there's any). Such behavior is like
- attacking behavior
- escape behavior

Others

Ship interaction event registry

A registry made to easily handle or classify the kind of interaction that happened ship collision. It can be :
- ship collision
- cannon ball collision
- island interaction


Object pooling mechanic

Handles game object pooling for performance on continuous instantiation

Daytime cycle

Basic day time cycle and sky appearance


Fake island name implementation

For island naming sake. Credit :
http://fantasynames.org/island-name-generator/

=================================

That's all. More information about the progress can be found here :

Until next time. :)

Sunday, June 24, 2018

Bad Pirates The Game

Hello everyone,

This blog will officially be covering all the development updates for the game. So, this post will highlight what the game will be about, along with tons of initially drafted features.

Overview

A not so accurate single player pirate adventure game in a procedurally and seamlessly generated world (connected). In this game you get the chance to be a pirate, good guy, or a super trader.

The game is generally inspired by the such as uncharted water online (except that this is an offline game), sid meier pirates and well, because i love sailing, adventure, and enjoying the survival nature of the sea, the rpg mechanic and so on.

Features

- world is procedurally generated based on seed
- weather system, day/night cycle, and datetime (maybe like 1 day to 24 minutes ratio)
- islands interaction
  - crews hunting
  - trading system
  - tavern system
  - economy
- regional trading system
  - luxury item prices increases the further you go
  - to encourage player to travel further
- proper goods implementation for trading system
- fame/notoriety system
  - attacking neutral, empire, merchants increases notorierity and fame
  - doing good things like helping neutral, or empire increases fame
- ship interaction
  - crews management
  - inventory
  - upgrade
  - repair
- crews system, and in how how it helps your ship performance
  - classes
    - navigator
      - navigation
      - increase ship turning rate
      - island discovery
    - sailor
      - ship operation
      - repairing
    - chef
      - provides cooking
    - shipsmith
      - much faster ship repair
    - cannoneer
      - faster shoot rate
    - fisherman
      - fishing rate
    - merchant specialist
      - helps buying goods (negotiating) at lower discount
- world events
  - merchant, pirate, empire movements
  - AI skirmishes events
- sailing system
  - wind driven speed
- survival feature
- skirmish gameplay
  - realtime (time slowed down to 1X, if we have game-speed change mechanic
  - ballistic and gunnery
  - repair system
  - defense penetration system
- crews dialogue system
- AI aggression level
  - level of aggression affect how they interact with in in sea

==============================================

I think there's more, maybe we'll save for later. Hopefully planning to release it by the end of this year as an early access.

The trello the much frequent progress can be seen here.
https://trello.com/b/8aeV4DXA/bad-pirates

And, I am Rahimie Ahmad, see you next time.