The online racing simulator
Searching in All forums
(983 results)
Dygear
S3 licensed
As with the case of the global PRISM object. Victor and I did this in 0.3.0 because it just made everything so much easier. There is no One True Way, but we should provide a consistent experience as best as we can.
Dygear
S3 licensed
I was thinking about that myself, as far as conflict goes. I was thinking that I should make the plugins object have another property called database, or db. From there you'll have access to all of the Databases that are registered to that plugin.
insim:// Web-based Protocol Handler
Dygear
S3 licensed
On the subject of JavaScript as a InSim parser, I also found that you can make a web-protocol handler. Submitting a JavaScript InSim client to the Chrome store or to Mozilla's store could be quite interesting. If we also register a protocol handler, it would be quite easy for someone to see what is going on in a game at any given time from any web browser.
Dygear
S3 licensed
Quote from GeForz :Just a sidenote:

Pleas DO NOT use GLOBALS

thanks

Are you talking to me / victor or to the plugin developers?
Dygear
S3 licensed
Yeah, just send them my way, I'll take a look.
Dygear
S3 licensed
Quote from the_angry_angel :Regardless https://github.com/pgriess/node-jspack might be interesting if someone is considering taking this somewhere and is familiar with perl/php's pack/unpack.

That's funny you should say that, because I was thinking that if I made a php like pack, unpack function for JavaScript that I would be able to do this quite easily. Now that it's right in front of me, it's kinda hard to say no to this.

Quote from the_angry_angel :I've got a couple of other bits and bobs that I'd squirreled away as notes, but I cannot seem to lay my hands on them right this second

Any notes would be appreciated.
Dygear
S3 licensed
This is why I release all of my stuff under the MIT license.
Dygear
S3 licensed
Like admins, but with a nother level, sure, I can do that.

Before we get to 0.5.0 I want to have support for WebSockets and include a MetaSim plugin.
Last edited by Dygear, .
Dygear
S3 licensed
Yeah, but it might be interesting for like a web client ... Even if the max concurrent is 8, it still would be pretty cool to see. I don't really see there being more then 8 admins on a server at a time anyway.
Dygear
S3 licensed
Consider this C structure:

struct someStruct {
unsigned long id;
char username[16];
float amountDue;
};

You can access a buffer containing data in this format like this:

var buffer = new ArrayBuffer(24);
// ... read the data into the buffer ...
var idView = new Uint32Array(buffer, 0, 1);
var usernameView = new Uint8Array(buffer, 4, 16);
var amountDueView = new Float32Array(buffer, 20, 1);

In the case of say, the ISP_TINY packet, that looks like this:
struct ISP_TINY {
byte Size = 4;
byte Type = ISP_TINY;
byte SubT = NULL;
byte ReqI = NULL;
};

var Packet = new ArrayBuffer(256);
var Size = new UInt8Array(Packet, 0, 1);
var Type = new UInt8Array(Packet, 1, 1);
var SubT = new UInt8Array(Packet, 2, 1);
var ReqI = new UInt8Array(Packet, 3, 1);

A pure JavaScript InSim Application?
Dygear
S3 licensed
It seems that this is now possible with the new WebSockets API object, and use of JavaScript Typed Arrays. We should be able to send Binary over the wire to say ... Connect to InSim. I'm interested to see where this could go, it could offer a live view of any game that can't be matched by any server side option.
Last edited by Dygear, .
Dygear
S3 licensed
You see now, if I put it into say, $PRISM->database, that's where it would stay. From there you could do ... $db &= $PRISM->database['users'] to return the user database ... But I think that having this instance out for PRISM and then for anyone else might be a better option. So we could have like $PRISM->database['PRISM'] for all of the PRISM core databases, like the admin, hosts, commands, ect table. The SQL would work as the as a replacement for the config files, or could be used in conjunction with the config files. I really want to enforce permissions for the plugin level database access, so that plugins can't steal other plugins data. I think that would provide a reasonable level of security.
Last edited by Dygear, .
Dygear
S3 licensed
Ok, so next version, the LFS Strings class that morpha worked on, and database support, and speaking of.

I was thinking of ways to handle this, and I have an idea that I'm not sure any of you are going to like. I was thinking that I would make the database a global object where it's name is it's variable. So if in your config file you make a varable called ... users, you could then do this within your plugin to get access to your users database.


<?php 
public function getUsers() {
  global 
$users;
  
$users->query('SELECT * FROM `users`;');
}
?>

Not sure if that's really a good solution in the long run tho ... what if for example two plugins use the class name users, what am I going to do about that then? I'll have to think of something else.

Quote from GeForz :The second-to last point should have really been "Added tracking of outbound packets"

Yeah, I need to refractor that slightly also.
Last edited by Dygear, .
Dygear
S3 licensed
Quote from DarkTimes :
function getFileExtension(filename) {
return filename.split('.').pop();
}


:fence:, you win this round, but there will be others!


<?php 
function isFileType(fileNamefileType) {
    return (
fileName.split('.').pop() == fileType);
}
?>

Dygear
S3 licensed
As you said, PHP, I'll also chime in with ...

PHP 5 also has built in support for SQLite, and can also be used very simply with the functions available to you.
Dygear
S3 licensed

<?php 
function isFileType(fileNamefileType) {
    return (
fileName.substr(fileName.lastIndexOf('.')) == fileType);
}
function 
isSetupFile(fileName) {
    return 
isFileType(fileName'.set');
}
echo ((
isSetupFile(file)) ? 'Is' 'Not') + ' a setup file.';
?>

:bath:
Dygear
S3 licensed
I'm sure this will be helpful to someone, thanks!
Dygear
S3 licensed
Quote from Krammeh :

<?php 
  $newuser 
=& datamanager_init('User'$vbulletinERRTYPE_ARRAY);
  
$newuser->set('username'$username);
  
$newuser->set('email'$email);
  
$newuser->set('password'$password);
  
$newuser->set('usergroupid'2);

  if (
count($newuser->errors)>0) {
    
// handle the error (duplicate username, duplicate email)
  
} else {
    
// user created
    
$newuserid $newuser->save();
  }
?>


Cool! What file did you have to include to ensure that you had this datamangager_init class? (Just so others will know should they find this on the internet.)
Dygear
S3 licensed
I second that, StackOverflow is pretty awesome.
Dygear
S3 licensed
I think they made the complex string version much faster by PHP 5, so that it's at least on par with '.', no idea what it is now days with PHP 5.3, or 5.4.
Dygear
S3 licensed
Quote from learjet45 :DarkTimes I love you! Thanks for the update!

DarkTimes is on the cusp of getting groupies.
Dygear
S3 licensed
That's a fantastic idea. +20!
Dygear
S3 licensed
Added the change log, let me know what you think!
Dygear
S3 licensed
Do you have a vB license? Just read the source code for the login page, and follow that around, it should tell you what you need to do as far as SQL querys.
Dygear
S3 licensed
When I get around it, I'll do some benchmarks. But seeing as it uses one instruction to read the data as apposed to two, I would say that it should be twice as fast. But I'll get some hard data and see what it is.
FGED GREDG RDFGDR GSFDG