The online racing simulator
DLFSS Project, OpenSource
1
(32 posts, started )
DLFSS Project
-
(Greenseed) DELETED by Greenseed
-
(Greenseed) DELETED by Greenseed
-
(Greenseed) DELETED by Greenseed : no more purpose
Patch [console command] - Announcement
Hi Greenseed,

I'm glad to add a patch to the project.

The patch allow the user to type a message announcement in the console command. He can specify on which server the message will appear or simply send it to all of them.


P.S. It could be great if I could upload a ".patch" file, I renamed this one in .txt.
Attached files
Announcement.txt - 2.7 KB - 260 views
Hehe! very happy to see you there my friend!

Your patch as been applyed: revision 26, thx you!

I had to add a "try,catch" on the string conversion! apparentely is the way to check if a string is from a certain numeric type!

Ho! and i added some Syntax help! i think your forget that! haha!
Quote from Greenseed :I had to add a "try,catch" on the string conversion! apparentely is the way to check if a string is from a certain numeric type!



private bool isNumeric(string val, System.Globalization.NumberStyles NumberStyle)
{
Double result;
System.Globalization.CultureInfo c = new System.Globalization.CultureInfo("en-US");
c.NumberFormat.CurrencyDecimalSeparator = ".";
return Double.TryParse(val, NumberStyle, c, out result);
}

Try that?
Quote from traxxion :
Try that?

this is doing same thing, i mean a Try,Catch , but in fact i think there is maybe more,for sure "TryParse" has a "try,catch" inside somewhere.

Have to read on the Globalization, but you know playing with "String Format", is allways A very slow thing... so i prefer keeping the simple "try,catch". but many thx for your input! i learned something that can be usefull somewhere else

Diff between Convert and Parse, are, Parse can Format and Convert no, so im pretty sure if we tick time a while loop for 1000000 time, she will reveal, Convert faster! and both report Exception on Overflow!

i have to tell my self that a exception is not allways a bad thing into a "Safe Environement" as c# use to be! i just terribly fear try,catch! i was thinked there where slow! but since i found that they exist a "Unhandled Exception Event" so mean everything is into a BIG try,catch! It only my poinr of view not fact!


On this, i continue to talk too much!

see ya!
Quote from traxxion :
Try that?

Well, in our case we need the fastest way to check if the variable fit as a serverId, if not we don't need it at all.
Patch [console command] - Status
- Adding a console command called "status". Used to return the session Status between servers.

- Move the Ping processing from server.cs to session.cs and completed the code.

- Adding a processpacket(packetTyny) Method to manage incomming Ping.
Attached files
status.txt - 6.9 KB - 236 views
Hello Forcemagic, thx for your patch.

Added revision 30.
Patch [Dynamic Config System] - Collect settings in the config file
This patch allow the user to change the settings of his server in a ".cfg" file.

For the moment, this patch only collect and store the data from ".cfg" file, it doesn't use it yet.

The data collecting is executed after the Log is initialized in the Main loop.
Attached files
dyn_config_system.txt - 12.2 KB - 249 views
Added to revision 33. Thx! dude!
Patch [Dynamic Config System] - Little changes
Added: to Revision: 35, Thx ForceMagic.

Your patch pose me a good question, since we will Make the config Dynamic, i mean during run operation, will be possible to change config, without restarting the application.

So all config variable must be access the fastes way. so Here is my question:

Witch is the more faster between:
private int config = 0;

int Config{get config;} OR
int GetConfig(){return config;}, Personaly i prefer this one, since im not very use to proprety.

Witch one is Faster?
Do have have to benchmark my self?, let see!
Same thing !
Quote from Greenseed :
[...]
Witch is the more faster between:
private int config = 0;

int Config{get config;} OR
int GetConfig(){return config;}, Personaly i prefer this one, since im not very use to proprety.

Witch one is Faster?
Do have have to benchmark my self?, let see!

Hey Green !

I just tested both way and it gave me the same result ! So I guess the VS compilator interprets and compile both the same way

There is the console result of the tests :


Benchmarking 2 way to Get a value
Using Function :
1st tick : 633531543717656250
2nd tick : 633531543717656250
difference between them : 0
Port Number I Got : 29999

Using Property :
1st tick : 633531543717656250
2nd tick : 633531543717656250
difference between them :0
Port Number I Got : 29999

And there is the code I use to do it.


long tickbefore = 0;
long tickAfter = 0;
long tickResult = 0;
ushort _portNumber = 0;
log.normal("2 way of Get benchmark \r\n" + "Using Function : ");

tickbefore = DateTime.Now.Ticks;
_portNumber = Config.ServerConfigStruct.GetPortNumber();
tickAfter = DateTime.Now.Ticks;
tickResult = tickAfter - tickbefore;
log.normal("\r\n" + Convert.ToString(tickbefore) +
"\r\n" + Convert.ToString(tickAfter) +
"\r\n" + Convert.ToString(tickResult) +
"\r\n" + Convert.ToString(_portNumber));

log.normal("\r\n Using Property : ");
tickbefore = DateTime.Now.Ticks;
_portNumber = Config.ServerConfigStruct.PortNumber;
tickAfter = DateTime.Now.Ticks;
tickResult = tickAfter - tickbefore;
log.normal("\r\n" + Convert.ToString(tickbefore) +
"\r\n" + Convert.ToString(tickAfter) +
"\r\n" + Convert.ToString(tickResult) +
"\r\n" + Convert.ToString(_portNumber));



So you decide what we use ! but personnaly I think I prefer Property.
First it was made for that Also it's more compact and clean in the code.

Don't you think ?


public static ushort PortNumber
{
get { return portNumber; }
set { portNumber = value; }
}


public static ushort GetPortNumber()
{
return portNumber;
}

public static void SetPortNumber(ushort value)
{
portNumber = value;
}

I also tested the Set and I had the same result
ok greensed told me here. So do you suggest i download the source and start playing around with it?
Quote from master_lfs.5101 :ok greensed told me here. So do you suggest i download the source and start playing around with it?

Hello, first I'm glad you decided to try out in our project !

I know I'm not Greenseed haha ! but what you've proposed is an excellent idea. You will be able to read the code and look how it works. So the SVN part it's a good start.

In open source project the communication is very important and we follow some coding standards of course.

I think the main points are to :

- write a code talking by itself

- when you write a comment about the code, if it's necessary, then write why instead of how.

- we try to use same kind of declaration everywhere.
Exemple : Constant declaration in caps lock with underscore between word.

- have fun doing this and we take our time to provide best code we can. It's not a race, lol, but you'll see, when you're in it grow pretty fast

It's a learning project, so like I said let's have fun doing it during we improve our skill.

For faster and easier communication, of course we will use program like Spark (a kind of MSN) or anything else.

I'll let Greenseed say something else and complete what I said.

Have a nice day !
hmm. how about you guys use googletalk? i will make u guys accounts. and then downlaod google talk and login. itll be a private server. running off of my googleapps account
We allready have solution for Chat/Talk/Phone and Video.

Here is:

Jabber XMPP(IM, VOIP, Video) network:
I sugest you use this client -> http://www.igniterealtime.org/downloads/index.jsp#spark , who si free and openSource.

Server: jabber.aleajecta.com , just have to create your self a account with Spark. P.S. my jabber network Accept Transport for: XMPP, MSN, Yahoo, ICQ, BuddyChat, Google Talk(Alpha) and more.

It free simple and have a lot of cool feature.

I also have a Forum: www.aleajecta.com/forum , this is more about World Of Warcraft, but on the need i can create Section for this project! if ever he need it.

Asterisk Aleajecta PSTN/VOIP/Video -> Private -> voip.aleajecta.com

MIRC Chat -> irc.aleajecta.com port: 41410


If you connect on with Spark, just do a search for "*" as username, he will show you the complete list! from there choses your friend
uh. one question. where do i get irc + jabber servers

edit: may i use a diferent jabber client? i've had a bd expierence with spark.
Quote from Greenseed :Server: jabber.aleajecta.com , just have to create your self a account with Spark.

MIRC Chat -> irc.aleajecta.com port: 41410

Most popular jabber client will work, but i don't permit custom Client working, only popular one! for secure reason.

"PSi" is a good example of another Jabber popular client working on my network.
Patch - [Config system]
- Change the serverId for the serverName everywhere.

- Remove InSimSettings class to use the data from the config class.

P.S. I mess up a bit with the dictionnary in Config.cs. I got a KeyNotFoundException when I add a key to the dictionnary. Hope you will be better than me to arrange that, I'm kinda confuse!
Attached files
dyn_config_system_2.txt - 34.4 KB - 228 views
Im pretty questioning my self about config system, do we go Specific aproch that run very good on this project and had some rock and roll to it. or do we create a generic config system.

So as you know Forcemagic, i was working on another project and i needed a config system too, i was about to try your system, but i found it was very much design to work only with DLFSS, with some modification i can be able to manage, but since i wan to answer to the first question, i created a generic config system.

I call it "4dot" config.

Here is the config File with explanation how to use.
odbc2mysql.cfg.txt

And here is the source code of the config reader, class implementation are not that good or bad... i don't know.... im still learning how is best with c#.
config_reader.cs.txt

And here is a bit of code showing how i use it.

public static class TransferInterface
{
private static List<Table> ...
private static void Initialize()
{
List<string> odbcFormat = ConfigReader.GetIdentifierList("ODBC","TableFormat");
List<string> mysqlQuery = ConfigReader.GetIdentifierList("MySQL", "TableInsertQuery");

List<string>.Enumerator itr_f = odbcFormat.GetEnumerator();
List<string>.Enumerator itr_i = odbcFormat.GetEnumerator();
while (itr_f.MoveNext() && itr_i.MoveNext())
{
tableList.Add(new Table
(
itr_f.Current,
ConfigReader.GetStringValue("ODBC", "TableFormat", itr_f.Current),
ConfigReader.GetStringValue("MySQL", "TableInsertQuery", itr_i.Current)
));
...

This example show how i call to Custom Config Identifier... So i ask for the list first and then iterate it. Into the example i do 2 into the same time.


I will wait you see my code, before doing any action to the SVN... i think we must discuct that into private will be best!

P.S. The Regex into the configReader can be much better, allready got another one. Ho! and Don't bother to try password "dexxa" on mysql server
Attached files
odbc2mysql.cfg.txt - 5.5 KB - 325 views
config_reader.cs.txt - 13.1 KB - 216 views
Ok, i added this Generic Config, removed Server Class and readded MySQL since MONO has 100% support for it, tested and working as a charm!

So next task will be getting SQLite and MySQL online.

P.S. read the SVN log , sice i changed a lot of thing when removing InSImSetting and Server Class.
About your benchmark ForceMagic, is not good , since your are using a ConsoleWrite with it... so in fact your are benchmarking the ConsoleWrite.


Inside the loop must has nothing except what you wan to benchmark... and do it as into real life is duration is about 5 seconde not too more and too less and do absolute nothing with your computer during thoses 5 seconde... event like this thoses are very poor test... but can gave a good idea!


while(<5second)
{
count++
string temp = Getvalue();
}
How many can we count?

you can too do it with a specified count like 1000000 and calculate the time, it about same!

Last version tested !
I tested the lastest version, which is pretty cool.
There are a lot of more news features really usefull for a racer in game. I'm a bit busy with university right now, but I will find something cool to add for sure

Nice job Greenseed !
Thx! for you encouragement! hihi!

Yes! i found too, that the project is now into a upper level of usage! i can't event go now without some Event, like the Vote system or the simple Track Prefix.

Im planning Statistique output, from InGame and HTML/CSS, im still evoluating my idea of how i present this, and what i presente!

And for other feature, seriously, i think i have a big miss! i mean i don't think about good idea!

So it maybe time for me to release a revision into unofficial addons, so i can get User review and user Sugestion... this is pure gold at this point.

Why i did not make that, is i don't wan to explain how to install MySQL and is still too Soon to build the SQLIte DB, i can but will be loose of time!

So im separated, i need thoses user review and sugestion, but...

Maybe you will find thoses word, that will motivate me!
1

DLFSS Project, OpenSource
(32 posts, started )
FGED GREDG RDFGDR GSFDG