Monday, April 11, 2016

Documentation: Quest System (schema)

Should You Choose to Accept...

I've been working on creating the db schema for the quest system which ended up leading me to redo how I'm doing the item system, but I feel it was well worth it. The item system is now much more robust and can handle many more scenarios. All items will now be stored in an object system which can be joined to other systems more effectively. The object system now will hold all objects within the game and detail their data out into multiple rows in an object data table. This allows weapons, armor, consumables, resources, building, and cities to all live together within the same system.

This is important since the quest system needs to be able to interact with all types of objects, such as: visit a building, trade a resource, kill a mob, receive a weapon as a reward, etc.


The quest system break each quest down into a set of steps where the starting quests links to the first step, and each step then links to the next.

Each step consists of a goal (visit, trade, craft), an object (city hall, lumber, short bow), and a quantity. This allows for a quest to be very simple or very complex if desired.

The quest reward then links to the quest, and consists of an object and a quantity. Multiple entries can exist allowing for multiple rewards to be given for completing a single quest.

I'm pretty happy with this system, and will figure out how well it work over the next couple of weeks as I start building out the client side to consume this data.

Monday, March 21, 2016

Documentation - Inventory System

This entry is to document one of the basic systems that are in place so that the information exists in more than just a notebook.

Inventory

player.js

Objects

invSlot

item

Variables:

  • name
  • desc
  • img

Methods:

  • getItem: (display the item information in a new action window)
  • setItem: (sets the variables of the item object)
  • delItem: (empties the variables of the item object)

Variables:

  • slot
  • qty

Methods:

  • getSlot: (display the slot information on the screen)
  • setSlot: (sets the variables of the slot object including the item variables)

Process

initialization.js -> Create x number of inventory objects
-> Fill slots from API: /character/inventory
ui.js:InventoryClick -> Create a new action window and load inventory.html
-> Loop through all inventory objects and initiate getSlot()

Data Structure

a
characters
P K id
U name
K user_id
K city_id
id--->character_id
b
inventory
P K id
K character_id
K item_id
item_count
slot
item_id<---id
c
item
P K id
U name
description
stackable
icon

API: GET /Character/Inventory

Returns the following structure:

c.name c.description c.icon b.item_count b.slot
item_name item_desc item_icon item_count inv_slot

Thursday, March 17, 2016

Refactoring

Refactoring Code

I'm pretty happy with the progress so far. While it may not be anything pretty at this point, it is all at least functioning as expected. I've been taking some time to read up on object oriented programming and am refactoring my code to align with that model. So far I've added in a very basic inventory system which uses inventory slot objects which are extension of basic item objects. The item object can be set with item details, and can display information about the object in an in-game window. The inventory object extends the item object to include a specific inventory slot number. All inventory slot objects get created on game initialization, and the the appropriate slot objects gets updated with item data based on which item should be in that slot. There is still much more work to be done, but this at least give me something to build on.

I'm going back and refactoring my city map code to be an object oriented system as well with each city building being an object that gets loaded with information about the building, and the city being an object with information specific to the city. The city object will contain a method to fill in the city title and background image, then kick off a displayBuilding method from the building objects which will draw their information to the map.

What's Next?

Next I'm going to be spending some time building out the interfaces for some of the buildings. The town hall building should be fairly straight forward, so I'll probably focus on that one first. It should display the current city members as well as the city leadership and what kind of city leadership is in place. (Monarchy, democracy, city council) Once I have that in place I may begin to work out some of the functions to change city leadership types, or perhaps start to work on some of the core game play mechanics such as trading, fighting, or questing.

On The Interwebs!

I have purchased a VPS which I'm planning on running the game on as well as setup a domain name to point to the server. I have not yet loaded the game code up to the server, but I have it somewhat secured at this point. Once I have the game up to a level where I'm looking for some people to do some very basic functionality testing I'll start publishing the code up to the site and keeping it up to date. Until then, enjoy the Apache default page at http://technochimp.tk

Friday, March 4, 2016

Slim Chance

Rest API

Initially I had started with the goal of building the backend API leveraging the Phalcon framework, but while developing I came to realize that Phalcon is a little over my head at this point. While I would love to sit and dig into and learn it all, I also need to get some progress or I'm going to drive myself insane. After some more looking around I finally circled back around on Slim which appears to give me the basic functionality I'm looking for which being a bit less complex to implement.

Where Are We Captain?

At this point I've ripped out the Phalcon implementation I had started on and have replace it with Slim. I have re-implemented the registration API, and have managed to build a very simple login API which will now allow me to begin the build more of the game and database.

So far I've started to fill a notebook with various ideas for game mechanics, building ideas, city leadership, and back-end database table structures. I have no idea if I'm heading in the right direction or not, but at least I'm enjoying the ride. Hopefully I'll have something to show for it down the road, but if not I won't be upset.

Where to Next?

Next up will be starting to integrate the game interface with the database. I've done some very basic tests to pull some data from the back-end to verify it functions, but now it's time to start piecing it together. Hopefully by this time next week I'll have a couple of unique towns that can pull from their own data.

Friday, February 26, 2016

So What is this Web Thing Anyway?

Beginner Web Development

So, I've recently decided it's about time to get around to trying my hand at building an MMORTS web game. This has been something I've wanted to do for a while, but never really got started. Seeing as it is the middle of winter I am now leaving the house only on an as-needed basis since anything below 70 degrees is just uncalled for. This leaves me with adequate time to get to work on my latest project.

The Goal

The game concept is as follows: You are the citizen of a city that, like the other cities in the game, is trying to become the greatest city through trade and conquest. Citizens of the city make up the government body which decides how the city will run including citizen tax rate, building improvements, city vs city attacks, city alliances, etc. All major city decisions are put up to vote with the citizens. There are three city types which have strengths and weaknesses: Trade, Attack, and Defense.

  • Trade Cities have high trade and low defense.
  • Attack cities have high attack and low trade.
  • Defense cities have high defence and low attack.

There are also various player classes which class improvements at higher levels.

The game play will focus around working together with the citizens in your city, which is similar to an alliance or guild, to build up your city. The city grows from a tax on in game currency which is automatically collected as you gain money from quests, battles, or trades. Trading will be one of the easier methods of progression, various forms of quests will be available for providing story, and TvT (Town vs Town) actions are available to keep things interesting. Trading will happen at both the player level and the city level. There will be several quest lines including a main quest line, possibly a city quest line, and town and world events. The town military leader may call a TvT action at which point citizens may sign up to join in order to share in the profits on the attack.

There is much more, but this is all for now.

The Development

After quite a bit of researching and from personal experience of using various web-based interfaces, I've decided on the following toolsets at the moment:

Backend:

  • LAMP stack
  • Phalcon -> Using to create REST API

Frontend:

  • HTML / CSS / JavaScript
  • jQuery
  • All calls to the backend should be via REST API call
  • Opting to leverage DOM elements vs a canvas object for performance reasons
I've made simple html pages back in the geocities days, so I figured that pretty much makes me a pro at this! ;) Obviously with much to learn, I've been trying to read up as much as possible on web development to get a clue of what I'm doing.

It Begins

So far I've gotten a little bit going and have even started up a github repository to keep things in order. I've uploaded my initial code I've been working on here and there for the past couple of weeks as well as started a bug tracking list to keep track of things to work on. I'm sure this list will grow a lot in a short period of time.

TechnoChimp-MMORTS