Post: Overflow Fix Tutorial and Explanation (GSX)
08-23-2018, 12:38 PM #1
anthonything
Space Ninja
(adsbygoogle = window.adsbygoogle || []).push({}); Alright so this has been an issue for a while, figured id get rid of all the hassle and streamline the overflow fix.

This thread is an explanation of everything to do with overflow and the fix implemented, as well as a tutorial on implementing it with GSX.

So for the sake of utility, I'm going to start the thread with the tutorial on how to implement it because I know most people dont care how or why it works.

Here is a video tutorial, and ill provide a very simple text tutorial:



Text:
1. In your init function, call xoverflowfix( max_strings ); // A safe number is 60
2. In your drawtext or anything that you use to set text, change SetText to XSetText
3. Thats it. You can manually clear strings if needed by calling xoverflowclear( index, shouldredraw )


As for why and how everything works, heres my best explanation, some coding / reversing knowledge is required:

So the game keeps a list of configuration strings that are synced from the server to all clients.

These configurations strings can be really anything, there are lots of different fields so i wont go too far into detail.

What we need to focus on are the hudelem config strings. You get around 480 configuration strings for text, however when loading it with default GSC scripts in multiplayer, you end up with about 65 strings left, give or take a few.

The traditional fix for overflow has always been to just create an anchor at the beginning of the game and then clear all the strings after it. This works for small batches of strings, like 60 for example,
however when you factor in things like zombies and the rank fix, you end up with batches that cause a reliable command overflow. This is due to the fact that the server sends a reliable command to synchronize the config string for each configuration string cleared, for each client... you can probably see how this causes issues.

So the way I had originally fixed this issue was saving an anchor string every 30 strings or so, then clearing backwards from the last anchor set to the first. This would work in normal circumstances, however on the off chance that you use a string that was further back in the table, you would end up clearing way too many strings.

So the final thing I decided to do once I had memory functions down is actually use the hudelem_s->text as the index used to clear. This provides a quick and efficient method to clear the text from the table, clearing in batches of 30 with a small network frame delay between clears.

As far as the auto redraw, I just add elements to an array when they set text, and i have them save the text value that they use in a local variable until they need it again.

There is one more problem though, specifically for round based game modes:

When a round switches, the game literally restarts the scripts run in the game, without clearing the config strings. This means that you have to clear strings each round, which is an easy fix i might add, but every overflow fix to this date has simply ignored this fact.

The solution is simple: wait until we are notified that the game has 'ended' and clear strings without redrawing.

As far as overflow goes, thats about it. I just figured id clear the whole process up for everyone who cared.


Alright guys thats about it for this thread. Hopefully this makes the whole overflow problem virtually non existent for everyone.

The following 7 users say thank you to anthonything for this useful post:

DH63, Fixed Username, Im_YouViolateMe, Nothingbutbread, OfficialCoolJay, sandro oliveira, Skonafid
08-23-2018, 09:02 PM #2
Im_YouViolateMe
NextGenUpdate Elite
First

Thanks for clarifying overflow situation but like you said, doubt most would care.

The following user thanked Im_YouViolateMe for this useful post:

anthonything
08-24-2018, 04:33 AM #3
illusional
Climbing up the ladder
Originally posted by anthonything View Post
Alright so this has been an issue for a while, figured id get rid of all the hassle and streamline the overflow fix.

This thread is an explanation of everything to do with overflow and the fix implemented, as well as a tutorial on implementing it with GSX.

So for the sake of utility, I'm going to start the thread with the tutorial on how to implement it because I know most people dont care how or why it works.

Here is a video tutorial, and ill provide a very simple text tutorial:



Text:
1. In your init function, call xoverflowfix( max_strings ); // A safe number is 60
2. In your drawtext or anything that you use to set text, change SetText to XSetText
3. Thats it. You can manually clear strings if needed by calling xoverflowclear( index, shouldredraw )


As for why and how everything works, heres my best explanation, some coding / reversing knowledge is required:

So the game keeps a list of configuration strings that are synced from the server to all clients.

These configurations strings can be really anything, there are lots of different fields so i wont go too far into detail.

What we need to focus on are the hudelem config strings. You get around 480 configuration strings for text, however when loading it with default GSC scripts in multiplayer, you end up with about 65 strings left, give or take a few.

The traditional fix for overflow has always been to just create an anchor at the beginning of the game and then clear all the strings after it. This works for small batches of strings, like 60 for example,
however when you factor in things like zombies and the rank fix, you end up with batches that cause a reliable command overflow. This is due to the fact that the server sends a reliable command to synchronize the config string for each configuration string cleared, for each client... you can probably see how this causes issues.

So the way I had originally fixed this issue was saving an anchor string every 30 strings or so, then clearing backwards from the last anchor set to the first. This would work in normal circumstances, however on the off chance that you use a string that was further back in the table, you would end up clearing way too many strings.

So the final thing I decided to do once I had memory functions down is actually use the hudelem_s->text as the index used to clear. This provides a quick and efficient method to clear the text from the table, clearing in batches of 30 with a small network frame delay between clears.

As far as the auto redraw, I just add elements to an array when they set text, and i have them save the text value that they use in a local variable until they need it again.

There is one more problem though, specifically for round based game modes:

When a round switches, the game literally restarts the scripts run in the game, without clearing the config strings. This means that you have to clear strings each round, which is an easy fix i might add, but every overflow fix to this date has simply ignored this fact.

The solution is simple: wait until we are notified that the game has 'ended' and clear strings without redrawing.

As far as overflow goes, thats about it. I just figured id clear the whole process up for everyone who cared.


Alright guys thats about it for this thread. Hopefully this makes the whole overflow problem virtually non existent for everyone.


everything you made with GSC Studio can we use with your GSX Studio? like will it work the same?
08-24-2018, 04:58 AM #4
DH63
Retired Staff
Originally posted by anthonything View Post
Alright so this has been an issue for a while, figured id get rid of all the hassle and streamline the overflow fix.

This thread is an explanation of everything to do with overflow and the fix implemented, as well as a tutorial on implementing it with GSX.

So for the sake of utility, I'm going to start the thread with the tutorial on how to implement it because I know most people dont care how or why it works.

Here is a video tutorial, and ill provide a very simple text tutorial:



Text:
1. In your init function, call xoverflowfix( max_strings ); // A safe number is 60
2. In your drawtext or anything that you use to set text, change SetText to XSetText
3. Thats it. You can manually clear strings if needed by calling xoverflowclear( index, shouldredraw )


As for why and how everything works, heres my best explanation, some coding / reversing knowledge is required:

So the game keeps a list of configuration strings that are synced from the server to all clients.

These configurations strings can be really anything, there are lots of different fields so i wont go too far into detail.

What we need to focus on are the hudelem config strings. You get around 480 configuration strings for text, however when loading it with default GSC scripts in multiplayer, you end up with about 65 strings left, give or take a few.

The traditional fix for overflow has always been to just create an anchor at the beginning of the game and then clear all the strings after it. This works for small batches of strings, like 60 for example,
however when you factor in things like zombies and the rank fix, you end up with batches that cause a reliable command overflow. This is due to the fact that the server sends a reliable command to synchronize the config string for each configuration string cleared, for each client... you can probably see how this causes issues.

So the way I had originally fixed this issue was saving an anchor string every 30 strings or so, then clearing backwards from the last anchor set to the first. This would work in normal circumstances, however on the off chance that you use a string that was further back in the table, you would end up clearing way too many strings.

So the final thing I decided to do once I had memory functions down is actually use the hudelem_s->text as the index used to clear. This provides a quick and efficient method to clear the text from the table, clearing in batches of 30 with a small network frame delay between clears.

As far as the auto redraw, I just add elements to an array when they set text, and i have them save the text value that they use in a local variable until they need it again.

There is one more problem though, specifically for round based game modes:

When a round switches, the game literally restarts the scripts run in the game, without clearing the config strings. This means that you have to clear strings each round, which is an easy fix i might add, but every overflow fix to this date has simply ignored this fact.

The solution is simple: wait until we are notified that the game has 'ended' and clear strings without redrawing.

As far as overflow goes, thats about it. I just figured id clear the whole process up for everyone who cared.


Alright guys thats about it for this thread. Hopefully this makes the whole overflow problem virtually non existent for everyone.


Very informative thread; job well done man.

The following user thanked DH63 for this useful post:

anthonything
08-24-2018, 09:55 AM #5
anthonything
Space Ninja
Originally posted by illusional View Post
everything you made with GSC Studio can we use with your GSX Studio? like will it work the same?


GSC Studio to GSX Stuido will work just fine as long as you fix any undefined variables or function calls.
GSX Studio back to GSC Studio however, will not always work.

The following user thanked anthonything for this useful post:

Skonafid

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo