Friday, December 19, 2008

MMORPG Day 2

On day two of my MMORPG development I got bored of the working on the 3D engine so I started working on the character class. I thought it would be something easy and useful to do. I will go back to the 3D Engine later, for now it displays only one model in a relativity slow speed.

The character class started out easy, I just created variables which would store the characters data. These variables where:

- Name (of character)
- Position (Map Name)
- Position (X & Y)
- Action (ex. Walking, Sleeping...)
- Frame Number (frame of action)
- Logged On (yes/no)
- Chat (what the player is saying right now)
- Look (how he looks, what the player is wearing)
- Inventory (items the player is carrying)

I ran into some problems with the Look and Inventory. For the Inventory I decided an array of the class Item would do just fine. I will work on the Item class later on but for now it doesn't even exist. For the look I decided an array of numbers would do. Each number would represent one aspect of the characters look. For example:

1. Hair Style (1=Bald, 2=Punk, 3=Mohawk, 4=Normal)
2. Hair Colour (1=Blue, 2=Red, 3=Green)
3. Skin Colour (1=Blue, 2=Normal, 3=White)
4. Hat/Helmet (1= none, 2=gold helmet)
5. etc. etc. etc.

After creating the variables I went to work on the methods. The first and simplest method I created was toString. This method simply took all the variable and turned them into one string. The second method was fromString. This method took all the variables from a String. These two methods will hopefully help me later with the networking of the game.

The method I'm currently working on is the createModel method. It's supposed to take all the numbers from the number array Look and turn them into a 3D model for the 3D engine to display. I'm thinking about having a 3D file for each number of an aspect (ex. hair, skin, hat) and then just simply loading them and piecing them together. I'm not sure yet if that will work but I hope so.

Once I have that method finished I just need to create the item class and my character class will be finished.

No comments: