Tuesday, May 15, 2012

Exp progress in status window

I added progress bars for exp to the status window. In order to do so, I "objectified" the progress bars, so I can reuse them for other things.

Saturday, May 12, 2012

Window managing


I created a simple window managing system. A button bar in the upper right corner can be used to show and hide windows. Every window got a header bar with a close button which hides the window.

Friday, May 11, 2012

Status window


This is the new status window. Unfortunately it isn't updated in real-time yet. The server only sends an update on login. But when I teach the server to do so, the client will be able to handle it. Whenever something changes, the server sends an update which only contains whatever changed.

Thanks to jQuery, it is drag-able across the canvas. I also used jQuery to make some other parts of the client code more readable.

Tuesday, April 24, 2012

Can jQuery help me?

I am currently checking out jQuery to see what the hype is all about and if I can use it to make the client work better.

Features I could use:
  • Selectors - I already thought about an own alias function for the annoyingly verbose document.getElementById.
  • Position for centering divs properly. Also maybe for some other things.
  • Tabs - I already have an implementation of a tabbed container for the chat, but maybe I could make it better with JQuery.
  • Drag & Drop - For inventory handling and putting spells into the quick bar
  • Sortable for inventory handling (maybe)
  • Resizable GUI windows

Friday, April 20, 2012

Game system software architecture

Before I start with Milestone 6, which is about the implementation of a game system, I decided to do some refactoring first.

To allow quick and easy changes to my game system, all logic related to it should be concentrated at one place: A GameSystem class which implements all the game rules. All the provisoric existing logic needs to be removed and replaced with calls to this class. The game system does of course need the system-specific stats of all the participants like mobs and players. Storing this data in the existing objects would be a violation of the principle to isolate the game system. So every participant now gets a gameSystemDelegate object with all the game system specific data which is received from the GameSystem during construction and is passed to every call to GameSystem instead of the original object.

To allow easy replacement of the game system, I decided to follow the principle of dependency injection and the strategy pattern. GameSystem as well as the delegates GameSystemPlayer and GameSystemMob are only interfaces. The implementing class Wizardwar is only referenced in the main class, where it is used for a global GameSystem object referenced everywhere else. The implementations of the delegates, WizardwarPlayer and WizardwarMob, are only referenced in Wizardwar.

That way I could create an entirely new game system, and the only place in the engine code where I need to make a change is the line gameSystem = new Wizardwar() in the Main class.

About the wizardwar package itself: I intend the delegates to be "dumb" data holders with all members set to public. All game logic should be contained in the Wizardwar class.

Thursday, April 19, 2012

Fringe tiles work - Milestone 5 finished


The client can now display maps with multiple map layers, including a fringe layer where the draw order of the tiles is combined with the sprites. I implemented that by converting all non-null tiles on a layer named "Fringe" to map objects (or rather something similar which implements the same interface). 

Client, server and map editor now work the way I intend. Now I theoretically got all the tools I need to start world building. All that is left are tiles and a world building plan.

Milestone 5 is hereby finished.

Tuesday, April 17, 2012

Blocking works

Reading the block map property from each tile works now. Entities with different ways of movement is untested, but should work.

The way of defining the walk properties of each tile of the tileset is a bit cumbersome: you add a tile property "walk" and as a value a hexadecimal value according to the table in my previous post. When you don't set a walk property for a tile, the default value 0xd (walkable for everything but swimmers) is used. This has two possible pitfalls:
  1. the hex values are hard to remember, so you can easily select a wrong one
  2. there is no visual indication which tile has which walkability
It also has the drawback that it isn't possible to have tiles which are only partially blocked, which means that I waste the most powerful feature of my route finding engine. Maybe I could do it like we did at Mana and use a special invisible map layer for the blocking, just with the difference that the graphics of the tiles you put there matter: different colors of pixels mean different walkabilities.

Warp loading works

Loading warps from the map files is also working.

Monster population should wait until milestone 6.

Still left are movement blocking and fringe objects.

Then I will have all basic technical requirements for building a game world and I can call milestone 5 finished.

Tileset loading

The client can now work with tilesets and doesn't require a separate image file for every tile type.

I did a small modification at the server to remove the relative paths from the tilesets in the JSON code provided by Tiled and leave only the filename. That way I don't have to worry about where to save the map files before copying them to the server. The drawback is that I can't organize my tilesets in directories, but I don't believe that I will have so many tilesets that this becomes a problem.

Sunday, April 15, 2012

Blocking tiles

tilewalker (1)swimmer (2)flyer (4)magic (8)examples
F
shallow water
EXdeep water
DX

normal ground
CXXabyss; low fence or other chest-high obstacle
B
Xindoor, under overhang
AXXriver under bridge
9XXgateway 
8XXXgrate, prison bars
7
Xcircle of protection on shallow water
6X
Xcircle of protection on deep water
5X
Xcircle of protection on normal ground 
4XX
Xtree, high stone, other man-high obstacle
3XX?
2XXX?
1XXX?
0XXXXwall

The column "magic" applies to spells which need a line-of-sight to be cast as well as to "ghost" type mobs / players. A being can have multiple forms of movement, like a harpy which can both walk and fly. These mobs are only blocked when all of their ways of movement are blocked. Or in computer terms:
if ((tile_bitfield & move_bitfield) == 0) tile=BLOCKED;

Having scenarios where players and enemies have different areas to walk on as well as shared areas where both can walk, could lead to some interesting gameplay situations.

I could also imagine some spells which turn a player into a fish, bird or ghost. This would mean that they can't use equipment anymore, but it would allow them some interesting new leveling strategies as well as open up some new areas. There could also be the ability to polymorph a player involuntarily when he is in an area which allows both types of movement. This could be used as a strategy in PvP. Or it could be the solution to some puzzles before the player acquired said spells.

One puzzle I have in mind is a river with a broken bridge. The river is populated by mermaid mobs which sometimes attack the players with a spell which turns them into a fish. To cross the river, the players need to walk into shallow water, provoke the mermaids to hit them with said spell, swim across the river into shallow water on the other side, and wait for the spell to wear off.

An advanced form of magic could allow players to walk on water or fly without sacrificing their ability to walk on land or have equipment. But this should be a lot more expensive for the player.