The online racing simulator
PHP5 - InSim Mod.
(120 posts, started )
I just had a moment where I was programming and realized that "I did not know that you could use PRISM in that way, but you can." I mean, a plugin _COULD_ connect to the relay to get information on another server, I don't know why you would want to do this, but if you REALLY wanted to you could. I did not mean for that function to be available, but it is! This was while I was working on the relay access part of the initialization sequence. I'm thinking, more, and more, and more that this should really be a module.
State of the PHPInSimMod
State of the PHPInSimMod.

I've just finished the packet abstraction code, that's 48 lines long and took me over 8 hours to complete (damn research). It allows the core devs, Myself, Ripnet, Morpha; to add packets very easily to the list should InSim get new packets in the future, with packet definitions being simplified to this in most cases:


<?php 
class IS_TINY extends Struct {
    const 
PACK 'CCCC';
    const 
UNPACK 'CSize/CType/CReqI/CZero';

    public 
$Size 4;
    public 
$Type ISP_TINY;
    public 
$ReqI;
    public 
$Zero;
}
?>

With the abstract class Struct containing all of the logic code for 95% of the packets, ISP_MCI, ISP_NLP & IRP_HOS being the odd balls, it makes it many times more easy to maintain code. The Struct class itself contains the unpack and pack functions, and even the constructor that has been simplified and made cross packet compatible. You can write to the object in any way that you wish, from directly editing the property one by one, to feeding it a bit stream and having it parse the information into it's self. It's also flexable on the way out, should you wish to make it a string (to send over the socket connection for example) the __toString magic method is already defined and will pack it self, and return it's value as if it where still just a bunch of bits. The only thing to add would be a single line, out of order expression handler, so I'll work on that next and the packet system will be done!
Sounds like a good call
Anyone have any good idea's for stress testing. I know we can run a replay at like 16x, but is there anything else that would be a good way to ensure that your program can handle a very heavy load?
Use raw recorded insim data instead of a replay.
Yeah, I've found that very useful in the past. Record some raw InSim data to file and then test against that. From file you can test a whole 40 lap race in less than a second.
Quote from DarkTimes :Yeah, I've found that very useful in the past. Record some raw InSim data to file and then test against that. From file you can test a whole 40 lap race in less than a second.

Damn ... I don't know how to even pass that information along to the program tho ... Do I just submit the data to the socket, or do I have to come up with some other kind of mechanism.
Best solution will be to run an InSim with Mysql data, 50ms interval from another machine (not from server hosting) and catch all events and make some math, database and files operations.
Quote from Dygear :Damn ... I don't know how to even pass that information along to the program tho ... Do I just submit the data to the socket, or do I have to come up with some other kind of mechanism.

Just make the socket code read from a file on disk.
Quote from Dygear :Damn ... I don't know how to even pass that information along to the program tho ... Do I just submit the data to the socket, or do I have to come up with some other kind of mechanism.

The way I've done it in the past if just to create a simple console app that writes all the socket receive data from LFS to a file. It's all byte data so you can just dump it straight out. You can load up LFS and let it record a bunch of InSim data straight onto disk.

You then just create a mock socket object, that instead of receiving socket data from LFS, just reads the data from the file. You can read the file data exactly as you read InSim packets, it's all just a stream of bytes.

This way it's very easy to test whole races, as it only takes a second or so for a modern PC to read a 40 lap race from disk, instead of having to go through the hassle of creating a socket, connecting to InSim and playing back a replay.
I just put in a request for a subforum here, I do hope everything will come together in the next few days with a release in the next 7 days for the general public.
I'm looking forward to this, PHP is my favourite language (and easy enough for me )
Quote from Nadeo4441 :I'm looking forward to this, PHP is my favourite language (and easy enough for me )

I do hope that the same can be said about the plugin API.
(That's yet to be written.)
SVN on the sf project page seems to be empty? Just wondering because I was planning on having a play with it over the weekend, regardless of what state it's in (and mirror it on github for a while also).
Quote from the_angry_angel :SVN on the sf project page seems to be empty? Just wondering because I was planning on having a play with it over the weekend, regardless of what state it's in (and mirror it on github for a while also).

As soon as the vote for the license is over, I'll post it on GitHub and SourceForge.

[edit] And seeing as you don't allow PMs I can't even send you a version without any license.
In that case I'll keep an eye on github
lol pic
Quote from the_angry_angel :In that case I'll keep an eye on github

Or you could give me your EMail , and I'll send you the link to the latest version.
Quote from Dygear :Or you could give me your EMail , and I'll send you the link to the latest version.


PHP5 - InSim Mod.
(120 posts, started )
FGED GREDG RDFGDR GSFDG