20150522

Carts and food and spies

So while I was researcing the network possibilities, I gave some thought to the protocol as well. At that point I found out I have insufficient information to continue, as I didn't figure out basic stuff like recruiting units, etc. So I collected my thoughs, and...

...it turns out there are a few questions that need to be considered:

- What should happen if two carts of different teams go to the same tile?

 

Well, my initial thought was destroy both of them and let the food disappear. But it made me uncomfortable, since it was so unrealistic - I mean, what happens there? Does the two cart-driver kill each other? Let's see what other choices do I have. First, I could enable them to just stay next to each other. But that would be a special case in the rendering method, which I would rather avoid. Not to mention it would oblige me to let any two units occupy the same tile, which I'm really against - initially, I wanted that, but it would make fights really complex. Imagine there can be only one unit on a tile, and there is a fight between two units. It is very simple: barbarian beats archers, archer beats knights, knight beats barbarians. If the units of the same type fight, they are both dead. But what if two archers, three barbarians and five knights fight against 3 barbs, 3 archers and 1 knight? Or better: What if 1000 barbs fight against 1 knight? I have spent a few days trying to adjust for these questions, but ultimately it didn't work out. (Of course, in the 1 unit - 1 tile system, the same could happen, but then there would be the possibility of fleeing. It takes time to beat 1000 units for a knight. And it is not based on some hard-coded value. Those I avoid like plague.)

Then I thought about scrapping the carts from the game altogether, with the concept of food. (They seem to be so intertwined I can't have one without the other, no matter how hard I think about it.)  But it would make the game so much about fighting and not so much about good positioning, patience, and things like these. I don't want to make a fighting simulator. I want it to have more strategical depth. My principle is: if the lack of a feature makes it impossible to win without fighting, that feature will stay.

So ultimately I just settled on the disappearing carts. In a world where there are no trees on hills, anything could happen. Like units can't occupy the same kilometre-wide area...

 

 - How much food should a cart start with?

 

I avoid hard-coded values. More specifically, I hate numbers other than 0, 1 and 'n'. in this case, 'n' stands for any number that is a natural result of some well-defined ruleset or equation. Like 3 in the case of rock-paper-scissors. Or 4 in the case of "what is the smallest amount of colors I need to color a 2D map?". In the case of this game, 5 is kind of an 'n' - 3 from RPS-mechanism, 1 from spies (from Art of War), and 1 from the food-system. Arbitrary, but not as much as "let's give this unit 25 HP, and let's give that other unit 47, and it will be almost balanced".

So I didn't want any hard upper cap on food. I didn't want to say "OK, a cart will start with 100 food". Instead, I figured out that when a unit is in town, it should receive 1 food / turn. This means when it is out of town, the town should produce 2 foods / turn. (In this case, 2 is an 'n', because it was a natural result of the equation "1 + unit food needs / turn = amnt of food produced by town / turn".)

Also, when a unit leaves town, you should be able to tell how much food will it carry with itself. This needs playtesting to explore the possibilities.

 

 - Should spies be able to capture carts?

 

After giving it some thought, yes. (Same problem like cart vs cart.)

20150521

Unity WebGL + networking

While thinking about how should I implement networking, I came across a page which compared HTML5 to Unity - it said that Unity is able to export games to HTML5 (using WebGL). Well, I have tested it. I must say it works pretty well.


It needs to be tested if it works on mobile devices, but if it does, I can check compatibility from my to-do list.

I also looked into some of the networking solutions that are available with Unity: Photon, Bolt, Unity Park Suite... (Link to Forum post 1, Link to Forum post 2)

It turned out, if I want to have persistence, matchmaking, and things like that, I would be better off with some web-based technology (like using a web API with PHP on some web hosting), as Photon Cloud and such usually offer rooms for matching without any persistence. Topic needs more research.