HTTP processing script, ask me about it!

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,203
First Language
Binary
Primarily Uses
RMMZ
Hey there,

As you may/may not know, I have spent the past many many months writing and rewriting and optimizing and then rewriting my HTTP processing system.  (yes, many many rewrites) 

I am currently in the stage of writing up some good documentation for the system.  Most of the methods are already documented, but I want to ensure that there is more than enough information for those who seek it...

Anyway, I am currently writing an FAQ for the system, which features classic newb questions such as 'What is HTTP?' and 'How could using HTTP benefit me and my game?'.

But I want to add more into the documentation, so I ask you fine people to ask me any questions you may have about HTTP and what my system does and whatever else that could be related to these subjects. :)

Thanks ^_^
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,203
First Language
Binary
Primarily Uses
RMMZ

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
Ok let me shoot you! :p

So.

1] Is it client - server based? (Of course it is but it is good for a noob question. You should probably explain the model)

2] Do you have both scripts for client and server? ( Oh it is just a client that can contact a server (I assume) who supports ruby )

3] Does it communicate with an Apache server?

4] Can it communicate with PHP scripts?

5] Can this support MMO games or is lag an issue?
 

Sausage_Boi

Game Dev. "Artist."
Veteran
Joined
Sep 10, 2014
Messages
1,733
Reaction score
681
First Language
Americanese
Primarily Uses
RMVXA
So...how DOES HTTP benefit my game? I can think of some things I WANT to do, but unsure what this system is capable of...Also, is your HTTP script available?
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,203
First Language
Binary
Primarily Uses
RMMZ
1] Is it client - server based? (Of course it is but it is good for a noob question. You should probably explain the model)

2] Do you have both scripts for client and server? ( Oh it is just a client that can contact a server (I assume) who supports ruby )

3] Does it communicate with an Apache server?

4] Can it communicate with PHP scripts?

5] Can this support MMO games or is lag an issue?
1] - The 'client' is the current instance of the game that is connecting you an HTTP server.  For example, if your game is connecting to information on your own website, your game is the client, the website is the server. :)

2] - I have rewrote the core script a number of times and during that time, have also written some simple addon scripts ~ such as a script that determines the game client ip address and location and another script to autoupdate game files ;)

3] - It could yes.  I personally use it with an Abyss web server on my laptop and also with my real website host via ipage.com. :)

4] - Yep, thats the main point ~ to have your game interact with php scripts and SQL databases on your own server.

5] - Not at this time, but depending on the success/popularity of the system, I may be tempted to continue working towards such a goal.

Also, this depends on your personal definition of 'mmo games'. It would be possible to code a system for players to battle each other, but probably not for having 500 players on the same map having ABS style pvp battles ~ at least not until other restrictions of RM have been lifted, such as the rendering of graphics vs the processing of game logic (ie, the game loop functionality that is hidden in either the game exe or the dll)

So...how DOES HTTP benefit my game? I can think of some things I WANT to do, but unsure what this system is capable of...Also, is your HTTP script available?
You can use HTTP within your own games to provide features that are widely considered 'online features'.  

Using HTTP, it is extremely possible to have one players game interact with another players game. For example, sending mail from one player to another,

or even player trades... Additionally, HTTP could be used in conjunction with additional systems to create a peer 2 peer gaming environment. (that is not something it can do right now, nor is it my intention to do so at this time)

This being said, the features that are possible is a completely different thing from the features you are able to apply yourself. The more experienece you have with writing code, the better. :)

And no, it has not yet been released. I'm just finishing up documentation and ensuring everything is nice and clean, then I will have a think abut how i want to release it and when. :)
 

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
Dekita, what you make sounds fantastic. Really!

It isn't noob friendly, hell you need to know what you are about to do, but STILL this is great!

Hope it will finish soon to check it out.

Also... about security... is there any? :p

I know this is a killing question. :p
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,203
First Language
Binary
Primarily Uses
RMMZ
Yea, it really isnt newb friendly, but I am trying to provide enough documentation so that even newbs, providing they can read, should be able to benefit from the use of the system(s).  And I've also written a few 'sample' systems to go along with the main system, so people can see how to use it correctly. :)

Ummm... Define 'security' ? ;)

I mean, it can perform POST requests, which would help hide any HTTP request paths from miscellaneous hacking techniques, but if someone can get into your game and see the code, it would leave your server vulnerable <- providing the hacker knew how to manipulate your server data, this could be very bad.
 

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
Yea, it really isnt newb friendly, but I am trying to provide enough documentation so that even newbs, providing they can read, should be able to benefit from the use of the system(s).  And I've also written a few 'sample' systems to go along with the main system, so people can see how to use it correctly. :)

Ummm... Define 'security' ? ;)

I mean, it can perform POST requests, which would help hide any HTTP request paths from miscellaneous hacking techniques, but if someone can get into your game and see the code, it would leave your server vulnerable <- providing the hacker knew how to manipulate your server data, this could be very bad.
Yeah security is really a state of mind. That's how I define it.

What I am really asking is: 

Is it possible to implement advanced encryption methods, like digital signature for authentication and strong encryption methods to pass sensitive data hard to be decrypted?

Let's say you make a game that a server unites 5 players in a unified world.

So no lag.

But each player must have an account to play the game.

So you register online. To the website.

Then you start your client.

To enter the game you should provide username and password.

Can your script implement anti man-in-the-middle-attack measures?

Cause sensitive data are sensitive. 
 
Last edited by a moderator:

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,203
First Language
Binary
Primarily Uses
RMMZ
Is it possible to implement advanced encryption methods, like digital signature for authentication and strong encryption methods to pass sensitive data hard to be decrypted?
Yes, it is possible to compress/encode the information being sent in various ways, such as zlib. It is also possible to setup proxy servers and whatever else :)

Note: I have not tried, nor do plan to (at east not a proxy), any of these, but the possibility is there, just gotta define how you wanna encrypt the data before the request is processed ~ which I have been working very hard to make as easy as possible. ;)

Well, lag is all relative.  The clients internet connection, your servers processing power, other crap going on in the background of your cpu can all affect the phenomenon known as 'lag'... 

During my own tests, I have been sending a request to my localhost server (Abyss Web Server ~ offline server, thus, cutting out most of the server transmission delays) and reading the reply every frame (60 times per second). During this time I have not seen so much as a flicker of a frame or anything that would suggest lag to be a major problem, but that being said...

In order to have, for example, 5 players exploring in some cave you would need the following...

1 - a means of obtaining the player ~ done (can easily generate a unique user code for the player, or use their ip address against them ;) )

2 - a means of holding the party information ~ it is possible that this could be done using php and SQL servers; however, the processes involved currently elude me.

I mean, could have some SQL database that holds information on the current games 'online party list', where each element is an ip address or specific user id. Then, you have your database also hold information on the current 'online players party member actions'. 

then, in your game, you update the players online party member list thing, this gets the information of the other users and from there, you just have to transfer what the other user is doing to your own sql database, and then, re-read the data back into your game ~ thus, friend players character moves around in your game. :p

^ that, could become quite laggy, depending on how everything is handled.
 

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
Yes. lag depends deeply on the database architecture, structure and in which normal form it is. :p

Even on localhost a bad designed database will destroy the whole project.

It seems you are preparing a really neat piece of code!
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,203
First Language
Binary
Primarily Uses
RMMZ
oh yea, I have learned from my initial database structure that the approach i was taking just wasn't viable, so I changed it up a little.

There is currently a few modules that can be included within other modules and classes to easily process http logic for your game's systems. I just have to create a dedicated error handling class and finish the documentation and its all done.  Its a huge pain trying to reproduce all these random http errors :/

Additionally, should one wish to create an instance of an HTTP session, connection or request to allow the control over the request procedure, its already available. :)

Furthermore, performing an http request is easy as hell. Here is an example...

http_request = { pswzServerName: "www.mysite.com", pwszObjectName: "/MyPreciousFilePath/MyPhpScript.php",    pwszHeaders: "Content-Encoding: deflate",    dwHeadersLength: 1, }reply = HTTP::request(http_request) # < returns reply from server, encoded.Zlib::Inflate::inflate(reply)And like, thats for an encoded request with headers. , a basic request would be much more simple. :D
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Well for starters, I do want to know the answers to these questions

Anyway, I am currently writing an FAQ for the system, which features classic newb questions such as 'What is HTTP?' and 'How could using HTTP benefit me and my game?'.


But I want to add more into the documentation, so I ask you fine people to ask me any questions you may have about HTTP and what my system does and whatever else that could be related to these subjects.
 

erpicci

Villager
Member
Joined
Feb 3, 2015
Messages
29
Reaction score
21
First Language
Italian
Primarily Uses
First question I can think of is why using a TCP-based protocol (such as HTTP) instead of an UDP-based one? Indeed the ability to easily talk to a webserver is a big pro, just wondering whether there are other reasons.

Secondly, from the piece of script you posted, it seems that HTTP requests are synchronous... correct? Do you have a timeout mechanism to prevent game freezing in case the synchronization phase fails?

Does this support both HTTP/1.0 and HTTP/1.1?

Does this support HTTPS? (I think the answer should be clear from above comments, but maybe it is something you would like to add to a FAQs section)

Can you get connection-speed information at gametime (like latency)?

Some stats may also be interesting to check out.

Good luck for this project! Wondering whether you are looking for volountieers to try it and/or help with documentation/statistics?
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,203
First Language
Binary
Primarily Uses
RMMZ
@Engr. - (copy and paste from my faq

   
  Q: What is HTTP??
  A: The Hypertext Transfer Protocol (HTTP) is an application protocol for
     distributed, collaborative, hypermedia information systems. HTTP is the
     foundation of data communication for the World Wide Web.
     
     Hypertext is structured text that uses logical links (hyperlinks) between
     nodes containing text. HTTP is the protocol to exchange/transfer hypertext.
     
     See: http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol
     for additional information on HTTP and its functionality.
     
     In simple terms, HTTP allows one computer to interact with an online
     presence, whether that be another client server or a website is purely
     based on the competency of your code writing team.
     
     
     
  Q: How could HTTP benefit me, and my RPG Maker project?
  A: You can use HTTP within your own games to provide features that are widely
     considered as 'online features'.
     
     Using HTTP, it is extremely possible to have one players game interact with
     another players game. For example, sending mail from one player to another,
     or even player trades...
     
     Additionally, HTTP could be used in conjunction with additional systems to
     create a peer 2 peer gaming environment.
     
     This being said, the features that are possible is a completely different
     thing from the features you are able to apply yourself.
     The more experienece you have with writing code, the better.


@erpici - Awesome questions btw. ^_^

"First question I can think of is why using a TCP-based protocol (such as HTTP) instead of an UDP-based one?"

The reason for this is purely because when I first began researching how to transmit data online, all the immediate suggestions where for TCP, so hat is what I began to research. :p

That being said, I have been looking into UDP more and more, so who knows, I may eventually write some kind of UDP based transmission of data. :)

"Secondly, from the piece of script you posted, it seems that HTTP requests are synchronous... correct? Do you have a timeout mechanism to prevent game freezing in case the synchronization phase fails?"

Yes, the example I posted above is using regular synchronization. I am currently testing and making sure that asyncronous requests also work ~ having lil issue with the callback, but ill get it eventually.  But yes, there is the ability to set the timeout for your request. ^_^

"Does this support both HTTP/1.0 and HTTP/1.1? Does this support HTTPS?"

Not tried with 1.0, but it should.  The dll it interacts with does support 1.0.  Obviously, I use 1.1 and it works fine.  And yes HTTPS is available. ^_^

"Can you get connection-speed information at gametime (like latency)? Some stats may also be interesting to check out."

Not tried tbh. Certainly possible ~ ill read up on how such information is normally attained.  Probably possible to just timecheck before the request, and then timecheck after, - old from new = ping. :p

"Good luck for this project! Wondering whether you are looking for volunteers to try it and/or help with documentation/statistics?"

Thanks, I've been working really hard trying to figure all this crap out for years now :D

And I suppose, that would depend on what kinda help people can offer :p
 

gRaViJa

Veteran
Veteran
Joined
Mar 16, 2012
Messages
882
Reaction score
398
First Language
Dutch
Can you use it to extract a variable from the game (a high score for example) and save it in a mysql database?

Can you use it to build a global high score system within the game itself?
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,203
First Language
Binary
Primarily Uses
RMMZ
Yes and yes. :)
 

erpicci

Villager
Member
Joined
Feb 3, 2015
Messages
29
Reaction score
21
First Language
Italian
Primarily Uses
Other non-trivial questions I thought of:

Whether a tool is going to be used for conformance checking against [things like] RFC2616

Support for parallel connections

Optional tunable parameters (like some window size, or things for the underlying TCP level)

Thanks, I've been working really hard trying to figure all this crap out for years now :D
And I suppose, that would depend on what kinda help people can offer :p
I don't know about "people", but this cyborg would love to contribute, in fact. I can help with code (expecially C), documentation, translation... or if you need a softer help, just benchmarks/statistics when the product is ready. Or other things, depending on what needs to be done.

In any case, good luck for this project! Network is definitively something missing in RPG Maker.
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,203
First Language
Binary
Primarily Uses
RMMZ
@erpicci - Dude, you know too much. :D

What are you doing lurking around RPG Maker forums with kinda knowledge of networking?

I must say though, your question has confused me slightly...

"Optional tunable parameters (like some window size, or things for the underlying TCP level)" <- TCP objects dont uhh, have a window... ;)

If you mean are you able to create an instance of, for example, an 'HTTP::Request' object, then yes, you are ~ from there there is many means of controlling the actual object and one could (if desired) create a subclass of HTTP::Request with additional logic and use their own subclass for performing the actual request. 

"Support for parallel connections" <- You can create an instance of a 'HTTP::Connect' object (the HTTP connection) and store it in some variable to use at [x] point in time for performing whatever request.  It is possible to create more than one connection object. :)

"Whether a tool is going to be used for conformance checking against [things like] RFC2616" -< Not sure what you mean about a 'tool'.  I wasnt planning on including any external tools for anything.  I'm trying to keep everything pure ruby (except for the windows dll calls obviously) -> Even sat for days at a time trying to figure out how to convert C code into ruby ~ however, I am still fighting with whether it would be best to use 'pure ruby' or whether i would be best  :D

Anyway, could you elaborate a little on what you mean with this one?

And yea, networking in RM is something that could have made a lot of games, a whole lot better ~ and would have also saved me years of my life... but anyway. How are you with the conversion of C types into ruby format?  like, would you be able to construct some C type in ruby successfully? *fingers crossed* lol


@gravija ~ yea, i knew you knew, which is why i kept the answer short n sweet :p

I was gonna copy and reply the answers from my FAQ, but I dont wanna post that until the system is just about to be released :D
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,868
Messages
1,017,066
Members
137,576
Latest member
SadaSoda
Top