In the first video I demonstrated the starter town, avatars, and multiplayer transform sync. In the second video I took things slightly further and included synchronisation of animations.

In this newest installment I do a few things. First, I introduce tab targeting. It is not demonstrated in this video but I can tab between multiple targets ordered by distance. As part of the targeting procedure I change the appearance of the targeted on the client machine from white to green. I also display the name of the character. Finally I display the target’s health in the top right corner of the screen.

Second, I allow for use of the esc key to deselect a target.

Next, I implemented a messenging system (based on the bergzergarcade tutorial #44) on the local client that updated the target’s health bar (and the avatar / prefab’s hp) every time an allowable attack (within 2.5 units, and facing the correct direction) was made on it. Consequent to this I implemented a secondary messaging system to send the information to the server, and tweaked the server code so that the target’s client would have the updated information for their health bar. This is demonstrated in the video by my pitched bridge “battle” where as you can see hit points are being decreased over time on the other screen when I make an attack on one client relative to the other.

Finally, I made a hodgepodge attempt at attack animations. This entailed alteration of the state machine for the thirdpersoncontroller script. The results were not perfect; the entire animation does not play prior to returning to CharacterState.Idle and the animation synchronisation information has not been transferred. These are minor matters to be fixed.

Also another bug which is not shown in the video, was that I haven’t altered my code to allow for the logoff or disconnect of another player, which might cause difficulties. I will deal with this matter prior to the next step in the project, or eventually, anyway.

Learnings from this work were firstly, the DoNotDestroyOnLoad for a gameobject – I found out that all the Start() functions of gameobjects are called even in scenes that have not been loaded yet. I guess the alternative is to use an Awake() function?!, but I found that one of my gameobjects was being initialised and then being destroyed when I loaded the very scene that it was in! – very frustrating. But when I found out what object it was (the health bar) the fix was surprisingly easy.

A second learning was the power of the statemachine in terms of driving object behaviour – this is still something I need to become more adept in.

Thirdly, it was very informative to really examine the workings of the server code, in terms of introducing my own messaging functions to implement health synchronisation / modification consequent to a melee attack.

Next on the agenda, after fixing the bugs:

fix the attack animations

allow for player logoff / dc

These would be:

Allow mouseover target skin modification and mouseclick targeting

Respawning (destroy playerobject & recreate when appropriate)

GameHUD update

Implement NPCs as “SpawnNPC” script managed by the server (don’t want multiple copies of same NPC per client instance!)

Implement inventory for players

Implement “shops” – I probably will not require currency at this stage but just allow them to be storehouses / other inventory screens

Allow for player chat (global)

Then, further afield:

Allow for conversation with NPCs

Monsters

Quests

Advanced HUD (mini-map in top right hand corner)

More trees, buildings, environmental features and places to explore

Leveling system

Character screen

Quest log

Inventory screen

Stat system

Item buff system

Basic missile combat

Basic magic combat

Currency (game) for items from NPCs

Cooperation / group adventuring

Arena zones only for player-player combat (default atm is global)

And in the very distant future (subject to a great deal of change):

Freemium implementation

Special effects for magic / melee

Special moves (melee eg whirlwind, charge)

Special ranged attacks (fireball, lightning, …)

Customised key bindings

Customised blender models and animations …

Anyway I’ll see how I go with this. Very early days as yet. I might well return to the bergzergarcade tutorials if my progress starts to slow considerably. Alternatively there is something to be said for putting this project on hold, and instead looking again at Google App Engine. I have a few ideas there that I’d like to investigate further.

Yes, as per my previous discussion, it is a bit of a shame that I’ve since lost the posts I had here earlier. Alas, the perils of not fully testing deployment / upgrade options on a remote service! Still, the benefits of having this service far outweigh the minor inconveniences caused by the dropping of some data. And I can still remember most of what I posted.

I’ve looked into the concept of taking backups with dotcloud, I’ve made some progress in this regard, but in terms of the whole backup / recovery approach I think I’d much rather keep hard copies on my computer; so that is what I am now doing. Certainly using S3 as a backup mechanism gives me the heebie jeebies, since the cost of something going wrong could be a problem. There are apparently two other approaches that one can take – ftp and ssh. I may see if ssh is doable at some stage.

In terms of the Unity game I’ve been constructing, the links to the videos in question are first video, second video.

In the first video, I demonstrate logging into the Smartfoxserver 2x FPS example deployed to an Amazon EC2 instance using the RightScale overlay. I view this as quite an achievement and feel rightly proud of being able to build the project as it stands in this video, even though the code is not my own. The cost to me of this project was $2 / day, since I deployed on an EC2 small server (I have since decommissioned this, once I had established the utility of the concept). The cost to use RightScale is nothing for up to 5 of these, since they use 300 of what are known as “RightScale Compute Units”. One only starts to get charged in excess of 2000 RCUs. However of course the Amazon instances, or RackSpace, or other service configured with your RightScale account – you have to pay for these.

I kept the default configuration in this example (4 players per game, and a fairly coarse update rate). Boosting the update rate for the server could lead to a more playable experience (ie less apparent latency / “lag” – in addition to the real latency, of course!). As for the server itself, it can support up to 100 connections at a time – more than this requires a licence from SFS (their profit model). Of course, much more than that might well overload a small Amazon EC2 instance regardless.

The second video demonstrates my progress with pulling the technologies used in the first to a project I have been building, following the BergZergArcade RPG tutorials (quite a resource!). It shows two screens logged into a local SFS 2X server running on my machine. In the video I move one of the characters, and, lo and behold, the transform of the character updates on the other screen. I was very happy with that achievement.

The way that a SFS-Unity game works is essentially one runs the client (which may sit in the web folder of the server, and downloads to the machine of a player if run in the browser – or as a standalone executable), and the client speaks to the extension jar sitting in the server (which is written in java). The extension jar handles messaging between player clients. Quite intricate and hard to debug. But very interesting. Certainly if there is a more practical way of managing client / server code snippets and source control I’d be very interested in learning of it.

Regardless, I’ve made a bit of progress narrowing down the issue I’m having with animations not syncing (which is apparent in the second video). Turns out it is an issue with the controller script; I am going to have to rewrite the third person controller script that ships with the standard asset package from javascript to c#. Apparently it is bad practice to mix the two in a single project, and there is a necessity to modify the script slightly to call functions from auxiliary c# classes. After that, I think I’d like to try to knuckle through the problem of targeting another player. Consequent to this I’d like to make mobs for one player the same as mobs for another. Following that I’d like to start working on the basic combat mechanics, damage, pk, mob despawn, respawn, etc.

On a slight tangent I’ve also started looking at structs in C++. I’ve found adapting the neural net struct was useful for dealing with higher dimensional tensors. However this poses problems for anything practical, such as if one wants a mesh of 1000 x 1000 x 1000 with a 3 x 3 tensor, for instance. Not practical to compute. Nonetheless, here is the basic idea:

Then, in main, one simply declares coord_t p(4), or coord_z q(4,4). To set a value one writes

q.z[2].t[3] = value.

However, to reiterate, this turns out to be quite inefficient and impractical. The script will hang at runtime if the arrays are too large – ie there are computability issues. So my next idea is to instead take a page from the existing book and, instead of allowing say a metric to be assigned to each point in a space so I can compute, say, geodesics via the non-uniform geodesic equation, I would instead take a big array (say only for spatial, 250 x 250 x 250), and then take as final array a coarser subarray (say on average 100 x 100 x 100). So that the “twisting” of the metric can be arranged by allowing cells in the x, y, z directions to be identified for intervals from 1 up to 10.

In other words, I would have a uniform base array, and then on top of that array pick out a subset of points, to define a non-uniform array containing metric information. The metric that I had in mind to use as prototype would be the random matrix Rand(0,1) = ((r, r, r), (r, r, r), (r, r, r)), where r = rand(0,1), a function that randomly assigns a value between 0 and 1, provided that the random matrix is non degenerate. And this is to be computed (effectively) point wise. And with the convention that the smaller the value the larger the distance between points should be, and that “infinity” or “1/0” is 10 units.

Anyway something to look into. Evidently I still need to figure out how to represent metric information in terms of construction of non-uniform sub-arrays, but an approximation algorithm certainly seems achievable. And should be computable.

Consequent to this, the idea would be to apply a finite difference equation to the total array, bearing in mind that the subarray would be the points where the output array is to be read off.