Some help in monster spawning and loading on 5165 impulse

11/01/2012 14:42 mujake#1
Hello, I've recently started playing around with an 5165 impulse, it has no monster loading and spawning so I've chosen to implement the one used in Virtual legends, after I've added the loading option and I added the tables in database I added the Monster.cs with suppose to spawn them intro the world, but it wont I am aware that i might done something wrong along the way as there were some dependencies that I couldn't match here is what i edited in Monster.cs:

this

public static void Spawn(Receivers.ClientState client, ushort mesh)

with this

public static void Spawn(Client.GameState client, ushort mesh)

I am looking for you advices.The item drops i have not added yet as my first goal is to spawn at least one monster first.
11/02/2012 02:32 .Ryu#2
Quote:
Originally Posted by mujake View Post
Hello, I've recently started playing around with an 5165 impulse, it has no monster loading and spawning so I've chosen to implement the one used in Virtual legends, after I've added the loading option and I added the tables in database I added the Monster.cs with suppose to spawn them intro the world, but it wont I am aware that i might done something wrong along the way as there were some dependencies that I couldn't match here is what i edited in Monster.cs:

this

public static void Spawn(Receivers.ClientState client, ushort mesh)

with this

public static void Spawn(Client.GameState client, ushort mesh)

I am looking for you advices.The item drops i have not added yet as my first goal is to spawn at least one monster first.
The one in Virtual Legends is of a higher patch isn't it?
11/02/2012 06:23 mujake#3
yes,but i don't just copy paste the text and files.Like monster.cs the only error is the one i mentioned above.in monster table there are few problems regarding monster drop and drop rate, but i can fix them easily.there are errors regarding some undefined things in kernel.cs and program.cs. The things defined in program i can't find there match on the later patch.Like receivers...it is an cs but it is and different type of coding
11/02/2012 22:45 pro4never#4
Don't try copying an entire system from another source... especially when they are as intricately tied to the base functionality as the monster system.

Here's the steps for a basic monster system (functions similarly in every source I've seen)

Reference to monster types

-Generally a static collection loaded from database on runtime.
-Contains statistics of each 'type' of monster (health, mesh, name, attack, defense, droprules, etc)

Reference to spawns

-Generally a static collection or by map collection of all spawns of monsters
-Contains statistics concerning location, number and type of monsters, spawn rate, etc
-Some reference to individual monsters

Reference to individual monsters

-Generally inherited from the entity class and referenced in the spawn class so they can be controlled on a 'by spawn basis' (lets to operate only on spawns where players are nearby/on the map, etc)



Now... When you load the server you need to populate the monster types and spawns from database/flatfile. This is quite simple and just a mater of reading the information and creating new objects in memory.


Map system

How you organize this is all up to you honestly. You could have a reference to spawns in your map, or simply insert your monsters into the map objects collection. Personally I would organize it like..

Map>Spawns>Monsters (reference to the same object as is in the objects collection of the map)
Map>ILocatableObjects (anything that can be viewed in game space. Monsters, players, items, npcs, etc)


Now... when a monster is spawned, it is added to the objects collection of the map. This means it is now viewable by players

When a monster is killed, it's still stored in the spawn collection (there are more efficient ways, I'm using a simple example here). When respawned you can heal it up, moved to a random, valid location within the spawn radius and re-added to the visible objects collection of the map.


Displaying the monster to players

Any time your client moves by jumping, walking, teleporting (loging in counts as teleporting) you need to update what is nearby (removing objects no longer on your screen and adding ones that are now visible).

Any time an object is added to this, you need to send a valid spawn packet in order for the client to see it. You need to alter your screen method so that all of these steps also apply to monsters. If not, you will see nothing.





best of luck!
11/03/2012 07:30 mujake#5
yes, i added the database loading and i am having trouble to spawn them and with send scree, as the newer source has some more thing defined and some classes added witch original hasn't