Hello everyone. I'm new to this forum and SmartFox as well, so sorry for nooby question
I've already downloaded the MMO and FPS examples and tested them for a little bit. Everything seemed understandable to me, but until I wanted to add a simple Health Variable and attach it to the player. As I can see in FPS example, all player variables are made on a server side by CombatPlayer "simulation", but in MMO example such variables as material, model, location coordinates of player are containing on the client, if I understood everything correctly. As I suggested, it is because MMO example uses the AOI system, but I might be wrong.
So my question is: How to correctly add a variables such as mana and hp to player for a MMORPG?
[SOLVED]MMO Player Variables
[SOLVED]MMO Player Variables
Last edited by OhMyOhmit on 06 May 2018, 11:37, edited 1 time in total.
Re: MMO Player Variables
Hi,
you can set variables for Players or Rooms from both client and server side.
To a degree it doesn't matter which side you use.
It might matter a bit in terms of security, if certain variables need to be controlled by the server side logic and could be hacked then creating them from server side would be better but, other than that, client or server is the same.
There is however one exception, which is MMOItems. MMOItems represent objects in a virtual world (could be anything: collectibles, health potions, door triggers ...). These objects can also be customized with multiple properties (MMOItemVariables) and they must be created from server side.
If you want to learn more I'd highly recommend these articles from our docs:
http://docs2x.smartfoxserver.com/Advanc ... /mmo-rooms
http://docs2x.smartfoxserver.com/Advanc ... ed-mmo-api
If there's any other questions let us know.
Cheers
you can set variables for Players or Rooms from both client and server side.
To a degree it doesn't matter which side you use.
It might matter a bit in terms of security, if certain variables need to be controlled by the server side logic and could be hacked then creating them from server side would be better but, other than that, client or server is the same.
There is however one exception, which is MMOItems. MMOItems represent objects in a virtual world (could be anything: collectibles, health potions, door triggers ...). These objects can also be customized with multiple properties (MMOItemVariables) and they must be created from server side.
If you want to learn more I'd highly recommend these articles from our docs:
http://docs2x.smartfoxserver.com/Advanc ... /mmo-rooms
http://docs2x.smartfoxserver.com/Advanc ... ed-mmo-api
If there's any other questions let us know.
Cheers
Re: MMO Player Variables
Thank you for a reply.
I've read the docs that you've sent to me and many things seems more understandable now. However, I still do not understand how can I add a "health" variable to player I think that I have to add it when player enters the server, but can't find a way to do so.
I've read the docs that you've sent to me and many things seems more understandable now. However, I still do not understand how can I add a "health" variable to player I think that I have to add it when player enters the server, but can't find a way to do so.
Re: MMO Player Variables
Setting a User variable is a matter of 1-2 lines of code.
I would recommend checking the documentation here --> http://docs2x.smartfoxserver.com/Develo ... -variables
You can always search using the search function at the top of the left side menu, if you're not finding what you need.
If you want to set the variable from server side, as soon as the player has logged in I would recommend reading about the server side events under the Java (or Javascript) Extension section.
There you will learn how to create server side code, and how to handle specific server side events so that you can react to them. This includes the login event when a player joins the server.
Take it one step at time, the examples will guide you. It's pretty simple
Cheers
I would recommend checking the documentation here --> http://docs2x.smartfoxserver.com/Develo ... -variables
You can always search using the search function at the top of the left side menu, if you're not finding what you need.
If you want to set the variable from server side, as soon as the player has logged in I would recommend reading about the server side events under the Java (or Javascript) Extension section.
There you will learn how to create server side code, and how to handle specific server side events so that you can react to them. This includes the login event when a player joins the server.
Take it one step at time, the examples will guide you. It's pretty simple
Cheers
Who is online
Users browsing this forum: No registered users and 49 guests