Sign in to follow this  
Hajas

Bug : IsValidGametype()

Recommended Posts

Hello,

seams the default function IsValidGametype() from COD4 is stuck with the 6 original gametypes returning false when is a custom gametype.

I got this problem with Star Wars with the VID gametype, but I thought was something wrong with the gametype itself since I didn't coded and don't have the source to know if the gametype was really added fine.

but now with my main project which have lots of new gametypes I figured out that simply doesn't work well anymore, the past version have the same problem. So I don't know which version the problem started.

cheers

 

Share this post


Link to post
Share on other sites
8 hours ago, Hajas said:

seams the default function IsValidGametype() from COD4 is stuck with the 6 original gametypes returning false when is a custom gametype.

how exactly is that an issue for you?

Share this post


Link to post
Share on other sites

Since Frontlines it's too big I designed a feature called "Frontlines Commands", with simple commands you can control anything in the mod. So there's a lot less code to control anything inside, and a lot easier to control the server via rcon. When called and the command is not recognized by anything is assumed that seams to be a gametype instead, so I have this test using this function, if is really a gametype will change to the new one.

exemple:

Quote

/rcon fl support

This change to Support gametype with COD4, but in COD4X since the function is not working right, doesn't enter the IF and nothing happens.

I can't remove that because if I try with for exemple :  "suport" spelled wrong and want to change via script will give me an error without that check, depending the case a crash.

The only way is set first as the original game: 

Quote

/rcon g_gametype support

then

Quote

/rcon map_restart

But since all my control functions are based in the FL Commands, I can't use that without rewrite everything with LOTS of more code, which I can't afford without a crash. I don't have much space letf to work sadly.

What I did was add all the 46 gametypes into the FL Commands script, which increased around 5-6 lines for each one. Since I don't have much space to work anymore, it's costing me space that I could use to something else. This solution was FAR better than don't use FL Commands and rewrite everthing, which will cost me LOTS of time and mainly LOTS MORE space that I can't afford without a crash.

For now will work without it aside the increase of code space, but old versions of mods that use that will never work, like the original Star Wars for exemple, COD4X says VID is a invalid gametype aside it is a valid one. This doesn't happen with COD4.

In my version of Star Wars I did the same I did now on Frontlines, so VID works flawless. But there I still have lots of space to work.

Well, if you want to keep compatible to mods, all mods that use that will not work with COD4X, all past versions of Frontlines inclueded.

Aside if you could also expand the allocated memory to give more space will be even better! :D

https://cod4x.me/index.php?/forums/topic/3169-expand-allocated-memory-at-least-for-recursive-functions/

keep the great work! cheers

Share this post


Link to post
Share on other sites

I did not even know there is such a scriptfunction so I did not care that this works at all and it had no effect until you told me now.

Stackspace is as much as in original cod4. I tested that. I am not sure if I make the code buffer bigger.

How do you exceed it so much? You know that gametype scripts get only loaded when it is the selected gametype?

 

Share this post


Link to post
Share on other sites
Posted (edited)

Yes, I'm on the edged in the original COD4 stackspace, it's not a problem with COD4X or related, is just a request to let me go even further. :D

I have 2 main problems, I know most people don't even know this because Frontlines is probably bigger than all most know mods combined. And of course I'm not talking about xmodels, images, sounds, etc... but the core.

Main Problem 1: There's a limit of how many references you do to other files. 

Exemple:

Quote

maps\mp\gametypes\_tweakables::init();

so with time I was forced to combine the files, until I finally decided to move almost all of them to the globallogic file. Was the ONLY solution to move on.

Main Problem 2: There's a limit of code in memory.

When a gametype is loaded, seams is put in memory globallogic and all the files from the main structure referenced by this file + the gametype gsc.

Since I was forced to move everything to globallogic my file is very huge + the gametype it's almost the edge, and since I have huge gametypes like Mission & Virus for exemple, with around 3000 lines each. I also copied many functions to gametypes files to lower the number of references.

What happens if I exceed that limit? start to have weird behaviors, like the later functions called starting to return as they don't exist in the code. If I remove some stuff simply comeback to work.

Secondary problems

. DVARS number - with more gametypes more dvar to control them, more vars/dvars in the code to deal with them, specially that I have WAR which need to control EVERYTHING in the mod when is on to work.

. Gametype limit - The max number is 29 gametypes. if add 30, the last one in the gametypes.txt list will not carry their dvars, messages, etc, etc... simply will not change anything. that's why I created the virtual gametypes.

. XModels, Material, other assets  limits - Seams COD4X did a great job with this problem! ;)

--------------------------------------

If you could increase at least a little more 10-20% of the 2 main problems and also the DVARS numbers will be AMAZING. If you could increase even more than 20% would be even better. how much more better! I setted the Quake 2 memory to 4x and the result was amazing. I think would do the same result with COD4.

The gametypes limit I already moved on with the virtual gametypes, and since most mods will never have more than 29 gametypes, don't need to worry about it.

With these 3 stuff increased I would be extremely happy. And who will care if IsValidGametype() don't work anymore? :D

Edited by Hajas

Share this post


Link to post
Share on other sites

Of course! The memory limit should increase too the the number of vars and threads running, or would be in vain. Cheers.

Share this post


Link to post
Share on other sites

the number of vars limit is a pain in the ass if you want to play very larger maps with bots, how much larger the maps more waypoints, but also needs more bots, then more vars to control them, then the var limit is reached very fast sadly.

IMO this is priority #1 to COD4X improvement list! 2x? 4x? that would be AMAZING! :D

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this