Hi, I'm making an online rpg using mooclick, all the basic stuff like players and chat is already working with no problems.
My problem is how can I make monsters that are synchronized on all of the clients.
What I'm not sure is where the monster data (position ,hp ,etc..) should be held and should server manage that?
Should the server send the data to all players about where the monsters are, in that case the server would move monsters (like simulation) and clients would just update their location and data.
I couldn't find anything about monsters in mmorpg architecture in the internet and this forum as well. If anyone knows how this should be done and have time to help me, please reply. thx
You'd have to build some sort of server application that would keep track of all enemies in each area, and send the data to all connected clients. This means that you'd have to either set up your own server, or ask the owner of your current server to install your server application on their machine.
But there are other ways to do this, for example having each client store some enemy data locally, sending their data around to other players. The problem with this system is that if there are no players, there can't be no enemies either, unless you save enemy data on the server each time all players leave an area.
Both methods cost a lot of bandwidth though, as lots of enemy data has to constantly be sent to all players to keep the enemies in sync.
Thanks for help axel, I think the first way is better, but I'm not sure how to store monster data, should that data (id,X,Y,hp,etc) be inside some 2d array in the server? then server would generate movement by changing the data inside that array and send that to player. But this way it is bit complicated. I can’t think of any other way.
This is a bit ahead of my 'things to think about' in my own personal MMO (yes, everyone has a MMO these days ). I'm assuming you're going with the server idea, which to me sounds more appealing. Working out a server is a problem that comes on later, for now you could simply just beta-test locally which you probably are already thinking of doing. Here is my suggestion and ideal for my own mmo:
Array Object - The 2D Array is upon start of level 'loaded' with all the necessary values for X and Y positions. For example you could load value 1 in a X and Y position, which we will assume to be a monster.
INI Object - This object contains all the actual variables for your NPC's (environment aswell for me to change animations). With this you could create an INI Object that contains the following:
That's exactly how the data is stored in an INI File, and as you can see all these groups (groups are the [] ones) are individiuals in-game. Checking all these objects and sending them would be very messy, but if we stored values for what monster that is at what X and Y position in the Array Object, that would work as a shortcut to the monsters in the INI Files (for example if the String was "Monster1" on X250,Y24, it would refer to Monster1 in the INI Object). Sadly I don't think I got the message through to you as it is slightly complicated (at least for me), but this is how I'm doing most of my stuff, and it's been working pretty well sofar.
Great I'll get to work and try it .
Thanks for the help everyone.
While making maps should every map be a different channel (like forest is "channel1", town "channel2"?
I also noticed that if I send a long string via "server message to all" it makes the server crash, anyone had that problem before?
1-Depends if you want people to still be able to chat with eachother even when on dierent maps then make them have the same channel.
2-Send two server messages instead of one he can handle that, I think...
Don't use server messages. Just use Player -> Channel -> Send text on channel. It will automatically send the message to all players in the current channel.
Hmm, then the server is just another player, because of the server message bug I use it like that, anyway if a player is connected to more then one channel is it possible to choose on what channel to send text or to send it to every channel that you are connected to?