Game Development Community

Reading .cs file from the web

by Benjamin L. Grauer · in Torque Game Builder · 01/27/2007 (2:29 am) · 21 replies

It's just a random idea without any solid concept behind it, but I thought that would be nice if I could do something like this : exec("http://mygamesite.net/code.cs.dso")

It could really be great for dynamic content. Is there another way to achieve this ?
Page«First 1 2 Next»
#21
02/05/2007 (1:58 pm)
@Ben, I use the TCPObject when accessing HTTP sources, this allows me to send custom header information, such as my Client-Type --

Basically, doing so, requires you to know a little about how to interact with a web server -- using compliant methods, not server specific things --

When a request to a web-page is made, 'header' data is sent with that request by most all browsers, this header data can include a number of things, some of which may be ignored by some servers, some of which is 'standard' and looked for by all servers -- this data can include 'post back' data (when using the form method of "post" for example), as well as client features, client "name" strings, etc --

This is how "IE and Firefox" statistic pages work, basically, these browsers tell the web server that they are in fact IE or Firefox, and then the server usually has some mechanism that records this data, and the server logs are then parsed and statistics are recored -- most server-side scripting langauges also allow access to this 'server' data, such as PHP and ASP/ASP.NET

As for the time, there are functions called "getSimTime" and "getRealTime" defined in the TGB Reference, they return integer values representing the number of (milli?)seconds since the program started, or since the "epoch" respectively (the epoch, is usually system dependant in some cases -- ie; unix uses Jan 1st, 1971, windows however, usually refers to 1/1/1900 for "date/time" default value but windows may still use the 1971 date as its "epoch" for returning time-stamps in integer value)

You could then send this integer value, then convert it on the server-side or compare it to a server-side time-stamp ... it's usually best to compare it to a value within 5 minutes -- but to ensure that everything is "ok", it's also best to get the time for the server, then do your "special hidden" calculation, and send the value back -- a good example of "encrypting" the value would be to retrieve a numeric value from the server, such as a timestamp, and then multiply it by 3, divide it by 4 and then add 6 -- just a completely random algorithm, which you can hide somewhere nice and dirty in the source, so it's not so easy to "snoop" -- this algorithm, is of course, VERY easy to hack, but is preventative, non-the-less.
Page«First 1 2 Next»