Skip to main content

News

Topic: Can Sphere games connect to servers? (Read 8090 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • Mooch
  • [*][*][*]
Can Sphere games connect to servers?
I don't know how "sockets" work, but I know enough to figure out that, using the sockets and networking capabilities of Sphere, you could directly connect two users together to have them play online together. Like the Netplay feature in ZSNES (which was my first-ever exposure to online gaming).

Could you use Sphere's networking capabilities to connect to a server, though? Like, theoretically, could you make a MUD or simplistic MMO (like say Realm of the Mad God) in Sphere?

Re: Can Sphere games connect to servers?
Reply #1
You can create a "server" in sphere and have the other users connect to it using sockets.

I believe there is ways using MySQL, but I believe that was a hacked in feature by someone.

Re: Can Sphere games connect to servers?
Reply #2
Sphere games can technically do anything at all with networking. The sockets exposed are BSD sockets, which are what you'd use in C or C++ to do it.

I have personally made a couple networked tech demos and an IRC client using Sphere. I can tell you from experience that it works just fine for server/host configurations, hosting games from Sphere, or connecting to the internet.

If you wanted to do MySQL, you'd need to emulate the entire protocol. An IRC client is simple to implement, and is a good way to get your feet wet with networking, while still producing real, usable things.

  • Mooch
  • [*][*][*]
Re: Can Sphere games connect to servers?
Reply #3
Sphere games can technically do anything at all with networking. The sockets exposed are BSD sockets, which are what you'd use in C or C++ to do it.

I have personally made a couple networked tech demos and an IRC client using Sphere. I can tell you from experience that it works just fine for server/host configurations, hosting games from Sphere, or connecting to the internet.

If you wanted to do MySQL, you'd need to emulate the entire protocol. An IRC client is simple to implement, and is a good way to get your feet wet with networking, while still producing real, usable things.


Sweet! Heh, so actually, you could put a real web browser inside one of your Sphere games. Like, have a PC in your character's home or whatever, and use it to browse the real internet.

Uh, followup question -- what's the difference between BSD sockets and MySQL? I really have no idea what either are (and checking Wikipedia doesn't help 'cause the articles are so technically-written), but I mean like, what's something you could do in MySQL that's impossible (or would be ridiculously difficult) in BSD? My assumption would be that BSD sockets are just the physical way you connect two computers together, and MySQL is a sophisticated API or whatever that gives you lots of ways to handle data sent through the sockets.

Re: Can Sphere games connect to servers?
Reply #4
BSD sockets is a way to read and write data from a network. If you know about C-style file handles, they work like that. Which, coincidentally, is pretty much exactly how Sphere's rawfiles work.

MySQL is higher level. It is (correct me if I'm wrong, I don't know that much about databases) an implementation of the SQL database programming, and a database backend.
You'd send MySQL queries over a network. It's the data you'd send and receive. You'd use BSD sockets to specify where and how to send it, and to actually read and write that raw data to the network.

To make an analogy: think of MySQL like a file format, and BSD sockets like what you'd use to actually read and write data, any data, to a file.

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: Can Sphere games connect to servers?
Reply #5
I think casiotone (or someone else; correct me if I'm wrong) made a simple, functional web browser in Sphere. So yeah, networking is super flexible, but not necessarily easy to do. (I think? Still need to experiment with it!)


  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: Can Sphere games connect to servers?
Reply #6
While Sphere has decent networking support, it's not that good for MMO's. Also you need to port forward and send IP addresses and stuff to get a game between two others. I once had a networked sphere game with 7 people online. But it was only for one day, and my IP address floats so I couldn't keep a persistent game running 24/7 without a real server to run it on.

Then if you had a real server, Sphere itself was designed for games. So unless you write a server in another language, you can't have it handle a high throughput.

In short, Sphere's networking was designed for LAN play, ideally.
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.

Sphere-sfml here
Sphere Studio editor here

Re: Can Sphere games connect to servers?
Reply #7
The port-forwarding, floating IP, and telling users your server IP isn't really a Sphere-specific issue--though you would have to deal with it if you wanted to host a Sphere-based MMO. For instance, that is how a lot of MineCraft servers work, since there is no first-party hosting and a lot of independent, privately owned servers.

The beauty of using BSD sockets, though, is that it would be simple to write the server software in another language and have it work fine with Sphere.

  • Mooch
  • [*][*][*]
Re: Can Sphere games connect to servers?
Reply #8

BSD sockets is a way to read and write data from a network. If you know about C-style file handles, they work like that. Which, coincidentally, is pretty much exactly how Sphere's rawfiles work.

MySQL is higher level. It is (correct me if I'm wrong, I don't know that much about databases) an implementation of the SQL database programming, and a database backend.
You'd send MySQL queries over a network. It's the data you'd send and receive. You'd use BSD sockets to specify where and how to send it, and to actually read and write that raw data to the network.

To make an analogy: think of MySQL like a file format, and BSD sockets like what you'd use to actually read and write data, any data, to a file.


Alright, thanks.


The port-forwarding, floating IP, and telling users your server IP isn't really a Sphere-specific issue--though you would have to deal with it if you wanted to host a Sphere-based MMO. For instance, that is how a lot of MineCraft servers work, since there is no first-party hosting and a lot of independent, privately owned servers.

The beauty of using BSD sockets, though, is that it would be simple to write the server software in another language and have it work fine with Sphere.


Yeah, I was actually thinking the server itself wouldn't be programmed in Sphere. In fact, I didn't know it could. I assumed servers have their own OSes and programs and stuff.


While Sphere has decent networking support, it's not that good for MMO's. Also you need to port forward and send IP addresses and stuff to get a game between two others. I once had a networked sphere game with 7 people online. But it was only for one day, and my IP address floats so I couldn't keep a persistent game running 24/7 without a real server to run it on.

Then if you had a real server, Sphere itself was designed for games. So unless you write a server in another language, you can't have it handle a high throughput.

In short, Sphere's networking was designed for LAN play, ideally.


I don't know a lot about it, but you might be able to use a server emulator like Hamachi, which should take care of the IP and floating and stuff problems. I know people use it to host small Minecraft servers for their friends without actually owning any server equipment.

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: Can Sphere games connect to servers?
Reply #9
Quote
I assumed servers have their own OSes and programs and stuff.

Nah. All you need to do in order to be a server program is open a network port and listen to data coming into that port (from clients), then respond accordingly to that. As an example, web server software like apache or lighttpd will listen to HTTP requests from clients (browsers) to request a page, and then send the page to that client. It's the same for games, or basically any other client/server thing out there (FTP, IRC, game servers...).

Quote
I don't know a lot about it, but you might be able to use a server emulator like Hamachi, which should take care of the IP and floating and stuff problems. I know people use it to host small Minecraft servers for their friends without actually owning any server equipment.

Yup, Hamachi is possible. It does some crazy trickery. I personally prefer to just set up port forwarding, though. More reliable and doesn't need an extra layer of software.