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

Author Topic: How do I bring an SFML game out on the Internet?  (Read 13048 times)

0 Members and 1 Guest are viewing this topic.

ingwik

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
How do I bring an SFML game out on the Internet?
« on: October 22, 2011, 12:32:43 pm »
I admit, when programming in different languages, I'm a beginner with C/Pascal knowledge given to me in the eighties and acute employed as a substitute C++ teacher this- and next semester. I'm having three classes in highschool (beginner/intermediate/advanced) where pupils are taught C++ and I decided to use SFML for the two more advanced classes to attract their interest for programming in a better way than just using the console window in vc++ which has always been the only choice in this school.

The main problem now for me is that several of my pupils want to make games they can put out for on-line gaming. I know that theoretically, it should be possible, even though C++ might not be the language of choice for it. It really doesn't have to either since they are learning "programming", the choice of using C++ in teaching programming was made long before I came to the school. And since I have to learn C++ well in advance to the pupils, I could aswell learn another programming language well in advance before the actual lessons I have.

When I look at the different versions of SFML, I see three different ones that might be the solution:

*.Net. It can be programmed through VC++, but if I make a game using SFML and .Net standard, how hard is it to make it on-line playable?

*Python, it's used as server side programming language and the same pupils whom I'm teaching how to program C++ are taught by me how to put up apache web servers too, so it shouldn't be that hard, I think. Or am I wrong? How hard is it to make an on-line playable game in Python using SFML if you have control over your own Apache server?

*Ruby. Is that the same as Ruby on rails? I have never used it and it seems to be hard to understand. Still, there is an SFML version for it. As far as I know, Ruby and Python are about the same and it seems that Python would be a better choice, but am I wrong on that?

If it's playable on the Internet this way, then it should also be playable in an Iphone or Android that can show homepages, or am I wrong there too? I hope someone with better knowledge than I can give some kind of answer to these questions.

And besides, since it's a school I'm working in, I can only use free alternatives, nothing that cost any kind of money.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
How do I bring an SFML game out on the Internet?
« Reply #1 on: October 22, 2011, 12:45:57 pm »
With .Net you have ASP.Net, but I don't know if it's suitable for online gaming (it's already pretty bad for "dynamic" user interfaces).

Python and Ruby are server-side languages, you won't be able to use them for online gaming.

You must find a technology that runs on client-side. I'm not an expert, but in my opinion you should have a look at Javascript, ActionScript (Flash) or HTML 5 (Canvas API or WebGL).
Laurent Gomila - SFML developer

ingwik

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
How do I bring an SFML game out on the Internet?
« Reply #2 on: October 22, 2011, 01:08:17 pm »
Quote from: "Laurent"

Python and Ruby are server-side languages, you won't be able to use them for online gaming.
 


Thanks for your fast answer. I had a lot of hope in store for Ruby and Python, and I'm having a bit of a major blonde moment now. If I have a server of my own, why can't I use Python/Ruby to host the games (with SFML as game library in the background)? And, since so much of the future in game developing is connected to iphone/Android system, isn't there any way to use the  SFML libraries for games based on those technologies?

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
How do I bring an SFML game out on the Internet?
« Reply #3 on: October 22, 2011, 01:15:31 pm »
Think of it this way:

Your server-side can run some game logic, or for a multiplayer game, relay data about the position of a competitor to each user (say in a first-person-shooter type game).

Your local user's machine will actually run the game program, render images to the screen, etc.

You don't want to be rendering data on a server and sending that to the client - that'd be crazy (unless each client has a 1Gb fibre-optic connection...).

SFML for Android/iOS would be brilliant, I agree, but is a BIG job to port across, mostly due to OpenGL ES, I think.
SFML 2.1

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
How do I bring an SFML game out on the Internet?
« Reply #4 on: October 22, 2011, 01:17:41 pm »
Quote
If I have a server of my own, why can't I use Python/Ruby to host the games (with SFML as game library in the background)?

By "online gaming" I assume you mean "anyone connected to internet can play the game without installing anything, through the web browser". I also assume that the game is not multi-player.

But maybe I'm wrong, and you're simply talking about multi-player games?

Quote
And, since so much of the future in game developing is connected to iphone/Android system, isn't there any way to use the SFML libraries for games based on those technologies?

Not yet, SFML needs to be ported to these platforms first.
Laurent Gomila - SFML developer

kolofsson

  • Full Member
  • ***
  • Posts: 100
    • View Profile
How do I bring an SFML game out on the Internet?
« Reply #5 on: October 22, 2011, 01:58:45 pm »
Wait, you can't make a multiplayer game with PySFML? I'm almost sure ingwik means multiplayer, not a browser game.

There are two types of multiplayer servers. One is a server that is built in the game and very often the multiplayer is peer-to-peer. The second type is a dedicated server, where the server is a different app that receives/sends data between players and does all the physics calculations. the client-side games are then just GUI frontends to interact with the server.

thePyro_13

  • Full Member
  • ***
  • Posts: 156
    • View Profile
How do I bring an SFML game out on the Internet?
« Reply #6 on: October 22, 2011, 02:10:54 pm »
Quote from: "kolofsson"
Wait, you can't make a multiplayer game with PySFML? I'm almost sure ingwik means multiplayer, not a browser game.

There are two types of multiplayer servers. One is a server that is built in the game and very often the multiplayer is peer-to-peer. The second type is a dedicated server, where the server is a different app that receives/sends data between players and does all the physics calculations. the client-side games are then just GUI frontends to interact with the server.
I'm pretty sure any of the listed languages(especially C++) can handle multiplayer. I think OP means on-line,  as in, hosted in a browser window(like flash, java, HTML5). Which many languages cannot do natively.

I think the more common name for it would be Browser Based Game.

Sadly, I don't have anything more helpful to add to this thread than this clarification.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
How do I bring an SFML game out on the Internet?
« Reply #7 on: October 22, 2011, 02:15:38 pm »
We definitely need to know if we're talking about browser games or multiplayer games ;)
Laurent Gomila - SFML developer

ingwik

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
How do I bring an SFML game out on the Internet?
« Reply #8 on: October 22, 2011, 02:35:00 pm »
Well, to be honest I think both ideas are intiguing.
A: Hosting a multiplayergame... Like a WoW server do. I assume you make the "client games " in SFML but use a serverprogram to connect the differen clients. That should be possible already, I think, one way or the othe through the network module in SFML. At the end of the day, it's probably best to have the clients connect between each other and just making one of the clients a "server", like you used to do in the old days with Starcraft 1 or World of Warcraft 1. Limits the amount of players though.

B: Making a game you can play online without downloading too much, like you do with Farmville in facebook for instance. It's Flash and use the canvas provided in flash. It's that web-canvas I'm looking for, is that possible to create in .Net, Python or Ruby at all? If so, then I asssume you could use SFML through that language and canvas. In the end, that would enable me to play that game in any phone able to show homepages.

C: Or is there any other way to get a web-canvas? Perhaps using SFML for Python connected to a Java interface and using Java to show the built in canvas used by Java?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
How do I bring an SFML game out on the Internet?
« Reply #9 on: October 22, 2011, 02:46:19 pm »
For A, you can use any language, network communication is implemented inside the program (most likely with sfml-network).

For B/C, you can't use Python, .Net or Ruby. If you do, clients will have to download and install something. You can't execute Python or Ruby directly in a web browser. Only Javascript and Flash (as far as I know -- there are probably others) can do this. Well, strictly speaking only Javascript is supported, but almost everyone (except iOS users) have the Flash plugin so we can assume that a Flash game won't need an extra install.
Laurent Gomila - SFML developer

ingwik

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
How do I bring an SFML game out on the Internet?
« Reply #10 on: October 22, 2011, 02:52:49 pm »
Quote from: "Laurent"

For B/C, you can't use Python, .Net or Ruby.


That was bad news indeed. But... I can't stop thinking that there could/might be some kind of way to use SFML as a backend and showing the outcome, not in a renderwindow, but inside a <canvas></canvas> tag in a web browser instead. I just don't have enough skills in programming to make that happen.

se more about canvas:https://developer.mozilla.org/en/Canvas_tutorial

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
How do I bring an SFML game out on the Internet?
« Reply #11 on: October 22, 2011, 03:27:20 pm »
As far as I know, you can only use Javascript (Canvas API or WebGL) to draw inside a HTML 5 canvas.

Quote
I can't stop thinking that there could/might be some kind of way to use SFML as a backend and showing the outcome

There are many ways, but none of them can work right now, in everyone's browser, without installing anything.

Online/browser games need very specific technologies, you can't just take a program written in a random language and make it playable through everyone's browser. If it was possible, we would be able to use all the existing games/softwares/whatever through a simple internet browser... ;)

You can also have a look at Google's Native Client (NaCl), which is able to execute native executables inside a browser without any additional plugin, but it's still experimental as far as I know. And I guess it's limlited to Google Chrome.
Laurent Gomila - SFML developer

kolofsson

  • Full Member
  • ***
  • Posts: 100
    • View Profile
How do I bring an SFML game out on the Internet?
« Reply #12 on: October 22, 2011, 03:44:39 pm »
Should I mention I find it awful to port everything into a web browser? The web browser is becoming more and more a substitute for operating system. It's nice to have gmail, maps and spreadsheets available on the web, but for some tasks a standalone application is just irreplaceable. I think it's pretty viable to make a single-file SFML game that would work without installing and would download necessary textures from the web.

Beta_Ravener

  • Jr. Member
  • **
  • Posts: 51
    • ICQ Messenger - 271426715
    • View Profile
How do I bring an SFML game out on the Internet?
« Reply #13 on: October 22, 2011, 07:09:04 pm »
Quote from: "Laurent"
Only Javascript and Flash (as far as I know -- there are probably others) can do this.


I believe that Java can do very well also (it's nothing like javascript). For example Minecraft can be run in browser using java:
http://www.minecraft.net/classic/play.

However let me tell my point of view as student. I'm in 4th year of highschool (Slovakia) and I'm using c/c++ just because I learned it by myself. My schoolmates are however learning Pascal (which I see as ancient language) but they can indeed play and have fun doing just some simple things as 2D terrain generation. Making games is quite time demanding work and it's useless unless the students give in their free time.

But even if they really want to make game, I can't see a reason why to make it browser one.. Basically, I find browser games much slower and simpler than those run in PC directly. There's only one serious game other than minecraft being developed for playing in browser (some world war 2 FPS). I believe that most of the games was, are and will be played from your HDD and not through browser. It brings just too many unnecessary complications to developing a game and gain is really small as games played on PC directly can still be enough small to take just sec to download and with SFML it's guaranteed they'll be portable.

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
How do I bring an SFML game out on the Internet?
« Reply #14 on: October 22, 2011, 10:27:35 pm »
The fact is, the world is moving away from desktop/laptop systems to one where everything is hosted in the cloud and consumed as a web service.

We're many years away yet, but it will come - it is the most logical thing for both users and software suppliers.

So, with that in mind, the next few years will see more online applications and need frameworks like SFML to be able to work in browsers.

Just my 2c worth, but I develop software for commerical use with SFML and we are seeing a lot more requests for browser based gaming (we do casino games). People don't buy slot machines now, they are all connected to a server, or people just use their iPad or whatever to play games.

That's life...
SFML 2.1

 

anything