Step by Step Help for Absolute Beginners

Post here all your questions related with SmartFoxServer .Net/Unity3D API

Moderators: Lapo, Bax

maddy
Posts: 8
Joined: 26 Jul 2010, 09:08

Step by Step Help for Absolute Beginners

Postby maddy » 26 Jul 2010, 09:15

I've been working on a game using XNA Framework. And i reached a junction where i need multiplayer support.
And im a complete newbie wrt to Networking and stuff....

Please help me in setting up the basic stuff, so that i can integrate the multiplayer support to my game.
I have seen the document section which i found in the downloaded folder, as well as some other online sites, ...... honestly it has not helped me much (no offence to anyone) ... as i've mentioned, im a complete newbie wrt to multiplayer stuff., so please bear with my queries below. I would love to compile all this as a tutorial for the newbies like me for the XNA community , if i can gather enough info to start with, so i seek your help in this regard. Now to the queries ....


What currently we are able to do with the current help ...
1. Installed SFS Basic .... and i've started the server ....


Now, what i need to understand and be able to do is this
1. Setup a server side script in c# ... from within an XNA project ...( its fine if i have to create this part as a seperate dll project, as long as i can reference it from within XNA game )
    a. what this script should be able to do is, when ever the client sends a request (client sends a number, and a string). String points to the function() listed in the script, and the number is sent as a parameter to that function, the result that comes from the function is sent back to the client.
    In the current case, i would like to see, the server be able to double the number the client sends.

    Server Side Code
    OnInitialize() { ... }
    OnDestroy() { ... }
    On_Recieved_A_Client_Request(string request, int number )
    {

    if(request == "DoubleTheNumber")
    {

    requestedClient.SendBackResult( number * 2 );
    }
    }

i would also like to see the server to be able to continously broadcast to all the clients some information ,
ex : say the server is continously trying to update all the clients with current time ....
So, how do we do that, is there a Update() loop of some sort predefined? if not, how do we handle it?


Now, once i've written such a code, how do i deploy this in the server ...... a local server where i can test using the free version., and i should be able to move it to production server without any difficulties at a later time.
Do, i have to compile the server side code into a dll or something, or do i just copy the above c# file somewhere in the server? ......... in anycase, how to do it., step by step?

Ok, say now we deployed the server app, that does the above tasks, now how about calling it from within XNA ......
    1 ........ what all references do i need to add to the project? (currently im using XNA 3.1 ...)
    2. Once the references are added, ...... do we need to setup any login information into the server? or can we connect to it just by calling connect or something ....
    In Any case, how to do that in C# , in XNA ?

    3. Once such setup is done, i would like to call the below functionality within the game ....

    ex: CLient side code ....
    int number = 10;
    within XNA's Update() loop ......
    {
    number = server.sendRequest( "DoubleTheNumber", number);
    print 'number' to the screen in beautiful colours;
    }

............................................................

Please help as much as you can, if you can provide the actual steps ......... pls dont just say read the documents, or google it. Thanks for understanding.Also, is there a online chat option for us aswell? ..... coz explaining and asking these questions can be daunting for both people like me, and also for the gurus who would want to answer these queries ?

thanks in advance :)
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 26 Jul 2010, 16:21

There are loooots of questions in your post. Some of them are truly "read the documentation" ones, so even though you dont want those messages - go read the documentation ;-)

Personally I believe in a learning-by-doing thing. Thus I wont help you too far.

Here are some more constructive answers to some of your questions

* Some of the things you are trying to do - especially server side code - requires SFS Pro version. So use that if you require server side code (called extensions in SFS language)

* Server side extensions are coded in java or AS3 or python. You cannot make extensions in C#

* There are 4 Unity example projects that are coded in C#. 3 of those are in the API download. The last one (island demo) is most likely way to advanced at this point in time for you. Check out the C# scripts in the Assets/Game/Scripts folder - I'm pretty sure they will help you along a lot.

* There is a simple console example here - viewtopic.php?t=4255

Good luck!!!

/Thomas
maddy
Posts: 8
Joined: 26 Jul 2010, 09:08

Postby maddy » 26 Jul 2010, 17:29

ohhh ...

is that so .... cool .... thanks anyways.

I;ve started looking in the meanwhile on WCF .... and i was able to Create a server, host it and write a server side app and deploy in it ....
and able to communicate with it with a client ..

So, i guess i'll pass on SFS Pro for now ......

I do agree reading document might help some pros who have already some knowledge about things .... And i indeed read the docs, and definitely tried some examples, ........ most of the trials ended with wierd errors ....... so was looking for professional help .... but, me being a beginner, this was too daunting task, just to launch a server and do minimalist tasks ....

I found the WCF tutorials, more straight forward and easy to follow .... i wished something of that sort, could exist for SFS! ...

anyways, ...... i appreciate ur response ....
now i definitely need not consider SFS anymore :)
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 27 Jul 2010, 06:17

Ohhh - I'm pretty sure you will end up with a "real" server solution sooner or later :-)

SFS is sooooo much more than a simple TCP socket server. But starting off on your own will teach you hands on why you want to let others take care of the server infrastructure framework :-)

E.g. how are you going to scale beyond a single machine? Database connectivity? Network security?

But good luck out there, and you are always more than welcome to come back

/Thomas
maddy
Posts: 8
Joined: 26 Jul 2010, 09:08

Postby maddy » 27 Jul 2010, 06:40

I would love to let the professional handle the server stuff for me if i have the choice ....

But the way the help is provided up until now, i have no option but to look for other options ......... and the WCF tutorials will get me atleast somewhere, coz they are very easy to understand and implement ....

Im finding it hard to follow the SFS and XNA integration, thats the first reason why i started my post here...

So, if you can answer any of my queries., .... please i wouldlove to come back to a real powerfull server.

Return to “.Net / Unity3D API”

Who is online

Users browsing this forum: No registered users and 29 guests