MMO game HTML5

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Josh8787
Posts: 6
Joined: 01 Apr 2020, 21:34

MMO game HTML5

Postby Josh8787 » 01 Apr 2020, 21:49

I want to start developing an MMO game in html5. I have been working with sfs for a long time, but only with the regular version and with flash. Going beyond html5 is a pretty big transition, but I try.
My problem is that I've been busy for two weeks running the SFSx2 example of simaple mmo game. I first tried the flash version and it ran the example. When I switched to the html5 version and tried to connect the system registered in the console "Sending request 'Handshake' to server" and then typed "ATTENTION You have been disconnected; reason is: unknown. "I tried to look for answers online and saw that wws / ws needed to be enabled but the server still doesn't connect to me. I really don't know what to do.
And I tried to read a guide in sfs2x docs, but it probably fits an older version of the software. According to what is written there is supposed to be an index in the main directory, and I don't have one. What can I do?
Please, I'd be happy to help. Thanks in advance!
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: MMO game HTML5

Postby Lapo » 02 Apr 2020, 07:31

Hi,
in order to run HTML5 examples you need the following:
- make sure websocket is active on the server side (Admin Tool > Server Configurator > Web Server)
- download the examples from here: https://www.smartfoxserver.com/download#p=examples
- copy the examples under www/ROOT/
- point your browser to http://localhost:8080/<name-of-the-example-folder>

Try following these steps one by one and let us know if you encounter any issues.

Thanks

p.s. = the reason why you need to copy the examples in the webserver folder, rather than somewhere else, is that browsers no longer allow connections from HTML files loaded from the file system.
Lapo
--
gotoAndPlay()
...addicted to flash games
Josh8787
Posts: 6
Joined: 01 Apr 2020, 21:34

Re: MMO game HTML5

Postby Josh8787 » 02 Apr 2020, 08:13

Lapo wrote:Hi,
in order to run HTML5 examples you need the following:
- make sure websocket is active on the server side (Admin Tool > Server Configurator > Web Server)
- download the examples from here: https://www.smartfoxserver.com/download#p=examples
- copy the examples under www/ROOT/
- point your browser to http://localhost:8080/<name-of-the-example-folder>

Try following these steps one by one and let us know if you encounter any issues.

Thanks

p.s. = the reason why you need to copy the examples in the webserver folder, rather than somewhere else, is that browsers no longer allow connections from HTML files loaded from the file system.


It's still not working.
http://localhost:8080/SimpleMMOWorld/ doesn't work because I don't have an Index.html file in the SimpleMMOWorld file. But this is work for me:
http://localhost:8080/SimpleMMOWorld/deploy/client/
I can enter to this file but the server still not connecting to me.

what can I do?
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: MMO game HTML5

Postby Lapo » 02 Apr 2020, 08:50

Each example comes with it's own tutorial.
Please read the relative tutorial here:
http://docs2x.smartfoxserver.com/ExamplesJS/simple-mmo

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
Josh8787
Posts: 6
Joined: 01 Apr 2020, 21:34

Re: MMO game HTML5

Postby Josh8787 » 02 Apr 2020, 09:49

Lapo wrote:Each example comes with it's own tutorial.
Please read the relative tutorial here:
http://docs2x.smartfoxserver.com/ExamplesJS/simple-mmo

Thanks


I know but no example works for me, maybe the problem is in the server?
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: MMO game HTML5

Postby Lapo » 02 Apr 2020, 14:05

Without any errors, it's difficult to guess what it's going on.

Let's start with the simplest of examples, the "Connector":
http://docs2x.smartfoxserver.com/ExamplesJS/connector

Try running this one and following the tutorial. If it doesn't work please report exactly what error you're getting and also look for errors on the server side.

Let us know
Lapo

--

gotoAndPlay()

...addicted to flash games
Josh8787
Posts: 6
Joined: 01 Apr 2020, 21:34

Re: MMO game HTML5

Postby Josh8787 » 03 Apr 2020, 08:43

Lapo wrote:Without any errors, it's difficult to guess what it's going on.

Let's start with the simplest of examples, the "Connector":
http://docs2x.smartfoxserver.com/ExamplesJS/connector

Try running this one and following the tutorial. If it doesn't work please report exactly what error you're getting and also look for errors on the server side.

Let us know



Same
Image
How can I see the errors?
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: MMO game HTML5

Postby Lapo » 03 Apr 2020, 10:50

Check the server logs, either on screen (if you run the server by double clicking its icon under Windows/Mac) or directly in the log files under SFS2X/logs/smartfox.log

It looks like you have not activated the Websocket option in the server config.
Please double check under Admin Tool > Server Configurator > Web Server

Also is the server running on your local machine?

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
Josh8787
Posts: 6
Joined: 01 Apr 2020, 21:34

Re: MMO game HTML5

Postby Josh8787 » 03 Apr 2020, 11:46

Lapo wrote:Check the server logs, either on screen (if you run the server by double clicking its icon under Windows/Mac) or directly in the log files under SFS2X/logs/smartfox.log

It looks like you have not activated the Websocket option in the server config.
Please double check under Admin Tool > Server Configurator > Web Server

Also is the server running on your local machine?

Thanks


that's what was printed to me in the log file:
03 Apr 2020 | 14:23:52,898 | INFO | http-nio-8080-exec-7 | bitswarm.sessions.DefaultSessionManager | | Session created: { Id: 21, Type: WEBSOCKET, Logged: No, IP: 0:0:0:0:0:0:0:1 } on Server port: 8080 <---> 63714


And I did active it:
Image
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: MMO game HTML5

Postby Lapo » 03 Apr 2020, 13:03

The log fragment you posted shows that the connection was made. What happens after?
Can you show a more complete view of the logs where we can see what happens between connection and disconnection?

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Bax
Site Admin
Posts: 4610
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: MMO game HTML5

Postby Bax » 03 Apr 2020, 13:15

Josh8787 wrote:Image
How can I see the errors?

What if you check the "Show debug" checkbox?
I'd like to see what messages are printed on the screen.
Paolo Bax
The SmartFoxServer Team
Josh8787
Posts: 6
Joined: 01 Apr 2020, 21:34

Re: MMO game HTML5

Postby Josh8787 » 03 Apr 2020, 15:19

Lapo wrote:The log fragment you posted shows that the connection was made. What happens after?
Can you show a more complete view of the logs where we can see what happens between connection and disconnection?

Thanks

What I posted is the only thing that show to me in the logs file when I'm trying to connect
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: MMO game HTML5

Postby Lapo » 03 Apr 2020, 15:41

It looks like something else is interfering with the connection, especially if from client side you get disconnected but there's no trace of any disconnection message in the server logs.

What OS are you using?
Are you running any firewalls (besides the default Windows or Mac fw)? Or maybe an antivirus which adds its own firewall? If so try to shut it down (only temporarily) to see if you can connect.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 66 guests