Jump to content


Photo

Gamemaker Websocket


  • Please log in to reply
120 replies to this topic

#1 Demion

Demion

    GMC Member

  • GMC Member
  • 46 posts

Posted 04 December 2011 - 03:29 PM

GM Websocket v3

 

deprecated

Description

GameMaker WebSocket is small javascript code providing gamemaker to use websockets. Currently project is still in a very early alpha but includes all needed functionality. Tested with all popular browsers - chrome, firefox, opera, ie, safari (nothing missing?). Now works correctly only with chrome and firefox. I will add opera support in a week. Fully supports gm windows version server (39dll for example). Extension supports multiple connections.

Functions
 

double gmws_connect(string serverip, double serverport); // returns websocket id
gmws_clear_buffer(double wsid); //clear write buffer
gmws_write_byte(double wsid, double data); // 1 byte unsigned number 0..255
gmws_write_char(double wsid, double data); // 1 byte signed number -128..127
gmws_write_word(double wsid, double data); // 2 byte unsigned number 0..65535
gmws_write_short(double wsid, double data); // 2 byte signed number -32768..32767
gmws_write_dword(double wsid, double data); // 4 byte unsigned number 0..4294967295
gmws_write_int(double wsid, double data); // 4 byte unsigned number -2147483648..2147483647
gmws_write_float(double wsid, double data); // 4 byte floating point number
gmws_write_double(double wsid, double data); // 8 byte floating point number
gmws_write_string(double wsid, string data); // null-terminated string (1 byte per char code, last byte - 00)
gmws_write_widestring(double wsid, string data); // null-terminated unicode string (2 bytes per char code, last bytes 00 00)
double gmws_send(double wsid); // return 0 if disconnect, return -1 if no data was sent, return buffer size normally
double gmws_read_byte(double wsid); // return 0 if no data in recv buffer
double gmws_read_char(double wsid);
double gmws_read_word(double wsid);
double gmws_read_short(double wsid);
double gmws_read_dword(double wsid);
double gmws_read_int(double wsid);
double gmws_read_float(double wsid);
double gmws_read_double(double wsid);
string gmws_read_string(double wsid); // return "" if no data in recv buffer
string gmws_read_widestring(double wsid)
double gmws_recv(double wsid); // return 0 if disconnect, return -1 if no data was received, return buffer size normally (real sent size = returned size + 8 bytes)
double gmws_get_state(double wsid); // 0 - connecting, 1 - connected, 2 - disconnecting, 3 - disconnected;

Guide
1) Launch gmws.exe (websocket traffic "translator" with params gmws.exe ip1 port1 ip2 port2, where ip1 port1 - client connects to (example 127.0.0.1 8080) and ip2 port2 - server (for example 39dll) listens at (example 127.0.0.1 8081). Default values (if no params set) - 127.0.0.1 8080 127.0.0.1 8081
2) Launch your server
3) Connect with html5 client to server

Downloads [reupload - 26.01.12]
GM WebSocket Extension - gmws.gex
Websocket Traffic "Translator" - gmws.exe
Example (server - 39dll) - gmwsexample.zip

 

 

gmws Sources
As promised. Gmws (websocket protocol) c/cpp sources. They are not finished, not commented, not organised. Ill post it in 1st post when organise code better.

 

Bugs, wishes, suggestions. Please give me feedback.


Edited by Demion, 09 October 2013 - 07:15 PM.

  • 3

#2 Barling

Barling

    GMC Member

  • GMC Member
  • 125 posts

Posted 05 December 2011 - 08:11 PM

Is there an example of how to use the C++ server?
Also can any server work? Even a GM server?

Because I tried with a GM server, and I noticed I was able to establish a connection.

Edited by Barling, 05 December 2011 - 08:11 PM.

  • 0

#3 Demion

Demion

    GMC Member

  • GMC Member
  • 46 posts

Posted 05 December 2011 - 09:13 PM

You need to compile c/c++ server to use it. Sources are included in first post. About GM server. Ill made "proxy" app to make GM server work with GM html5 client soon. Thanks.

Edited by Demion, 05 December 2011 - 09:22 PM.

  • 1

#4 Barling

Barling

    GMC Member

  • GMC Member
  • 125 posts

Posted 05 December 2011 - 10:19 PM

Yeah but I was able to establish a connection with my GM server.
Also, your help document appears to be empty, and there is no documentation
on how to use the C/C++ server (as in, how to code the actual server, what functions to use, etc.)

It can be rather confusing for first time users.

For example, how do we receive and send messages in the C++ example
back to the GMHTML5 client?

Edited by Barling, 05 December 2011 - 10:35 PM.

  • 0

#5 Demion

Demion

    GMC Member

  • GMC Member
  • 46 posts

Posted 08 December 2011 - 12:01 AM

Rewritten most code. Released v2. All information in 1st post. Fully support 39dll based servers (gm for windows). Ill make c/c++ server example soon. Please test and give bugs, wishes, suggestions, feedback. Thanks.

---

Tested with all popular browsers - chrome, firefox, opera, ie, safari (nothing missing?). Now works correctly only with chrome. I will add firefox and opera support in 1-2 days.

Edited by Demion, 11 December 2011 - 11:39 PM.

  • 1

#6 Greenblizzard

Greenblizzard

    GMC Member

  • GMC Member
  • 405 posts
  • Version:GM:Studio

Posted 09 December 2011 - 07:05 PM

EDIT2:
Never mind, it works!
First of all, didn't see that you used two different, but similar ports in your guide (8080 and 8081), so I used the same port in both places.. I had also changed the port for the client to connect to in the wrong object.

I don't have a lot of experience with online in Game Maker, and with this system that makes it slightly more complex than just 39dll, and having to run an exe with parameters(which I've never done before), this ended up being a bit confusing.

Anyway, well done, and thanks for making this :biggrin:
EDIT1:

Tried to run both server and client without the gmws.exe, and got the same result. Maybe I just didn't run the exe the right way or set the parameters right.

How is it supposed to be done?


ORIGINAL POST:

This is neat!
If I only could get it to work properly...
I use the 39dll based server approach and am able to get the server and client connected, but they won't communicate.

When I try to make the client send a message, the gmsw_send() function returns -1, meaning no data was sent. What could be causing this?

Edited by Greenblizzard, 09 December 2011 - 10:12 PM.

  • 0

jamtato2.png


#7 lukeescude

lukeescude

    GMC Member

  • GMC Member
  • 711 posts
  • Version:GM:Studio

Posted 10 December 2011 - 02:57 AM

Could you explain what the websocket traffic "translator" is?

I'm not entirely sure if that's part of the client or the server... You make it sound like it's both.
  • 0
My 39dll Tutorial
GMechanism, a Game Maker extension for Online Highscores, Achievements, Chat Engine, INI Host, etc.
Posted Image

#8 Demion

Demion

    GMC Member

  • GMC Member
  • 46 posts

Posted 10 December 2011 - 09:18 AM

Client should connect to gmws.exe (to ip1:port1) and gmws.exe decodes websocket traffic and forwards it to your original 39.dll (or other) server (to ip2:port2). So gmws.exe should be used only on server side. And you cant use 2 same ports. Becuase you cant listen to two same ports on windows. Maybe Ill make dll / extension for win32 game maker to use it without external .exe.

---

gmsw_send() function returns -1

You use it just after connect in create event? -1 returns if there is no data in buffer or mostly if websocket is not finished connecting. So I recommend you sending your first packet like this
create event - connect, alarm[0] = room_speed.
alarm0 - send your first packet
or in step event
Its a bit confusing but i think it is becuase of websocket architecture. After you call connect it doestn wait until connection is fully established. So you should wait ~1sec.

Edited by Demion, 10 December 2011 - 09:42 AM.

  • 0

#9 Debels

Debels

    GMC Member

  • GMC Member
  • 2828 posts
  • Version:GM:Studio

Posted 11 December 2011 - 05:13 PM

the function gmws_read_string doesn't exist on .gex
  • 0

This signature has been removed for being to awesome.


#10 Greenblizzard

Greenblizzard

    GMC Member

  • GMC Member
  • 405 posts
  • Version:GM:Studio

Posted 11 December 2011 - 05:36 PM

@Demion
I've been struggling with ports and getting a client to connect to the server with my external ip.

After a while, I found canyouseeme.org.
There I found that it could only "see" the port that the server listens to when the server is running, no matter if gmws.exe is running or not.
It could not see the port the client is supposed to connect to even if gmws.exe was running.

Have you tested with a client connecting to the server's external ip and got it to work?


I'm also not 100% sure if I set gmes.exe's parameters correctly. This is what I currently have as target in a shortcut:
"filepath\gmws.exe" 127.0.0.1 port1 127.0.0.1 port2

*actual ports are replaced by port1 and port2

Edited by Greenblizzard, 11 December 2011 - 05:37 PM.

  • 0

jamtato2.png


#11 Demion

Demion

    GMC Member

  • GMC Member
  • 46 posts

Posted 11 December 2011 - 08:11 PM

the function gmws_read_string doesn't exist on .gex

Will be fixed in release v3. For just now you can add function by yourself.

Have you tested with a client connecting to the server's external ip and got it to work?

Yes it works with external ip and local too. It's hard to say whats your problem, you can contact me privately and Ill try to figure it out.

Edited by Demion, 11 December 2011 - 08:20 PM.

  • 0

#12 Debels

Debels

    GMC Member

  • GMC Member
  • 2828 posts
  • Version:GM:Studio

Posted 11 December 2011 - 10:50 PM

the function gmws_read_string doesn't exist on .gex

Will be fixed in release v3. For just now you can add function by yourself.

Have you tested with a client connecting to the server's external ip and got it to work?

Yes it works with external ip and local too. It's hard to say whats your problem, you can contact me privately and Ill try to figure it out.


when is v3 releasement day?
  • 0

This signature has been removed for being to awesome.


#13 Demion

Demion

    GMC Member

  • GMC Member
  • 46 posts

Posted 11 December 2011 - 11:45 PM

Release v3
- firefox support! (latest version)
- add gmws_write_string / gmws_read_string
- fix gmws.exe parameters read
- add gmws.exe config console output

Next release (in a week) : opera support, buf fixes, optimization etc.

Edited by Demion, 11 December 2011 - 11:53 PM.

  • 1

#14 Debels

Debels

    GMC Member

  • GMC Member
  • 2828 posts
  • Version:GM:Studio

Posted 12 December 2011 - 12:20 AM

Release v3
- firefox support! (latest version)
- add gmws_write_string / gmws_read_string
- fix gmws.exe parameters read
- add gmws.exe config console output

Next release (in a week) : opera support, buf fixes, optimization etc.


AWESOME
  • 0

This signature has been removed for being to awesome.


#15 lukeescude

lukeescude

    GMC Member

  • GMC Member
  • 711 posts
  • Version:GM:Studio

Posted 12 December 2011 - 12:31 AM

Yes, awesome!.

I'll start using this as soon as possible. Keep up the good work!
  • 0
My 39dll Tutorial
GMechanism, a Game Maker extension for Online Highscores, Achievements, Chat Engine, INI Host, etc.
Posted Image

#16 Debels

Debels

    GMC Member

  • GMC Member
  • 2828 posts
  • Version:GM:Studio

Posted 18 December 2011 - 10:56 PM

mmmm this isn't working for me i run the gmws.exe first then the server and then the client and it doesn't work : / can you tell me what's the thing I'm doing wrong?
  • 0

This signature has been removed for being to awesome.


#17 Orbitguy

Orbitguy

    UNS Lead Guy

  • GMC Member
  • 348 posts
  • Version:GM:Studio

Posted 19 December 2011 - 05:25 AM

mmmm this isn't working for me i run the gmws.exe first then the server and then the client and it doesn't work : / can you tell me what's the thing I'm doing wrong?


Yeah I had a similiar issue, figured I probably wasn't running the right files... Was using firefox.
  • 0

hahaaforum.jpgStick Legends Online - An Online Role Playing Adventure

 


#18 Debels

Debels

    GMC Member

  • GMC Member
  • 2828 posts
  • Version:GM:Studio

Posted 19 December 2011 - 12:43 PM


mmmm this isn't working for me i run the gmws.exe first then the server and then the client and it doesn't work : / can you tell me what's the thing I'm doing wrong?


Yeah I had a similiar issue, figured I probably wasn't running the right files... Was using firefox.


what can i do?
  • 0

This signature has been removed for being to awesome.


#19 oneSOB

oneSOB

    GMC Member

  • New Member
  • 33 posts

Posted 19 December 2011 - 03:59 PM

I used to use websockets with GM like you, but then I took an arrow the knee

Also did you even tink about releasing the gmws.exe source code becase some people would like to use a c++ server but use it only for non websocket traffic (this was a bad explanation)

Let me further explain

Gm Client -> direct data -> C++ Server
HTML5 Version -> websocket data -> C++ Server

On the C++ server it will accept connections using the 39dll like normally

In the C++ server it will never know wether a connection was from a websocket or a .exe
making the server easier to program and a streamlined application

---------------------------------------------------------------------------------------------------------------------------------
Write server code once
Allow several different types of game interfaces to use it
Get ads on ur site and charge membership
???????????????????
Profit
  • 0
Our minds free from their prisons
That is the world I dream of

#20 Orbitguy

Orbitguy

    UNS Lead Guy

  • GMC Member
  • 348 posts
  • Version:GM:Studio

Posted 21 December 2011 - 04:13 AM



mmmm this isn't working for me i run the gmws.exe first then the server and then the client and it doesn't work : / can you tell me what's the thing I'm doing wrong?


Yeah I had a similiar issue, figured I probably wasn't running the right files... Was using firefox.


what can i do?


Well tonight I finally had the time to sit down and work at this. I did get it to work after about an hour, then realizing that my family had bought a new router while I was at college and I had to reportforward etc...

Anyways, it's rather hard to tell if it has connected because there is no type of indication programmed in the client or the server.

Really all you need to do is 1. Make sure you are port forwarded. and 2. Change the IP in the html5 client to 127.0.0.1 or your own IP because it's still set to his IP.
If it still doesn't work I would check that you have all of the extensions connected to each file.

I'm going to work on this more and see if I can't create some interfaces similiar to my other online projects, to give this example some more life. Great job creating this btw.
  • 0

hahaaforum.jpgStick Legends Online - An Online Role Playing Adventure

 


#21 Crhonos

Crhonos

    GMC Member

  • GMC Member
  • 235 posts
  • Version:GM:Studio

Posted 21 December 2011 - 05:06 PM

Have i ever told that i love you and you are a genius ?
What you done was just what everyone needed =D
Thanks.

How do i change the params of the Gmws translator ?

Edited by Crhonos, 21 December 2011 - 05:19 PM.

  • 0

#22 oneSOB

oneSOB

    GMC Member

  • New Member
  • 33 posts

Posted 21 December 2011 - 05:17 PM

I have a question
Have you considered releasing the source of the Gmws Proxy/Translator
I would love to mess around with it and custom build it into my server

Example

MyGame.exe -> 39Dll -> C++ Server
MyGame.php -> gmws -> C++ Server

and if coded right no one knows the difference between broswer based play or exe
  • 0
Our minds free from their prisons
That is the world I dream of

#23 Demion

Demion

    GMC Member

  • GMC Member
  • 46 posts

Posted 22 December 2011 - 12:49 PM

Have you considered releasing the source of the Gmws Proxy/Translator

Sorry for delay. Ill release "translator" gmws sources next release (+Opera support). I was very busy last week. I hope Ill release it this weekends.

Edited by Demion, 25 December 2011 - 04:05 AM.

  • 0

#24 Debels

Debels

    GMC Member

  • GMC Member
  • 2828 posts
  • Version:GM:Studio

Posted 22 December 2011 - 01:15 PM

Sorry for delay. Ill release "translator" gmws sources next release (+Opera support). I was very busy last week. I hope Ill release it this weekends.


gmws doesn't work for me :S

i run gmws then server and then client and doesn't work
  • 1

This signature has been removed for being to awesome.


#25 thedyingdragon

thedyingdragon

    GMC Member

  • GMC Member
  • 23 posts

Posted 22 December 2011 - 01:20 PM

Ill release "translator" gmws sources next release (+Opera support).


I gotta say that would be pretty sweet as I have been trying to incorporate
it into my server as well

Its been a bit tricky though and im sure the translator may help me out
Thanks so much for this!!! ::lmao::
  • 0
Main Languages - C++, Java, C#, PHP, SQL, GML

Other Projects
-> Writing a C++ game engine with SFML API
-> Custom C++ MySQL API
-> The Dying Dragon

Some guy making games for the hell of it :P
I also do lets plays on youtube My Channel

#26 Demion

Demion

    GMC Member

  • GMC Member
  • 46 posts

Posted 22 December 2011 - 01:25 PM

gmws doesn't work for me :S


Server / client with win32 gamemaker and 39dll (no html5) work for you? If problem only in gmws contact me privately.

Edited by Demion, 22 December 2011 - 01:28 PM.

  • 0

#27 Debels

Debels

    GMC Member

  • GMC Member
  • 2828 posts
  • Version:GM:Studio

Posted 22 December 2011 - 01:28 PM


gmws doesn't work for me :S


Server with win32 gamemaker and 39dll (no html5) work for you? If problem only in gmws contact me privately.


oh since it was set to your IP it didn't work XD. know it works
  • 0

This signature has been removed for being to awesome.


#28 Barling

Barling

    GMC Member

  • GMC Member
  • 125 posts

Posted 24 December 2011 - 08:26 PM

I get this error:

Error: WebSocket is not defined
Source File: http://127.0.0.1:512...ml5game/gmws.js
Line: 45


Line 45 of gmws.js:

Error: WebSocket is not defined
Source File: http://127.0.0.1:512...ml5game/gmws.js
Line: 45


whenever I use this in my game:
ws = gmws_connect("127.0.0.1", 8080);

EDIT:
Aw, it works in chrome.
I'm running Firefox 9.01.

Is websockets disabled in firefox or something?

Edited by Barling, 24 December 2011 - 11:22 PM.

  • 0

#29 Demion

Demion

    GMC Member

  • GMC Member
  • 46 posts

Posted 25 December 2011 - 03:17 AM

Is websockets disabled in firefox or something?

You are using latest release? Firefox uses MozWebSocket not WebSocket. But release v3 checks browser id and uses MozWebSocket for latest Firefox. Maybe problem in browser detect function. Ill check it and contact you later. Thanks.

Edited by Demion, 25 December 2011 - 04:05 AM.

  • 0

#30 Debels

Debels

    GMC Member

  • GMC Member
  • 2828 posts
  • Version:GM:Studio

Posted 25 December 2011 - 03:38 AM

You are using latest release? Firefox uses MozWebSocket not WebSocket. But release v3 checks browser id and uses MozWebSocket for latest Firefox. Maybe problem in browser detect function. Ill check it and contact you later. Thanks.


Demion MERRY CHRISTMAS!, keep up the good work with GM:WebSocket =D
  • 0

This signature has been removed for being to awesome.


#31 Barling

Barling

    GMC Member

  • GMC Member
  • 125 posts

Posted 26 December 2011 - 12:36 AM

Well..if you say your current version uses MozWebSocket...
I downloaded the example as of right now on your first post, and I don't see "MozWebSocket"
anywhere in the gmws.js file.

Could you possibly update your first post with the new gmws.js file?
  • 0

#32 Mailas

Mailas

    Send in the Mail

  • GMC Member
  • 5846 posts
  • Version:GM:Studio

Posted 29 December 2011 - 06:40 AM

Something is wrong with the translator.
I am unable to connect to it via my external IP, though I can connect to it if I use my local IP.

Ports are forwarded, firewall was off at the time.

www.canyouseeme.org confirmed that there was no service running on the translator.
I'm able to connect to my gm and my C++ server that run on port 8081, but not the translator which runs on 8080.
I can only connect to it locally...

Edited by Scylla, 29 December 2011 - 06:41 AM.

  • 0
omQasih.jpg

#33 Demion

Demion

    GMC Member

  • GMC Member
  • 46 posts

Posted 25 January 2012 - 01:14 AM

Hi. Thanks for responds in pm. I was very busy this month becuase of that no updates. I ll sure continue work on this project and release updates and sources as soon as possible. I need more reports about bugs etc. Thanks.
  • 0

#34 thedyingdragon

thedyingdragon

    GMC Member

  • GMC Member
  • 23 posts

Posted 25 January 2012 - 06:01 AM

Something is wrong with the translator.
I am unable to connect to it via my external IP, though I can connect to it if I use my local IP.

Ports are forwarded, firewall was off at the time.


I had a similar problem but found a solution you have to set the translator
to listen on your internal IP (192.168.*.*) and not localhost (127.0.0.1)
this also assumes your ports are forwarded correctly

example
use 192.168.0.200 8080 127.0.0.1 8081
instead of 127.0.0.1 8080 127.0.0.1 8081

--EDIT--
I also plan on making a batch script which will run the translator
with params set in the file for people who dont know how to do so via CMD.
I use different ports than the translator default and the batch is a one click start
which saves time and money! ... well at least the first one :(

Edited by thedyingdragon, 25 January 2012 - 02:13 PM.

  • 0
Main Languages - C++, Java, C#, PHP, SQL, GML

Other Projects
-> Writing a C++ game engine with SFML API
-> Custom C++ MySQL API
-> The Dying Dragon

Some guy making games for the hell of it :P
I also do lets plays on youtube My Channel

#35 thijsmie

thijsmie

    GMC Member

  • GMC Member
  • 29 posts

Posted 25 January 2012 - 06:28 PM

The links are down...
  • 0

#36 lukeescude

lukeescude

    GMC Member

  • GMC Member
  • 711 posts
  • Version:GM:Studio

Posted 26 January 2012 - 03:04 AM

Yeah, the links say your hosting sites have been seized.
  • 0
My 39dll Tutorial
GMechanism, a Game Maker extension for Online Highscores, Achievements, Chat Engine, INI Host, etc.
Posted Image

#37 Demion

Demion

    GMC Member

  • GMC Member
  • 46 posts

Posted 26 January 2012 - 08:12 AM

1 or 2 two links for each file working for me, but reuploaded anyway. New links in 1st post. Check it.
---
If you are using example (gmwsexample.zip) you need to replace extension (gmws.gex) there to latest version.

Edited by Demion, 26 January 2012 - 03:30 PM.

  • 0

#38 lukeescude

lukeescude

    GMC Member

  • GMC Member
  • 711 posts
  • Version:GM:Studio

Posted 27 January 2012 - 01:18 AM

Thank you!
  • 0
My 39dll Tutorial
GMechanism, a Game Maker extension for Online Highscores, Achievements, Chat Engine, INI Host, etc.
Posted Image

#39 lukeescude

lukeescude

    GMC Member

  • GMC Member
  • 711 posts
  • Version:GM:Studio

Posted 27 January 2012 - 04:47 AM

It doesn't seem like my server receiving the right kind of data... I'm trying to send it a simple int but it keeps receiving 0 from gmws.

Have you fully tested this?
  • 0
My 39dll Tutorial
GMechanism, a Game Maker extension for Online Highscores, Achievements, Chat Engine, INI Host, etc.
Posted Image

#40 thedyingdragon

thedyingdragon

    GMC Member

  • GMC Member
  • 23 posts

Posted 27 January 2012 - 05:25 AM

As promised Translator Batch File

Now I know its not much but I can be handy
Enjoy guys :P
  • 1
Main Languages - C++, Java, C#, PHP, SQL, GML

Other Projects
-> Writing a C++ game engine with SFML API
-> Custom C++ MySQL API
-> The Dying Dragon

Some guy making games for the hell of it :P
I also do lets plays on youtube My Channel

#41 lukeescude

lukeescude

    GMC Member

  • GMC Member
  • 711 posts
  • Version:GM:Studio

Posted 28 January 2012 - 09:59 PM

Ignore what I said earlier, I got it working... HTML5 game_id function returns 0 no matter what, it's a bug.


Is there a way for you to make the socket more efficient? Sometimes data will just build up, then the client will get a sudden burst of data spontaneously.
  • 0
My 39dll Tutorial
GMechanism, a Game Maker extension for Online Highscores, Achievements, Chat Engine, INI Host, etc.
Posted Image

#42 Demion

Demion

    GMC Member

  • GMC Member
  • 46 posts

Posted 29 January 2012 - 01:08 AM

Oh I understood what you mean. If client is idle (browser tab inactive) and then turns active it will get "a sudden burst of data". I am not JS coder and cant understand what causes this. As I know JS code should run when browser tab is idle (inactive). If someone can explain me about this "bug" or give some links to read sure I fix this (this is major problem).

Edited by Demion, 29 January 2012 - 01:27 AM.

  • 0

#43 lukeescude

lukeescude

    GMC Member

  • GMC Member
  • 711 posts
  • Version:GM:Studio

Posted 29 January 2012 - 05:54 AM

Other than that issue (which has nothing to do with your extension), your extension is quite nice, and works as advertised.

I've been porting my GMechanism API over to HTML5 using GMWS, so far it's going really well.
  • 0
My 39dll Tutorial
GMechanism, a Game Maker extension for Online Highscores, Achievements, Chat Engine, INI Host, etc.
Posted Image

#44 lukeescude

lukeescude

    GMC Member

  • GMC Member
  • 711 posts
  • Version:GM:Studio

Posted 29 January 2012 - 04:23 PM

Since websockets are slow, I tried using this to prevent the game from starting while the socket was still connecting:

while(gmws_get_state(server)!=1)
{
//empty space
}

But my server shows the HTML5 game connecting over and over again
  • 0
My 39dll Tutorial
GMechanism, a Game Maker extension for Online Highscores, Achievements, Chat Engine, INI Host, etc.
Posted Image

#45 Demion

Demion

    GMC Member

  • GMC Member
  • 46 posts

Posted 29 January 2012 - 09:04 PM

It shouldnt reconnect at all

function gmws_get_state(id)
{
if (!gmws_isWebsocket())
return -1;
return sockets[id].readyState;
}

What you mean by "websocket are slow"? I think websockets are fast enough. I ll make some tests with "a sudden burst of data" and get_state function. I want to figure out issue cause - GameMaker arhitecture or JS Html5.

Edited by Demion, 29 January 2012 - 09:04 PM.

  • 0

#46 lukeescude

lukeescude

    GMC Member

  • GMC Member
  • 711 posts
  • Version:GM:Studio

Posted 29 January 2012 - 11:44 PM

I meant slow in connecting - there's no way to tell exactly when it connects, I'm just having to set a 3 second timer between connection and gameplay.

It's all good though, I think I'm going to stick to PHP to communicate with my server.
  • 0
My 39dll Tutorial
GMechanism, a Game Maker extension for Online Highscores, Achievements, Chat Engine, INI Host, etc.
Posted Image

#47 oneSOB

oneSOB

    GMC Member

  • New Member
  • 33 posts

Posted 30 January 2012 - 07:00 PM

Sorry for delay. Ill release "translator" gmws sources next release (+Opera support). I was very busy last week. I hope Ill release it this weekends.


Its the end of Jan now what happen to GMWS translator source code? :confused:
  • 0
Our minds free from their prisons
That is the world I dream of

#48 Demion

Demion

    GMC Member

  • GMC Member
  • 46 posts

Posted 04 February 2012 - 05:00 AM

gmws Sources
As promised. Gmws (websocket protocol) c/cpp sources. They are not finished, not commented, not organised. Ill post it in 1st post when organise code better.
  • 0

#49 oneSOB

oneSOB

    GMC Member

  • New Member
  • 33 posts

Posted 09 February 2012 - 07:17 PM

gmws Sources
As promised. Gmws (websocket protocol) c/cpp sources. They are not finished, not commented, not organised. Ill post it in 1st post when organise code better.


Y i thank you very much good MR :medieval:
I appreciate this very much
have a good day

Edited by oneSOB, 09 February 2012 - 07:18 PM.

  • 0
Our minds free from their prisons
That is the world I dream of

#50 iceshield

iceshield

    GMC Member

  • GMC Member
  • 514 posts
  • Version:GM:Studio

Posted 19 February 2012 - 04:36 PM

why this is not working in firefox? :rolleyes: (it blocks at loading)
awsome , i'll start building a game on this extension right away :)
  • 0

If you put comments in your code to understand it ... then you awful at writing code.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users