Ship Happens

Slow week, mostly due to being in a field reffing a larp event for five days.

Towns now have random names. 

Now we have towns, I need to rework the explore mechanic to reflect how the new maps mechanic works, which is annoying. At this point, I have three central problems to solve before I have a playable game:

* The prowling mechanic, where pirate ships go out and prey on unsuspecting boats

* The raiding mechanic, where they go and attack towns

* The combat mechnanic, which is what happens when they find them.

But doing those, I should bare in mind that I’m going to need to tie it with:

* The friendShip mechanic, where you only see ships & towns within a few social steps of you.

The last is how I’m attempting to cope with the “Massively” part of massively multiplayer. With a thousand users - a nice goal -and any number of ships and towns are - ideally - going to get so stomped flat on a regular basis that the towns can’t grow; or the map becomes so busy that it makes no sense at all (Plus, towns end up so close together boats never have to go far).

My current solution to this is as mentioned above. You see your ships, and you see your friend’s ships, and maybe their friends’ ships depending on how much that totals. You see the effects they have on your towns (in this system, towns are associated with player IDs so while you have no control or ownership of a town its appearance or disappearance is associated with you). Plus, it means all the ships around are owned by either you or someone you probably know.

I’ve still got to work on the edge-cases and theories around this (there’s a state called the StephenFry where, basically, someone is a nexus-point for all the users in the system and ends up causing the same problem I’m trying to solve with this), but that’s the theory.

Economy of Movement

Towns with spare food grow.

Towns with spare capacity make cash crops. Each town has a cash crop they can make.

Towns with cash can buy cash crops from other towns.

Towns with all five cash crops available make luxuries.

Towns only consume luxuries made by other towns.

This universe lacks the wheel, so all the above trades must go by sea.

And so we have a trade network.

Still some balancing issues to solve with it (some towns grow a little too fast and I need to put in some supply/demand pricing), but now we have a trade network we can add some pirates to disrupt it…

The long dark pathfinding problem

So, long periods of wondering how the hell I do something, followed by short periods of PersoningUp and doing it.

Previously on Planet Piracy, I talked about Pathfinding, and how I was “Just using the A* Algorythem”.

Reader, I lied.

Well, kind of. First, I found an implementation of A* in PHP, and since all my manipulate graphics knowledge is there, I used that to futz around with pathfinding routines around a tile. I was pleased with that. The problem I was trying to solve (“How do I generate maps?”) had been solved, and the pathfinding working was a bonus.

Except it kind of wasn’t working. Being able to pathfind inside a tile is neat, and everything, but pathfinding between tiles suddenly became a massive issue, because without some kind of concept of the rest of the world, the pathfinding doesn’t know how to get from tile to tile and, because I’m an idiot, there wasn’t really a concept of a “world”, merely tiles that linked to other tiles.

I spent a while pondering this as a background task, but it became obvious that without solving it I wasn’t going to be able to test the Towns system reliably (currently the ships are abstracted, they are at a town, they vanish for <i>n</i> turns, and then they turn up in the other port. This is great for the towns, less good for the pirates we hope to prey on them). My entire Locations and Maps system had become toxic.

The new system is still under construction. I’ll fit it into towns and then back into the gameplay section afterwards, but basically removes the “Tile” aspect entirely, and has one, huge, map.

In order to write Pathfinding, it’s useful to be able to visualise what the thing is doing, so I spent most of yesterday attempting to get pygame working, but after many hours work, I successfuly discovered that my setup is broken to the point where pygame is unable to display anything inside a window. Giving up on that I tried Soya, a 3D engine, which worked mostly, but I spent so long trying to get textures to stretch properly that I gave up. In the end, I just used the Python Imaging Library:

And eventually, we had pathfinding:

Hugs the coastline a bit, but we have a start…

Revisiting Towns

When I came back to put Towns back into the new version, I went back and attempted to fix the modelling problem they had. Specifically, they would grow linearally for a little while, and then suddenly explode, hit the population cap and enter an unpleasant cycle of boom and starvation.

Attempting to fix this resulted in the irritating realisation that all this was because I’d done the system in several stages, and slightly changed what I was measuring with a variable name between them, and the whole system was an overcomplicated mess. So I scrapped it and simplified it.

Now, towns have a number of fields, farms, shops and some other stuff. It produces food, a cash crop, and luxury goods. If it has enough food to support it, the population expands. If it has all the available cash crops, it produces luxury goods as well. Because it can’t produce all the cash crops or consume its own luxury goods, it looks to buy these things on the open market, which results in the happy coincidence of trading ships forever crossing the open sea in a game where the players are pirates.

Which is useful.

Towns

Exploring new Avenues

And a week went by.


The next thing is probably the missions system, but the missions system is huge and complicated and needs some basic parts in place before I start it, or else I’ll end up rewriting it later. So, distractions.


Well, major distraction was Mass Effect, followed rapidly by the sequel.
However, relevant distraction was the map system. Ideally, we’re going to end up running multiple shards at the same time, but I’m not yet sure how I’m going to do that - it might involve separate ruby installs per shard, with some kind of magic cross-shard login system. Multigame support is therefore not quite there yet. Each game should really have a separate map, though.


Looking for decent mapping tools has been fun. I’ve looked at some incredibly expensive ones, but I couldn’t see though the license whether using them in a commercial application was against the rules, so I went for an open source one built for a forthcoming game called “Hero Extant” which generates pretty bitmaps and overlays all sorts of funky data. A few iterations of that and I have a passable map, which I split into 36 squares and fed into a thing that looks at bitmaps, works out which bits are sea, and builds node-graphs I can use with an A* pathfinding algorithm. Currently that only works inside a tile, I haven’t done the world-level path-finding just yet.


However, having the basic layout enables me to stir it into the database and put the exploration mechanic on top. Not that there’s anything to explore yet, but the tile progress from a blue mess to a blury green one and finally a sharp map as you learn more. I’ll probably filter the lot to make it look a bit more piratey, rather than the original SimCity aesthetic it’s currently exploring, but it’ll do for now.


An increasingly desperate path finding operation

Our Program Continues

So, kind of went dark for a while.

Things that happened in the meantime:

a) I spent a while writing a mission system you could send your boats on.

b) I wrote some missions

c) I deleted the entire codebase.

The first two are kind of more obvious. The point of the game was to send things off on these missions and they’d do things, and they’d report back. It wasn’t really very fun, though.

Plus, as much as I was enjoying Ruby development, it became a lot more useful to be learning Django (since that’s what my most recent jobs have required), and as these two problems converged, a solution presented itself. git rm -rf *.

This has resulted in a number of major changes. The first is the reorigination of the basic unit of the game from having many different things (Ships, Pirates, Missions, Events, Upgrades, Training, Maps, and more) to having three things. Ships, Maps and Cards. Basically, it’s now a sufficently complex card game, which has some interesting knock-on effects which I’ll talk about when it’s further from being vapourware.

Plus, because it’s a system I’m more used to, I’m a couple of steps further than I was when I abandoned Rails, only a couple of weeks after I restarted it. 

Missions Accomplished

This afternoon, I pressed a button and my current test company “Captain Flashheart” of “Red Delirium Limited“‘s newest ship elected a new captain. This doesn’t seem like much, but was actually the first thing you can do with the mission system. So yay, another bit ticked off.

Sunday Morning, 3am

Today I’ve:

Fixed the authentication flow. You log in, you pick one of your companies (most people will only ever have one, so it just redirects for them) you get to the dashboard.

Moved the static data out of its own sqlite DB and into a proper migrated database, which makes change management and deployment a lot easier.

Sorted out a deployment strategy, at least for now.

Sorted out blogs and static pages

Redesigned the login pages a bit.

Fixed the “I see no ships” bug.

Implemented Feedback tab via Uservoice

Fixed a couple of security issues

Experienced 01:59 twice in just over an hour (GMT ftw)

Next up: Ticks & Missions, I guess. Should probably sleep first, now my neighbours are partying less hard.

Happy Halloween, crew.

Status

Okay, so we have pirates, ships, logins, companies and authentication done.

This is The Plan:

  1. Maps Contain Towns
  2. Ship Classes
  3. Ship Graphics
  4. Mission Graphics
  5. Mission Architecture
  6. Ticks 
  7. Potter Missions (Ability to go out and find new places to Scourge)
  8. Scourge Missions (ability to go out and earn loot)
  9. Admin Missions (pseudo-missions to do things like share loot and reelect captains)
  10. Share Loot. Make Pirates Happy.
  11. Pirates Less Happy Over Time
  12. Deployment
  13. Release Stab One

This is The Continuation:

  1. Text cleanup and first pass at signup flow tutorial
  2. Spivak Pirates
  3. Tick Countdown
  4. Release Stab Two

And then

  1. Assign Pirates to Research
  2. Origins
  3. Research
  4. Stab Three

Eventually

  1. Dynamic Towns Part Two: Revenge of the Fripperizers
  2. Dynamic Towns Part Three: Electric Buildingoh
  3. Dynamic Towns Part Four: Haylp, Heylp.
  4. Levelled Ships, Hands-Off PVP
  5. Map View
  6. Foreign Powers
  7. Mark’s Alphabet
  8. Company Logos
  9. Cannonball Run
  10. Honest Traders
  11. Playing Cards
  12. Skynet
  13. Twitter Integration
  14. Facebook Integration
  15. Get Paid
  16. Pirate Party
  17. We Wants A Training Day
  18. TLAPD