Connecting Node.js and openFrameworks - node.js

What is the best way to connecting Node.js code and openFrameworks(oF) code?
I though zmq would be nice, because it seemed easy to use (has many wrappers), and light and fast. ofxZmq, the zmq addon for openFrameworks, however, just didn't work well. It crashes when receiving messages.
I want something as easy to use as possible.

I have done a simple communication from an open frameworks client to a node.js server via OSC protocol. It is very popular in the OF world, and it can be read by a bunch of similar software and frameworks (processing.org, PureData, VVVV, Max/MSP, etc)
Here you have some different chooses for OSC implementation via UDP:
https://nodejsmodules.org/tags/osc

Check out ofxNodejs, it comes with a couple of examples to get you started.
In general, most "connecting X to openFrameworks" questions can be answered by checking out ofxAddons.com, which keeps a list of openFrameworks addons accessible by github (updated daily).

Related

How to integrate Node.js Server in My cocod2d-x (C++) Game

I am new in Multiplayer Game Development, I have already developed a offline game and now I want to make it a multiplayer, so with help of my friend we create a server side script in node.js, but I don't know how to integrate this in my c++ project,
I've googled but, can't find anything helpful.
anybody can suggest any tutorial.
Thanks
You've asked a big open-ended question. As Allern suggests there are a lot of things that you can do with networked programs that can extend it well beyond that of a single user game. For instance in my current game there is an access to a version welcome page in html. There are file downloads for campaign/user maps and there are connections to Firebase for leaderboards and other networked resources like ads.
However, I suspect you are referring to the communications between a number of separate user machines all synchronized to keep them coordinated. For this you will need to write some serialization code to transmit to and receive packets from the central server. Typically a serialization package like flatbuffers will be needed to move information from your data structures to a packet and the reverse.
You might also require communication/network software to asynchronously send and receive those packets (this may be included in whatever game engine you might be using). Boost.asio might help otherwise. There are numerous other networking packages and libraries all the way down to the bare-bones unix/POSIX calls (or Windows OS calls).
You will also need software on the server side to log users in, deal with players disconnecting and doing the main work of passing the game packets around. This software may also implement the logic of your game (game rules) and might do saves on the data if you want users to be able to play the game in multiple sessions (like a big dungeon crawl). There might be packages out there that do most of the server side stuff. If so, please post what you find out.
Cocos2dx does have some networking software built in but it isn't very functional as far as I'm concerned. It does have facilities to display web pages and download files fairly easy but the async communication seems a little weak. You can try the Network module in the API Docs which may have what you are looking for.
Since the type of game and how you want to implement your player interaction will dictate how the software is to be built I'm afraid this answer is a little vague. Good luck. Share your insights.
you can use public tools , as a sample is websocket,it can support C++ and javasc

Erlang & Yaws installation

I want to apologize about my English. It's not very good.
So, I want to make a chat application (pretty much like Facebook's), and after reading a lot I decided to make this chat app with Erlang. After more reading I found out that I can use Yaws server to make a web application with Erlang, but that's all. I still can't even install and configure it well. So my questions are:
Is this information correct? Do I need Erlang / Yaws to create this chat app?
If it's correct, how do I install and configure it under Windows 7? I've tried to simply install "OTP 17.0 Windows 32-bit Binary File" from here http://www.erlang.org/download.html and "Yaws-1.98-windows-installer.exe" from http://yaws.hyber.org/download/, but I think something went wrong, because after I "configure it" at localhost port 8001/8080 or others still nothing happens. So what's next? Do I have to install my code in special directories and/or what do I have to do next ?
In case I finally get a Chat application in Erlang ready, how can It interface with my PHP code? I mean, I already have the PHP project. It is a normal web project with PHP/HTML/Javascript, etc. so my question is, how do I glue these two elements together?(I would like to stress one more time that I have to make something like the Facebook chat).
I'll be thankful for all kind of information, tutorials, books, videos, anything.
I agree with you, Erlang is an excellent option for a chat server. If you want to go for Yaws, check the documentation, it support external scripts via CGI and Websockets. All the information you need to communicate your PHP application with your chat Application is on chapter 9 of yaws' pdf documentation.
There are many ways to create a web application in Erlang. Here are some old examples that use mochiweb:
http://pragprog.com/screencasts/v-kserl/source_code
http://www.chrismoos.com/2009/09/28/building-an-erlang-chat-server-with-comet-part-1/
and a nice example from erlang central
Regarding the PHP integration,there are again, several ways to communicate both. You can integrate the chat with your PHP code using a PHP Erlang bridge
or using websockets
or probably you could try to send your data encoded in JSON from mochiweb using mochijson2.erl and communicate both by HTTP using curl from PHP.
All in all, I would probably also use yaws since is well documented and easy to use. Good luck

Mature WebSocket / Socket.io server side implementations?

I have closed-source server-side software that communicates with proprietary messages over TCP.
I would like to program a client for this server that runs in the Safari web browser (an iPad).
I believe the best way to do this is to create a middleware program that translates between the WebSocket or Socket.io protocol and the proprietary format used by the server.
I'd be most comfortable writing the midleware in C/C++ or Java, but other languages readily usable on linux would also work. The connection to the server can not be closed between calls and we need to maintain state, so languages like php are probably not appropriate.
I've looked at a half-dozen server side Socket.io implementations, but nothing stood out as being ready for prime-time.
What are some mature sever-side platforms / libraries for a browser socket implementation out there? The things that are most important to me are:
Stability... It should run for months without being restarted
Maintenance and Community... No dead projects
While it seems like nothing is truly mature in this area, any hints as to the best possible paths for a production system would be appreciated.
It is difficult to grasp what you really want to know from us.
I've looked at a half-dozen server side Socket.io implementations, but
nothing stood out as being ready for prime-time.
I believe http://socket.io/ for node.js is pretty stable, used by many, has a huge community, and is by far not dead.

Open Aource application/protocol for internet applications

In near future I'll need to start working on a new project that consist of highly loaded TCP/IP servers and clients that communicate to that server. I know the basics of TCP/IP and can make the server and clients talk over the wire.
The problem is that I need to find some ways to protect server against other "clients" that can send bogus data and may crash the server. I'm looking for any ideas or recommendations for an application-level protocol that I can use for my application. Pretty sure there must be some kind of open-source MMORPG game that has already implemented such a protocol.
Any other ideas are very welcome.
P.S. I have checked already the WorldForge project.
Use authentication and write your server so that bogus data doesn't crash it. You can also utilize firewalls where appropriate.
Have a look at http://www.devmaster.net/ for game development. I've read many useful articles there.

JSTUN vs PJNATH

I'm going to be writing my own STUN implementation in JavaScript (server-side with NodeJS), and I'm looking for a library to base my code on.
I have found both JSTUN and PJNATH, and both seem to be supported by members of stackoverflow. I downloaded the source for both, and PJNATH was about 15,000 lines of code whereas JSTUN was less than 3000.
Is one library more complete than the other?
I need both server and client components, and I would like to be as feature-complete as possible because I do NOT want to implement TURN (too hardware intensive).
Is there a better library that I should be looking at? Ultimately I want to make a completely ICE complient solution, but STUN is enough for now.
as far as I know, JSTUN is not a complete solution. This is what they have mentioned in their site.They want to add support for RFC 5389.Please check their web site(http://jstun.javawi.de/).

Resources