[Request]Loading Guilds

11/11/2008 19:54 YukiXian#1
Someone can help me with loading guils from Ini files? And creating them on Ini files?
11/11/2008 22:21 tao4229#2
I'd help you if you actually knew stuff about .ini files..
And didn't just want to teh leach.
11/12/2008 08:29 YukiXian#3
Quote:
Originally Posted by tao4229 View Post
I'd help you if you actually knew stuff about .ini files..
And didn't just want to teh leach.
Lol, well,,, I'f got this :
Code:
uint UID = 0;
            string GuildName = "";
            uint GuildFund = 0;
            int GWWins = 0;
            int HoldingPole = 0;
            uint MembersCount = 0;
            string Bulletin = "";
            string Allies = "";
            string Enemies = "";
            string GuildLeader = "";
            string MemberNames = "";
            string DeputyLeaders = "";

            string[] DMembs = MemberNames.Split('.');
            string[] DDLs = DeputyLeaders.Split('.');

            string[] GFile = File.ReadAllLines(System.Windows.Forms.Application.StartupPath + @"\Others\Guilds.ini");
            GUILDS = new string[GFile.Length][];
            for (int i = 0; i < GFile.Length; i++)
            {
                string[] Splitter = GFile[i].Split('\n');

                Splitter[0] = "[" + Convert.ToString(UID) + "]";
                Splitter[1] = GuildName;
                Splitter[2] = Convert.ToString(GuildFund);
                Splitter[3] = Convert.ToString(GWWins);
                Splitter[4] = Convert.ToString(HoldingPole);
                Splitter[5] = Convert.ToString(MembersCount);
                Splitter[6] = Bulletin;
                Splitter[7] = Allies;
                Splitter[8] = Enemies;
                Splitter[9] = GuildLeader;
                Splitter[10] = MemberNames;
                Splitter[11] = DeputyLeaders;

            }
Edit * : And I'f already got everything else into Ini's exept Guilds,,,,
11/12/2008 08:57 unknownone#4
Question: Why would you want to store guilds in an ini file?
11/12/2008 10:13 Tw3ak#5
LOL @ all the usage of strings
11/12/2008 12:08 DragonStar#6
Quote:
Originally Posted by YukiXian View Post
Lol, well,,, I'f got this :
Code:
uint UID = 0;
            string GuildName = "";
            uint GuildFund = 0;
            int GWWins = 0;
            int HoldingPole = 0;
            uint MembersCount = 0;
            string Bulletin = "";
            string Allies = "";
            string Enemies = "";
            string GuildLeader = "";
            string MemberNames = "";
            string DeputyLeaders = "";

            string[] DMembs = MemberNames.Split('.');
            string[] DDLs = DeputyLeaders.Split('.');

            string[] GFile = File.ReadAllLines(System.Windows.Forms.Application.StartupPath + @"\Others\Guilds.ini");
            GUILDS = new string[GFile.Length][];
            for (int i = 0; i < GFile.Length; i++)
            {
                string[] Splitter = GFile[i].Split('\n');

                Splitter[0] = "[" + Convert.ToString(UID) + "]";
                Splitter[1] = GuildName;
                Splitter[2] = Convert.ToString(GuildFund);
                Splitter[3] = Convert.ToString(GWWins);
                Splitter[4] = Convert.ToString(HoldingPole);
                Splitter[5] = Convert.ToString(MembersCount);
                Splitter[6] = Bulletin;
                Splitter[7] = Allies;
                Splitter[8] = Enemies;
                Splitter[9] = GuildLeader;
                Splitter[10] = MemberNames;
                Splitter[11] = DeputyLeaders;

            }
Edit * : And I'f already got everything else into Ini's exept Guilds,,,,


wth O.o
11/12/2008 15:26 YukiXian#7
Quote:
Originally Posted by unknownone View Post
Question: Why would you want to store guilds in an ini file?
Cuz I want them all into Ini,
11/12/2008 15:37 unknownone#8
Yeah, I figured from the question that you want to, I'm asking WHY?
What advantage are you trying to gain from doing so?
I could probably easily list 20 reasons why not to use an ini file for this purpose. Only trying to give advice.
11/12/2008 17:40 YukiXian#9
Quote:
Originally Posted by unknownone View Post
Yeah, I figured from the question that you want to, I'm asking WHY?
What advantage are you trying to gain from doing so?
I could probably easily list 20 reasons why not to use an ini file for this purpose. Only trying to give advice.
Because I'm using Ini's for everything else too. So I only need the Ini Guilds.
I made them Ini's so I don't have that stupid MySQL Frozen thingy.
And in my opinion a Ini file is easyr to edit...
11/12/2008 18:12 unknownone#10
You should only use plain text files for data that doesn't need constant accessing, i.e. certain server settings, or data that is only loaded into memory on server startup and doesn't change while the server is running. Having data like guilds, which needs constant updating is really going to slow you down. While it might seem quick enough now, as the data in those files builds up, it'll take increaingly longer to find or edit something.

Plain text files are a major slowdown when modifying, because you can't just insert your few bytes of data where they need to be, instead, you need to copy the whole content of the file just to insert a small amount of data. Imagine now, you have a few hundred/thousand entries in that file - it's going to take an awful long time to modify. Your server will become unplayable in no time.

Reading from ini files isn't exactly quick either - you need to do a full on search every time. While you might be able to come up with a decent search algorithm, I doubt it'll match the performance an stability of MySQL or other DB. You're just going to be giving yourself an awful lot of work for no gain.

Now, the "easy editing" idea of ini files you have is a blatant misjudgement. Firstly, how do you find entries to edit? Sure you can find a guild by name, but what about finding guilds that have a certain number of members, or a negative fund etc. It's not going to be very simple.
Once you have found your data, what if you accidentally make a typo, for example, sticking an special character where it shouldn't be. Your code will cry, your server will crash. There's no validation checking on such things, unless you code it yourself - not worth the effort.
Now, you have your ini file, but you decide one day that, you need to add an extra field to guilds (ie, a patch adds something). Now you're fucked, because you're gonna have to do a rewrite of code, write a script that will convert the old format to the new one and copy all the data accross. It's an unmaintainable format.

Now, I'm not saying "use MySQL", although I'd reccomend it, but ini files are not the solution. Have you considered using PostgreSQL for example? It's much more stable than MySQL when handling multiple connections, timeouts etc, but has significantly slower access time (still quick enough for a game server).
Another solution might be to use SQLLite, which doesn't require a server, it just uses a plain file for the database.
Or, if you really do believe you should do everything yourself, a text file is definitely not the solution. What you need, is a random access/binary file, which, rather than inserting data at an arbitrary location, you can append it at the end, or insert into empty space, and you have a "table" saying where everything is. This is essentially what a database is doing, only a DB is much more verbose.

Not sure how you convinced yourself that using ini's would be a good idea, or if someone else convinced you, I think they were probably taking the piss. Stop while your ahead - MySQL is stable enough, you just need to fix what's wrong with it. (Official servers run on MySQL, they don't freeze up)
11/12/2008 18:19 xprincex#11
If He wants to put it into ini files dont flame him for it. Dont come in here tao and flame ppl for leeching and other stuff when u dont have the right cause i can rember some stupid questions you have asked many times. Tho my project is in vb.net i cant help with c# but i hope Yuki hope u can get it done.

As u may know the popular server HCO was all flat files.
And i am sure Acid is again all flat files cause Hybrid is the main coder
11/13/2008 01:52 InfamousNoone#12
@unknown:

Like I said, nobody wants to figure out the problem with it because LOTF is garbage and anyone still using LOTF isn't and will not be competent enough to do so. The people competent enough to not make MySQL freeze aren't using LOTF and are most likely making their own source.

Like I said though on MSN, I'm really probably the only person who can use ini's without the performance loss of not using a SQL instead.

Quote:
If He wants to put it into ini files dont flame him for it. Dont come in here tao and flame ppl for leeching and other stuff when u dont have the right cause i can rember some stupid questions you have asked many times. Tho my project is in vb.net i cant help with c# but i hope Yuki hope u can get it done.

As u may know the popular server HCO was all flat files.
And i am sure Acid is again all flat files cause Hybrid is the main coder
Sparkie (unknown) wasn't flaming him, just enlightening him about the horrors of using ini's when used incorrectly. Yes HCO was flat-files, but as many people know, and as I've stated, I'm the exception to the SQL > INI rule, nobody else (atleast nobody in the conquer community trying to use ini's right now) will beable to become exempt to this rule -- it's highly unlikely, which is why even I suggest to use a SQL over inis.
11/13/2008 04:14 xprincex#13
Lol very true MySQL would be at this time much more effecint i would have to agree. Thanks for you input on this i forgot to mention that only u have succed in the ini's without the performance loss.

Well I guess thats all to be said on the matter. Long Live Hybrid
11/14/2008 23:19 damianpesta#14
I Am Trying To Get My Server Working With Ini's o.o NPC's Mobs and Mob Spawns r in ini's so far Trying to Solve Auth And Few others but im still noob in coding