anyone knows of a simple way of sending messages?

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

foxter888
Posts: 78
Joined: 10 Apr 2011, 05:52
Location: united states

anyone knows of a simple way of sending messages?

Postby foxter888 » 26 Sep 2011, 08:34

so far using unity 3d version 3.4.1 i'm able to connect to smartfox all from scratch now my main problem would be learning how to send messages between the server and the client, any way of doint it withouth a extension like a non authorative setup? the fps tutorial doesn't goes in detail very much and class serialization seems pretty hard to understand, i can't manage to make it so the client spawns the player and such.

this is just a simple asteroids game by the way. trying to learn smartfox somehow.
get to work you slacker!!!
User avatar
Bax
Site Admin
Posts: 4481
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 26 Sep 2011, 09:30

Please read the client API documentation. You have a number of Requests you can use to exchange messages among the clients, without the need of an Extension.
Paolo Bax
The SmartFoxServer Team
foxter888
Posts: 78
Joined: 10 Apr 2011, 05:52
Location: united states

Postby foxter888 » 26 Sep 2011, 11:13

i'm a bit confused, so far every one always guides you to the manual, but no help about it. i'm asking here because the manual doesn't seem easy enough to understand and the fps tutorials doesn't seems enough.

so far all i know is that you need isfsobjects to send messages back and forth and class serialization but seems kind of weird to get the concept. so that's why i asked about trying to find somehow a way of making it to where i shouldn't have to code the extension. so far the most i can get is connecting to the zone and the room and of course login but then after that how can i send my transform? spawn and etc? withouth having to make or try to figure out how to make a server world model and such. pretty much i mean that the fps tutorial seems to advanced for me. i'm trying to learn from the ground up. it's hard trying to see both the server code and the unity client code already.
get to work you slacker!!!
foxter888
Posts: 78
Joined: 10 Apr 2011, 05:52
Location: united states

Postby foxter888 » 26 Sep 2011, 11:23

so far the only thing about sending messages are about things like chatting such as public message and the rest is sfsobjectswhich seems to need some kind of extension to work, even the api manual seems a bit empty like it doesn't show examples of usage or anything.

but still i'm just trying to figure out how to send messages back and for between the clients withouth having to use an extension and i don't only mean chatting i mean pretty much having it a non authorative set up at least for learning purposes
get to work you slacker!!!
User avatar
Bax
Site Admin
Posts: 4481
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 26 Sep 2011, 14:26

If you need to send custom data from one client to one or more others, you can use the ObjectMessageRequest from the Sfs2X.Requests namespace (see the API documentation here).
It doesn't require you to create a server-side Extension, or use class serialization (which, by the way, it is mainly used to send custom classes from the client to the server, not from the client to other clients).
Paolo Bax
The SmartFoxServer Team
foxter888
Posts: 78
Joined: 10 Apr 2011, 05:52
Location: united states

Postby foxter888 » 26 Sep 2011, 16:53

A question would be that once I send the object message to the server, how will the clients receive the data? Appreciate the help by the way.
get to work you slacker!!!
foxter888
Posts: 78
Joined: 10 Apr 2011, 05:52
Location: united states

Postby foxter888 » 26 Sep 2011, 17:59

i saw the api about sending object messages, now i need some explanations on the usage, the api seems rather vague, it doesn't even shows the syntax on how to use it, and a question would be how the clients revieve the message?
get to work you slacker!!!
foxter888
Posts: 78
Joined: 10 Apr 2011, 05:52
Location: united states

Postby foxter888 » 26 Sep 2011, 20:16

So far I can get the sintax right since the api for c# doesn't show the full example of how to implement it, I tried looking at the other apis but they are way different from each other, any way you can show me and example of the object message pleas
get to work you slacker!!!
appels
Posts: 464
Joined: 28 Jul 2010, 02:12
Contact:

Postby appels » 27 Sep 2011, 05:29

post what you've got up till now and we'll try to help.
User avatar
Bax
Site Admin
Posts: 4481
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 27 Sep 2011, 05:30

If you take some time to read the documentation at http://docs2x.smartfoxserver.com/ you will have a better understanding of how SFS works.
In particular mani Requests have their counterpart Event. So when you send an ObjectMessageRequest, the other clients will receive a SFSEvent of type OBJECT_MESSAGE. You have to listen to that event and take the appropriate actions.
About the SFSObject instance you have to use to pass data, read this document: http://docs2x.smartfoxserver.com/DevelopmentBasics/sfsobject-sfsarray
Even if examples show a different language, the usage is exactly the same on all the platforms.
Paolo Bax
The SmartFoxServer Team
foxter888
Posts: 78
Joined: 10 Apr 2011, 05:52
Location: united states

Postby foxter888 » 27 Sep 2011, 11:03

That's what I'm trying to explain, I can't get the counterpart working at all
I tried putting a debug on the counter part and i.don't get a return.
get to work you slacker!!!
User avatar
Bax
Site Admin
Posts: 4481
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 28 Sep 2011, 07:18

Are you sure you registered the event listener properly? Maybe you should show the piece of code where you register your listener for the OBJECT_MESSAGE event type.
Paolo Bax
The SmartFoxServer Team
foxter888
Posts: 78
Joined: 10 Apr 2011, 05:52
Location: united states

Postby foxter888 » 28 Sep 2011, 09:08

could you show me the sintax? For c# for both sending and returning?
get to work you slacker!!!
User avatar
Bax
Site Admin
Posts: 4481
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 28 Sep 2011, 09:32

You keep complaining about people telling you to read the doc, but it seems you are not doing it at all!

In the C# API doc, SFSEvent class, OBJECT_MESSAGE field (link to API doc), you have a clear example about handling the mentioned event.

Also, all the examples (starting from the most basic ones up to the FPS tutorial) show that all the requests - just like the ObjectMessageRequest (link to API doc) - must be sent using the SmartFox.send method (link to API doc).

After all it seems there is a reason why we keep telling you to READ THE DOC and check the basic examples provided in the SFS2X package!
Paolo Bax
The SmartFoxServer Team
foxter888
Posts: 78
Joined: 10 Apr 2011, 05:52
Location: united states

Postby foxter888 » 28 Sep 2011, 12:02

Have you ever look at the c# api yourself? Why you think I'm here, asking for help? When someone is going to get that fact?
get to work you slacker!!!

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 4 guests