The online racing simulator
Searching in All forums
(921 results)
DarkTimes
S2 licensed
I agree that which style you prefer doesn't matter, but you should pick a style and stick to it. Nothing uglier than a codebase where different contributors use different conventions. If the PHP language has an official style-guide you should use that.
DarkTimes
S2 licensed
Quote from BlueFlame :This difference is, aoun, how someone percieves a movie is purely opinion, how someone percieves fact is all the same opinion (or it should be) regarding Vettels fails, it's a FACT that he's done it more than once and it isn't his rookie season. It's fact, you can't percieve a fact any differently to anyone else, or else you using logic for your opinion.
Vettel is good at hot-lapping, nothing else.

No one disputes that he made a mistake, or that he's made similar mistakes before, but the idea that he is a bad driver or undeserving of a place in F1 is not a fact, just your opinion.
DarkTimes
S2 licensed
Quote from BlueFlame :Well he said it was a bump in the road. I say he's a complete cock that isn't worthy of an F1 drive. So many mistakes. Unbelievable that they still have him as a driver at Red Bull...

What on earth are you on? Sure, Vettel has made a few clumsy mistakes this year, but no one can deny that he's absolutely mighty behind the wheel. I know we keep saying this, but he is only 23 and this is only his third year of F1. He simply doesn't have the experience of Button, Webber, Alonso et al.. Of course he's going to make some mistakes.
Last edited by DarkTimes, .
DarkTimes
S2 licensed
Quote from ATC Quicksilver :The pressure of fighting for a title obviously exposes a drivers weaknesses, and the younger guys perhaps didn't realise they had those weaknesses.

I think that's a really interesting point. Every driver has weaknesses, but the more experienced know what they are and can drive around them. For the lesser experienced (Vettel is still only 23!), they are finding out where they are weak for the first time.
DarkTimes
S2 licensed
Woot! 20 minutes of rain predicted! It's on!
DarkTimes
S2 licensed
Karma working in F1 it seems.
DarkTimes
S2 licensed
Vettel fail!
DarkTimes
S2 licensed
Wow - Hamilton is pulling out an impressive lead. Still, hopefully there will be more rain.
DarkTimes
S2 licensed
An excellent free book that teaches programming and the C# programming language.

http://www.robmiles.com/c-yellow-book/
Last edited by DarkTimes, .
DarkTimes
S2 licensed
Glock was given a five place grid drop for blocking Yamamoto, and Trulli was fined 4400 euros for speeding in the pitlane.
DarkTimes
S2 licensed
Ah OK, that's cool. As I say, it just stuck out in the code as looking weird.

I've got the framework up and running here now and it seems to work great. My PHP skills are terrible, so I don't think I'll be able to contribute anything useful, but I might try to write a plugin when it's more complete.
DarkTimes
S2 licensed
I was looking through the source and a part of the code sent off some warning signals. In prism_packets.php from lines 47 to 58 there is this code:

if (isset($this->Type))
echo $TYPEs[$this->Type] . ' Object {' . PHP_EOL;
return;
echo $TYPEs[$this->Type] . ' Object {' . PHP_EOL;
foreach ($this as $property => $value)
{
$pkFnkFormat = $unPackFormat[++$propertyNumber];
# Assign the value to the unpacked packet.
$this->$property = $pkClass[$property];
echo "\t{$pkFnkFormat}\t{$property}\t= " . var_export($this->$property, TRUE) . PHP_EOL;
}
echo '}' . PHP_EOL;

The return statement on line 3 makes the rest of the code unreachable.

Edit: Yeah, the console output looks weird until you comment out those first three lines.
Last edited by DarkTimes, .
DarkTimes
S2 licensed
Quote from tinvek :non of them seem to have got the same benefit out of it as mclaren has.

I think that's cause McLaren built their car around it, while the other teams have had to tack it onto their existing designs. Also it seems most of the other drivers have to operate it with their hand, whereas the McLaren guys are able to use their braking leg, which would seem like another advantage.
DarkTimes
S2 licensed
Uploaded Spark 1.0.8 to the first post.

Changes
  • Fixed bug where host and port were missing from ConnectedEventArgs when the InSim.Connected event was raised by calling InSim.EndConnect.
  • Changed string encoding to use Encoding.Default (stopgap while I test my own string encoding code).
  • Added ParseCommand and TryParseCommand methods to StringHelper.
  • Added InSim.Unbind and InSim.IsBound methods.
  • Added MathHelper.Intersects and MathHelper.Contains methods.
  • Added more missing comments to packets (down to only 113 warnings of missing XML!)
  • Added optimizations to packet receive code.
  • Added protected BuildAllPackets property to InSim class, which when set to true will cause OnPacketReceived to be called on every packet.
Last edited by DarkTimes, .
DarkTimes
S2 licensed
Quote from pezia :I think a reasonably default for encoding is default

So Encoding.Default instead of ASCIIEncoding.ASCII.
This should do the job, since the client InSim apps mostly run on the same system as the InSim server.
Of course this is just a temp hack.

Yeah, that might be worth a try in the mean time. I've updated the development version.

Edit: Seems cool, nothing has exploded yet.
Last edited by DarkTimes, .
DarkTimes
S2 licensed
I don't know PHP, but it looks to me like you are just reading the first packet from the buffer on each receive call, so if multiple packets arrive in a single call only the first is getting processed. You need to read out all the completed packets from the buffer in turn, then store any incomplete packets so they can be completed on the next call. Basically you're treating TCP like UDP, instead of as a constant stream of data.
Last edited by DarkTimes, .
DarkTimes
S2 licensed
Cool.

Would it be possible to include a simple 'Hello, world!' example for nonces like me who don't know how it works? I know you're planning on writing full documentation, but just a snippet to get started would be useful.
DarkTimes
S2 licensed
I have uploaded a new version of the cruise example with much more logical code for the !sell, !buy, !send and !give commands.

Oh I also fixed a crash caused when you quit the server after having sold or given away a car.
Last edited by DarkTimes, .
DarkTimes
S2 licensed
What problems are you having?
DarkTimes
S2 licensed
I had a bit of a fiddle and uploaded another new version with some more features.
  • Added bonus and health
  • Made the onscreen display look cooler
  • Added !top command which shows a list of the top ten users
  • Changed !give to !send, and added new !give <username> <car> command
  • Added !stats <username> command, which will show you another users stats
  • Improved !showoff command output
I think I need to refactor the commands next, it's becoming a bit of an if-fest, I thought it was more readable at first, but now obviously I was wrong.
Last edited by DarkTimes, .
DarkTimes
S2 licensed
Well I like the LGPL license, as it allows anyone to make a closed source program that links to your library, but any changes (bug fixes or features) they add to the library itself need to be made public. That's the license I use and I think it's a happy medium.
DarkTimes
S2 licensed
I think Greedy Programmers License is unfair. Using GPL or LGPL isn't about being greedy (and greedy how?), it's about making sure the programs you release as open-source stay open-source. I have released my libraries under LGPL, not because I'm greedy, but because I want to make sure that any improvements or changes people make stay within the community. I open-source my programs as I want everyone to benefit from them, and I release them as GPL because I want everyone to benefit from the changes made to them as well. I don't see how that could classify me as a greedy programmer.
Last edited by DarkTimes, .
DarkTimes
S2 licensed
Yes thanks, you are correct!

This bug has arisen because of the change to using a database to store user info. In the previous XML version cars were stored as a collection of strings, but to work with the database I had to change them to a collection of Car objects. I did not catch the bug as it caused no compilation errors, the C# compiler decided to call the Car objects ToString() method instead, which is why it printed SparkCruise.Car.

To fix the bug you can update the CommandGarage method to this:

private void CommandGarage(User user, string[] args)
{
if (user.Cars.Any())
{
MessageTo(user, "Garage:");
foreach (var car in user.Cars)
{
var price = Dealer.GetCarPrice(car.Name);
MessageTo(user, "{0}: ${1}", car.Name, price);
}
}
else
{
MessageTo(user, "You do not own any cars");
}
}

I've uploaded a fixed version.
Last edited by DarkTimes, .
DarkTimes
S2 licensed
I have ported my cruise server example from Python over to C#. It is a very simple cruise server, where you drive around earning cash, which you can then spend on buying and selling cars.

This is not intended to be the worlds best cruise server, it's designed as an example of how to carry out lots of different InSim related tasks. Here is a rough list of the topics covered, in no particular order and from the top of my head.
  • Tracking users and players on a host
  • Persisting users between sessions using a SQL Compact database
  • Displaying user information using on-screen buttons
  • Handling commands of differing complexity (!buy, !sell, !give etc..)
  • Tracking the distance a user has travelled
  • Using timers to trigger events
  • Using LINQ to query user data
I wrote the code this morning, it isn't perfect and I've not had time to test it thoroughly, but it seems to work OK.

Anyway, you can download the project below.
Last edited by DarkTimes, .
FGED GREDG RDFGDR GSFDG