February 24, 2018, 04:44:34 AM

Author Topic: [Discussion] Optimized races.ini & why NOT to use the standard one.  (Read 106 times)

Offline Manifest

  • Race & effect creator
  • Moderator
  • Level 7 Expert
  • *****
  • Posts: 986
  • Country: dk
  • Content creator for the new WCS version by Kami.
Hi every single one of you reading this.

This discussion topic will mostly be aimed towards the race coders out there, but the information discussed in the topic is also very useful to all server owners who intend to run a WCS server with many races.
Now let's get started.

I recently made some changes to my own races.ini file for a server that I am working on. In specific the changes I made was trying to lower the length of my race file.
Due to my curiousity I decided to count the amount of lines I could remove whilst still maintaining a functional and easily readable races.ini file. (Sidenote: I am using Notepad++)

To my surpise by making very few adjustments to the standardized race structure, I was able to reduce the length of my races.ini from 17.547 lines to just 13.020 lines. In other words I reduced the file by 4527 lines of code, or roughly 25,79% of my initial file. The server I am working on currently contain 317 races, but I know there used to exist servers which had more than a total of 500 races.
The standardized race structure I refer to:
[Undead Scourge]
    #Requirement section
    required       = 0
    maximum        = 0

    #Restrict section
    restrictmap    = ""
    restrictteam   = 0
    restrictitem   = ""
    teamlimit      = 0

    #Other info
    author         = "Kryptonite & Manifest"
    desc           = "An undead scourge from near Lordaeron area"
    spawncmd       = "es_doblock races/undead_scourge/spawn"
    deathcmd       = ""
    roundstartcmd  = ""
    roundendcmd    = ""
    preloadcmd     = ""
    allowonly      = ""
    onchange       = ""

    #Skill information
    numberofskills = 4
    numberoflevels = 8
    skillnames     = "Vampiric aura|Unholy aura|Levitation|Suicide bomber"
    skilldescr     = "Gives you a 5-15% chance to gain 4 to 21 health in return when attacking an enemy|Gives you speed boost allowing you to run 10-45% faster|Allows you to jump higher by reducing your gravity by 8-65|Upon dying you have 20-65% chance to explode and deal 80-130 damage to each player within a radius of 120-180"
    skillcfg       = "player_attacker|player_spawn|player_spawn|player_death"
    skillneeded    = "0|0|0|8"

    category       = "Starter races"

    #Skill specific information
        setting = "es_xset wcs_chance 5|es_xset wcs_chance 7|es_xset wcs_chance 9|es_xset wcs_chance 11|es_xset wcs_chance 12|es_xset wcs_chance 13|es_xset wcs_chance 14|es_xset wcs_chance 15"
        cmd     = "es_xdoblock races/undead_scourge/vampire"
        sfx     = ""

        setting = "es_xset wcs_speed 1.1|es_xset wcs_speed 1.15|es_xset wcs_speed 1.2|es_xset wcs_speed 1.25|es_xset wcs_speed 1.3|es_xset wcs_speed 1.35|es_xset wcs_speed 1.4|es_xset wcs_speed 1.45"
        cmd     = "es_xdoblock races/undead_scourge/unholy"
        sfx     = ""

        setting = "es_xset wcs_gravity .92|es_xset wcs_gravity .84|es_xset wcs_gravity .76|es_xset wcs_gravity .68|es_xset wcs_gravity .6|es_xset wcs_gravity .52|es_xset wcs_gravity .44|es_xset wcs_gravity .35"
        cmd     = "es_xdoblock races/undead_scourge/levitation"
        sfx     = ""

        setting = "es_xset wcs_chance 20;es_xset wcs_magnitude 80;es_xset wcs_radius 120|es_xset wcs_chance 30;es_xset wcs_magnitude 80;es_xset wcs_radius 120|es_xset wcs_chance 40;es_xset wcs_magnitude 90;es_xset wcs_radius 140|es_xset wcs_chance 45;es_xset wcs_magnitude 100;es_xset wcs_radius 160|es_xset wcs_chance 50;es_xset wcs_magnitude 110;es_xset wcs_radius 170|es_xset wcs_chance 55;es_xset wcs_magnitude 120;es_xset wcs_radius 170|es_xset wcs_chance 60;es_xset wcs_magnitude 120;es_xset wcs_radius 180|es_xset wcs_chance 100;es_xset wcs_magnitude 130;es_xset wcs_radius 180"
        cmd     = "es_xdoblock races/undead_scourge/bomb"
        sfx     = ""

I have done this once before for the older version of WCS, and at the time when I did so I could immediately feel the difference when browsing through my races in the changerace menu.
Seeing as this is one of the menus players use the most in WCS this will be worth investing a little bit of time in to.

Seeing as the new version is in general way faster than the previous versions, and the fact that I am making things right from the very beginning this time, I cannot tell how much it impacts the newest WCS version by Kami. It would be hard to tell how big an impact these change would have in the new version, but I can gurantee that it will be making the race browsing faster.

Also due to curiousity I decided to swap out most of the space indentations with tab indentations where it would be possible, once again without ruining the readability of the races.ini file. The amount of signs saved in my races.ini was 65.936, and this is of course without counting the signs that was already removed from the changes mentioned.

The optimized race format does not limit you as a race coder, as it contain the exact same amount of options as the standardized code structure. I do however recommend that complete beginners use the standardized format till they are familiar enough with it to know what every setting do before using this.

The optimized race format has been added as an attachment below. The attachment illustrates how the standard races would look if they used the more optimized format. I hope this method will be put to use by the servers which plan to have a wide variety of races.

If you have any thought on this matter then please feel free to share them in this topic.
"BRAVORA: Bruh it is fucking operation crystal night when you are approving races."