Map Format
We now have the maps terrain mesh figured out partially.
VIDEO HERE: http://youtu.be/FX1b2OpoCFEManaged to read in the WM file for map 001 Gungsong Fortress and export its Vertex's and Faces.
This is important to be able to know that we can work out the walkable areas on the map. Turns out they are everything you see there. Any gaps are non walkable. The formats basicaly a whole heap of points that make up triangles.
We have some people working on getting monster and npc spawns if you can help, please fill out the form in the previous post.
New AI Manager
Have been working on a new AI Manager which will allow us to script the monsters to do whatever we want. It is simple to use.
Example of some code:
var TestAICollection = new AIModule.AICollection();
TestAICollection.Make('AIOne',function(deltaTime) {
console.log('AI One executed, object has been alive for '+this.getAliveTime());
console.log('Simulating damaging monsters around me');
var that = this;
Objects.Search({nodeID: this.ID, type: TestAIObject, distance: 10}, function(distance,node) {
this.Damage(that.ID,20);
});
return { Meta: { Count: 0 }, AI: TestAICollection.Get('AITwo') };
},1000);
We can also keep track of attackers and how much damage they did, to either monster, character, npc.
Console log of the AI test:
AI One executed, object has been alive for 1000.0001939928201
Simulating damaging monsters around me
I have been damaged for 20 by 0 my health is now 80
AI One executed, object has been alive for 2005.0004060170625
Simulating damaging monsters around me
I have been damaged for 20 by 0 my health is now 60
AI One executed, object has been alive for 3010.000294819342
Simulating damaging monsters around me
I have been damaged for 20 by 0 my health is now 40
AI One executed, object has been alive for 4015.000405609906
Simulating damaging monsters around me
I have been damaged for 20 by 0 my health is now 20
AI One executed, object has been alive for 5020.000466362819
Simulating damaging monsters around me
I have been damaged for 20 by 0 my health is now 0
I am Dead
The objectID 0 did the most damage at 100
AI One executed, object has been alive for 6025.000845119293
Simulating damaging monsters around me
Respawning because dead in 2 sec
AI One executed, object has been alive for 7030.00036887993
Simulating damaging monsters around me
I have finished respawning come at me bro!
AI: Stand is not yet implemented.
New way to store query / access entitys in the Zone
As seen above by Objects.Search we can now store and query for objects in a much better way then we could previously. This enables better preformance on the server. *Previously it was lagging a lot*.
We hope to implement a Quadtree into our collection here is an example of one working:
http://www.mikechambers.com/blog/2011/03/21/javascript-quadtree-implementation/Why would we use a Quadtree over an Octree? Well the games basicaly 2D if you look at it top down.
Monsters might agro a certian radius from their centerpoint. 3D Events that happen are sent to every character/client in a distance of 400 units from the origin point. The maps are pretty flat. By that I mean theres no parts that you can walk below and above on. Your always on one mesh as seen above.
For monster movement, we may look at implementing the A* search for path finding.
http://en.wikipedia.org/wiki/A*_search_algorithm we would have to pass it the walkable areas from the WM and it could find the quickest route to a player. This would allow monsters to solve mazes to get to their target, providing they are within distance to chase it still. We would have to tweek everything so its fair.
Improving packet reading
Packet reading is currently flawed, if multiple packets are received in one recive then the other ones after the first are discarded, this is wrong. I am recoding it to keep a cached buffer and to process packets as the data meets the correct size for a correct packet id. Along with this our packets can have documentation generated from them showing their data structure and code that they execute when received.
Node.js is quite nice.
Restruct seems to be slow however, there are other librarys for binary<->json serialization and deseralization such as
https://github.com/codeboost/binaryparser/ however I may just code my own on top of Node.js's buffer class since it has ReadUint and every other data type I need.
Good News
After all these core changes are put in place and working we can implement working monsters/fighting.
Whens the server open for testing?Well not for a while still as we are not able to consider it playable or testable.