Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Networking (tutorial) using SFML and NodeJS  (Read 4966 times)

0 Members and 1 Guest are viewing this topic.

Serapth

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Networking (tutorial) using SFML and NodeJS
« on: February 29, 2012, 03:42:51 am »
I am not sure how many people are interested, but I am putting together a series of posts on using SFML networking using SFML on the client and NodeJS on the server.


In part 1 it covers making a basic socket connection between SFML and NodeJS.

In part 2, it covers sending highscore data to a server.  In this case encoded using JSON and sent via UDP.


The next part will cover actually returning the high scores back to the SFML client ( and possibly to a web page).  

I also intend to cover creating a match making server for peer to peer matches between SFML clients.


Let me know what you think, if you have any suggestions, or of course if you spot any errors.  It uses SFML 1.6 and provides downloadable projects.  Node for those unexposed to it, is a server side platform utilizing Javascript.  By design, it is extremely scalable, something often quite difficult to accomplish with C++ based servers.  Of course, node extensions are written in C++, so you can extend it as needed.  If you haven't locked at Node yet and are doing some server side programming, you really should check it out.

Serapth

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Networking (tutorial) using SFML and NodeJS
« Reply #1 on: March 14, 2012, 06:19:45 pm »
Part 3 is now up.


By the end of this section, you will have a fully function high score server and client, as well as an ultra primitive high score website.  Not exactly production ready code, but it shows you basically everything you need to know to get started.

BlueMagic

  • Newbie
  • *
  • Posts: 49
    • View Profile
Networking (tutorial) using SFML and NodeJS
« Reply #2 on: March 15, 2012, 03:40:28 pm »
Awesome! I'll be starting to read these at night when I get home from classes.
Thanks for taking the time, I've always wanted a simple introduction to the subject.

Chris12

  • Newbie
  • *
  • Posts: 20
    • View Profile
Networking (tutorial) using SFML and NodeJS
« Reply #3 on: March 15, 2012, 04:00:19 pm »
huh, wow this is really cool!

I'll read it in the next days and provide feedback.
Thanks!!

julen26

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
    • http://julen26.blogspot.com
Networking (tutorial) using SFML and NodeJS
« Reply #4 on: March 15, 2012, 05:40:48 pm »
Really useful and interesting.

It's not difficult to create a simple server using directly sockets in C++, but why not minimize this work using a high level language like Javascript? Moreover, it can be extended with C++.

Nice tutorial man, thanks!

Serapth

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Networking (tutorial) using SFML and NodeJS
« Reply #5 on: March 17, 2012, 07:17:42 pm »
Quote from: "julen26"
Really useful and interesting.

It's not difficult to create a simple server using directly sockets in C++, but why not minimize this work using a high level language like Javascript? Moreover, it can be extended with C++.

Nice tutorial man, thanks!



This is true, however making such a server scalable is a heck of a lot trickier in C++.  Nodes callback architecture is pretty slick for this type of thing, you can make things pretty massively parallel with almost no effort on the developers behalf.  In C++, you would have to roll that functionality yourself.  Node did a really good job making synchronous and asynchronous methods available.


And as you said, you can extend it with C++ if you want.  In fact, I believe someone has created SFML bindings for Node already!

 

anything