Showing posts from February, 2009

Custom Camera

Alright folks here is the deal. I'm now realizing that I need to create a custom camera. There are a few things that I need to add that are not available to me in the fps camera.

A few of which are as follows.
Right click to look(critical for gui usage),
OpenAL listener location updating,
and reporting movement to the server via my client class.

I was thinking of a proxy class but me guess is that I would need to implement some of the functionality again anyway. So that would be overhead with little benefit.

I may just encapsulate the listener object in the camera that way it all gets cleaned up at the same time. Right now I'm just creating and disposing in the application class.

I'm probably going to do the same for the animated mesh node but I may just create a proxy class for those. Mainly because in that case I'm just catching some data sent to it and updating the sound source. I can also easily create a reference to each one of these if I'm using a custom fun…


Alright so I was just thinking about titles. Most games use them to show off achievements but I was thinking of using it as a role indicator.

Let me explain. Most online role playing games have some sort of class system. In that class system there are certain assumptions you can make about a player based on their class. For one you can tell there archetype(Healer,Tank,DPS, other support).

In a classes less environment like the one I have in mind for my game there is no way to extract this information without getting to know a player. And while there are advantages to that I want people to be able to pick up and play. Sometimes the best way to make new in game friends is to do a mission with them and realize that their play style meshes well with your own.

So, my solution to this problem is a title system where your most used skills give you a title.
I already need to give skills a general category for the AI I talked about in my last post to work correctly. So I just need to have a title …


I have been thinking about the AI in my game. I was sort of hoping I would find a sweet open source AI library that would cleanly tie into my server and handle it all for me. Well it looks like that isn't going to happen. OpenAI has not been touched since 2001 and I could not find any other AI libraries that sounded promising.

So, how am I going to take care of this? Well I'm thinking just a simple bit of code in my not yet created AI manager.

Some thing like if below 60% health heal(50% chance). If surrounded by 3 or more enemies use AOE if exists(50% chance). If not opponent is above 90% use curse skill if exists(50% chance). If no curse skill or isn't below 90% use single target attack(100%).

Above when I refer to curse I'm talking about damage over time as well.

That should be enough to make it work for the most part. I may refine it later but I think that is enough to give players a bit of challenge.

By the way the above could probably be handled with an unbalanced btr…

cast confession.

Alright, so I have a small confession to make. Prior to working on this project I have always used the old c style casting method in c++. As a matter of fact I didn't know there was another way. Sad I know but I didn't use it in college and all the example code I looked at while I was learning c++ used the old method.

Now that I have seen it though I only use the new method. The reason's for this are numerous. One simply being it is easier to read. The other is that the dynamic version allows type checking. Which is nice if you don't have any guarantee that your getting the correct type.

Also it is way easier to do a find for casts of an unknown type. I mean what are you gonna search for "("? So I thought I would post this little bit of information and maybe save someone else some hassle.

Combatant locator.

Alright, so the way I'm identifying which character to which a packet corresponds is as follow.

I have a set that contains a pair consisting of a character locater pointer & an enet peer pointer. Now enet creates and maintains the peers which is why I only need a pointer too them. The character locator on the other hand is managed in my code. It is created when a client connects and deleted/deallocated/disposed/freed/(insert favored cleanup term) when the client disconnects. Each peer object has a void pointer which I use to store the pointer to my combatant locator.

The combatant locator contains the map and character index which allows quick access to the exact character without needed to know the exact memory location. Part of the reason for this is that combatants & maps will be in stl containers which may stuffle things around when they grow or shrink. So using an index is the safest way.

Now when a packet is recieved I create a new instance of Message which is a union …

SDL events & the problems they solve

As I was working on the server network logic I realised I hadn't developed a method of message passing in a thread safe way. I'm spoiled with the thread safety in languages like c#. However in c++ thread safety isn't quite as common.

Now some of you are wondering why use threads at all. Well there are at least a couple instances where I will need them.

One is damage over time effects. I need damage to be added every tick which I'm thinking should be once a second. The other way to do this would be to have it tick when it gets the chance and add damage based on the time since the last tick not fixed damage.

The other is the network polling. I want to have as little latency as possible. I plan on my mmorpg being real time and latency is very annoying in any real time game. Now multi-threading won't help the connection the server or clients are running on but it will reduce the about of latency resulting from the protocol and code needed to handle it. I should be able to…

poison at last.

So after my last post I realized that I didn't need anything special to handle poison damage. I just needed more types that are poison. I divided poison up by poison sources. I thought mostly of organic poison sources such as spiders, snakes, and toads. However I did include an acid type and a generic for odd types that pop up later.

The acid type I'm not completely sure I want to be resistible but I need it to be a type for creates that are immune like a creature made of acid or something.

Now there is a way to apply poison damage and resist it. The missing piece now is damage over time but I plan to implement that in such a way that any damage type can be used. That way I can do things like curses & burning effects.

I also need aoe stuff but I think I may just implement that inside of the skill functions. Possibly select targets in a radius around the source or a single target depending on how the skill works.

No Poison yet

Alright so I have not implemented anyway to resist poison. There is a base poison damage type but to be honest I need a poison subtype or more likely at this point different poison types. For example DAMAGE_TYPE_POISON_SPIDER or something. The reason is that immunity/resistance to one poison type should not protect you from all poison.

Most games completely wiff that concept and make poison just like any other damage type. I'm going to need a good chunk of time to implement such a thing though so I plan to wait until after I can at least walk around in my game world.

I'm afraid if I spend too much time on state management I will get bored and give up before I get any visible results. I want this project to last and not end up another unfinished for fun project.

On the other hand state management and combat calculations are easy for me so it is easy to get into a groove of sorts where I just work on that neglecting the pieces that make it work just as server /client interaction.



I changed my mind a little on how I'm going to handle the combat logic. I was going to have the functions built into the various entity classes. But now I have moved them into the newly created CombatManager class. This class as the single purpose of coupling all of the combat functionality. It knows how to apply damage for example to each type of entity currently in the system.

More than likely it will also have a standard function that can be called to invoke skills. This is needed because skills will be invoked my id not specific function calls. right now I"m thinking a skill id will come over the wire. The server will validate that the user has that skill and then it will pass that number along with source & target information to a generic function. Which will intern pass that information to a dedicated function for each skill. Unless the id is a scripted function in which case the script would need to be loaded and executed.

I'm not going to worry about the scripte…


Alright so as I'm writing the state management code for combatants I made the decision to use size_t for my constants that correspond to the index in the attribute array for which the name of the constant corresponds.

Part of the reason was simply that size_t was used by vector which I'm using to store attributes. Another reason is that my research into size_t reveled it guarantees at least 32bit but is actually the word size of the architecture if it is in fact larger than 32bit. So by using this I'm insuring the portability of my code while still guaranteeing I have enough room to index all of the elements in my attribute arrays. So in short although I don't plan on using more than a handfull of static attributes once I add functionality for attaching attributes dynamically from scripts for example I will have plenty of space to grow specially if the server happens to be 64bit.

I also created a typedef of size_t called Attribute for use as values for the attributes of…


So I started working on the server for my mmorpg. I was going to document more on my website before I started on it but there are some cases where I work better when I coding. This isn't normally good practice but I have the basic game mechanics down and a few items. The quests and such should not be hard coded so that won't be that big of a deal.

I'm still thinking about how I want to handle statuses though. I'm talking about things like slowed, stunned, and frozen. The most streamlined way would be to put it in the attributes. But that only allows one value to be stored with each status. The problem is most statuses will have an effect strength and duration.

I'm thinking about doing away with the duration. Making stun for example fixed in length so it is more like a flinch. That will keep people from getting permanently stunned which is irritating.

Also things like slow would require a removal skill or item. This may not go over to well with some players but it make…