Click here for demo 5
Just a little disclaimer, I'm still not very good handling those videos. The "lag" you see is a result of this.
In this demo, you'll see better movement handling (because of point and click), skill training, crafting and how players can have a house.
For this demo I created 2 NPCs. Bob is a merchant selling houses, wood and iron. Jack is a skills trainer.
This demo shows Dak learning how to craft a small chest, buying wood and iron, craft his chest then buy a house and place his brand new chest inside his house. You'll even get a small glimpse at the guild interface but that's just a misclick from me...
You'll notice that the interface doesn't always react correctly (like on the first try to craft the chest, the first wood wasn't added correctly) but I'm still satisfied with it's current state considering it's still pre-alpha. I was expecting much more problems or glitches than that.
And don't worry, those horrible colors are just there to make it easier to spot different zones while testing. Like the red zones all around the play zone are used to move the character to adjacent zones.
Hope you'll enjoy this demo!
Saturday, December 15, 2007
MMO Demo 5 - Skill training, crafting, player housing
Sunday, November 4, 2007
Demo 4 - A first look at the real interface
It took a lot of work to come up with this first version of the real interface. I had to deal with a lot of performance issues and javascript voodoo magic. Yep, the more I'm working on this, the more I realize how powerful javascript is and how you really have to be careful how you put everything together. It doesn't take much to get something sluggish.
First, some warning about the video. I'm still trying to come up with optimum settings for Wink and I'm not very successful. The speed at which the characters are moving in the video is actually faster than it really is.
However, the "lag" you see when the screen load (NPCs suddenly changing places) is somehow normal. I added a check on characters positions when a zone load. The reason is that between the time the zone loads and the first events received by the server, some events are missed by the client so the characters are not shown where they should really be. With this check, I make sure the characters are all at the right position.
In the prototype, avatar animations were done using animated gif. Of course, it was only temporarily. Now, avatar animations uses sprites. You can see how it's done here: http://demo.rexsong.com/200705/Sprite_Animation
Here's a sample sheet
This sheet only includes the walking animation. The actual final sheet will include more stuff for things as melee and range attack.
All avatars are created using Charas Project (zoomed at 225%).
There's actually no new functions in this demo. It's only showing the code of the real interface in action. It also reveals the dimension I will use for the game, grids of 20x10 with cells of 48x48 pixels.
So here it is: demo 4
Saturday, October 6, 2007
Demo 3 : It's alive! Basic NPC AI, A* pathfinding
When I wanted to add some basic AI to NPCs, I add no idea how to start. Hopefully, many people before me had already think of it all.
I first started to elaborate the controller class that would become the "brain" of each NPC. I knew I needed some kind of loop and a way to decide what action a NPC is to perform. From there, I built a really basic action called "random move" which really only do what it is named after, move randomly without any purpose. That was a start.
What if I attack this NPC? I want him to follow me and attack if he's range. But how does he get around those buildings? Didn't took long before I concluded I was lacking some basic knowledge on the subject. I then asked Uncle Google.
I found many resource and was lucky enough to find some code in C# to help me understand. Here's some link:
http://www.codeproject.com/cs/algorithms/PathFinderLibrary.asp
http://www.codeproject.com/cs/algorithms/PathFinder.asp
http://www.gamedev.net/reference/articles/article2003.asp
I'm using a very basic A* algorithm that should be good enough for what I want to achieve which is allowing a NPC to follow a target around buildings and other objects. With the tutorials I read, it was easy enough to come to a result. In fact, the hardest part was to remove diagonal movement that for some reason, I've been unable to remove the way it should have been done. Having spent enough time already on this, I simply removed the diagonal coordinates from the coordinates available (instead of raising the cost for diagonal like it should have worked). It shouldn't bring any problem. Anyway, all the pathfinding code is isolated so it's really just a matter of recompiling a DLL if I want to improve it one day.
I'm quite happy with the final result but I feel I'll have to revisit this, performance wise. For now, each "non-static" NPC is running it's AI in it's own thread. When the server starts, each AI is started separately and is independent. In the long run, if I end up with lot of NPCs, I think this might cause some problems.
I don't quite know what is the usual way to deal with this but another way to do this would be to have 1 thread per zone. Each zone is responsible for the NPCs in it and the thread is looping through all NPC. Do NPC 1 action, do NPC 2 action, .... , returns to NPC 1...
Again, the code would have to be optimized to make sure a NPC isn't waiting for another one. The advantage of having each NPC in it's own thread is that it's easy to set cool down time for each action and making sure it is exactly as expected. The commoner in the demo have a cool down time of 1.5 seconds between each moves and attacks. So what's happening is that I let the NPC do whatever action he is currently doing than set the thread to sleep for X seconds, which is the cool down time of the action that have been performed, then function calls back itself to check for next action.
So here's the link to the demo:
Demo 3
Monday, September 3, 2007
Demo 2 - Combat, improved prototype interface
I finally decided to put some more time on the interface. Even if it's just a prototype and that I will probably throw away a lot of that code, it just make things a lot easier to explain and more enjoyable.
I used graphics from Lost Garden here. Really nice set that gives a sense of life to these lines of code I'm writing. And since I decided to put an online diary of my project, I figured that putting up something decent is still the best way to show that I'm not just throwing ideas on the web. Ideas are cheap and many people have good ideas.
It's still using only Javascript and animated GIF. I'm using Script.aculo.us for the movement animation. As a reminder, the server-side is ASP.NET web services sending JSON data to the client.
About the demo, I'm showing in this one the combat system. It's quite basic in fact: Target something, use a skill, the server check if the target is compatible with the skill used and a result is produced. The distance between the target and the PC is also checked to make sure the PC is within range of using the skill (different skills can have different range). The same system will be used for any skill (like lockpicking a door for example).
In this demo, Dak (PC) is attacking a NPC. The NPC is currently not replying to attacks but I could have done the same demo with Dak attacking another PC. Some kind of basic intelligence for NPC is something I'm planning but there's still more work to do before that.
There's currently 2 skills implemented: Punch and Basic Weapon Melee Attack. With those 2 skills, I added the system allowing a PC to equip a prop. The prop can be a weapon or anything else allowed to be equipped at the desired slot. There's currently only one slot, the one for the prop the PC have in his hands. More can be easily added. The interface to equip the PC is yet to come.
By default, Dak have no weapon equipped. He's allowed to only use the Punch skill. Once he picks his sword, he's not able to use it anymore but now can use the Basic Weapon Melee Attack.
The next thing I will be working on will be to make sure I can build the inside of a building. The tavern currently existing will be used for this. Currently, the inside of the tavern just look like any other zone with props in it. I'll have to make sure I can put walls in there to have something that looks like this.
After this, well, I'll see. I'm trying to cover only the most familiar systems we see in games while keeping them basic for now (next milestones will be PC to PC trading, basic guild system and some kind of interaction with NPCs). My goal is to have something opening me enough opportunities without going too far in each systems. I'm only building a framework for now so I need to focus on it without falling into systems specific to a game.
Here's the link to the demo : Demo 2
Hope you'll enjoy this new demo. As always, comments are welcome!