Pages: [1]
  Print  
Author Topic: Callvote custom variable substitution  (Read 12498 times)
GrosBedo
Member


Cakes 20
Posts: 710


« on: February 04, 2012, 07:19:31 AM »

This thread is a continuation of the post here:

http://openarena.ws/board/index.php?topic=3578.msg42679#msg42679

I will use this thread to write down some ideas, but I'm not going to implement (neither the dev team I think) this feature in the near future.

The idea stems from the fact that it seems we are needing to add more and more voting abilities for some parameters that weren't implemented in stock ioquake3, such as capturelimit. Instead of hardcoding the new vote, we could also enhance the current callvote custom to accept variables, which we could substitute in the script, so that we could theoretically implement any possible vote that we could imagine for any parameter of the game, and even for more complex script that may rule a server.

Now I'm going to describe some problems that may arise from this implementation, and how to fix them:

1- Variables substitution would be very hard to implement for callvote, because first we would have to implement it in the engine for script parsing, only then we could extend it for callvote.

This step can be sped up a lot by porting the TremFusion code, which implements variables substitution for scripting, as well as many other features such as a random function and an alias function.

But we would still have to implement it for callvote, but I believe this would be a minor step after this is implemented for scripting.

2- In the console, how will the user know how to feed the callvote custom (how to show the parameters?)

We could either just use the already defined help variables in the votecustom.cfg, and if we are perfectionnist, we could also output the name of the callvote + the variables before the help.

Eg:
{
votecommand   "addbots $nbbots"
displayname   "Add some bots if there's not enough people on server"
command      "seta bot_minplayers 2"
}

If the player types /callvote custom help addbots:
addbots $nbbots
Add some bots if there's not enough people on server

3- In the GUI: How to show such vote with parameters in the menu? How can we input the parameters?

Either this kind of vote could just be used in console (personnally I think that's enough), or we could just show some dialog box for inputting the values for the variables.

Eg:
Menu > Callvote > Custom > Addbots > Please enter a value for $nbbots

And if we want to set a description, we could add a description for the variables, such as:
$nbbots:"number of bots"

which would give in the menu:
"Please enter a value for number of bots:"

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

If you've got some other ideas or problems that this feature would spawn, or if you even think that this feature is utterly useless, please feedback!
« Last Edit: February 04, 2012, 09:07:54 AM by GrosBedo » Logged
grey matter
Member


Cakes 8
Posts: 381

>9k


« Reply #1 on: February 04, 2012, 08:35:09 AM »

1- Variables substitution would be very hard to implement for callvote, because first we would have to implement it in the engine for script parsing, only then we could extend it for callvote.
Why would you need to implement this in the engine? The gamecode gets to see the vote strings first, so it could do the required parsing as well.

Code:
{
votecommand "addbots $nbbots"
displayname "Add some bots if there's not enough people on server"
command "seta bot_minplayers 2"
}

Shouldn't this be using the substitution variable?
Code:
command		"set bot_minplayers $nbbots"

If you've got some other ideas or problems that this feature would spawn, or if you even think that this feature is utterly useless, please feedback!

Validation is a problem here. Do you want me to set $nbbots to "999"? Or "0; set rconpassword foo" which yields command "set bot_minplayers 0; set rconpassword foo"? Or $nbbots "foo", which yields "set bot_minplayers foo", which results in some seemingly random number.

This seems too complex to be done properly. You'd have to add types (string, integer, float or special cases such as gametype numbers, names or mapnames) and lower and upper limits or in/exclusion from certain ranges. All this is difficult and time consuming when done in either engine or gamecode. Maybe an external tool such as B3 would be better?
Logged

This space is for rent.
Gig
In the year 3000
***

Cakes 45
Posts: 4394


WWW
« Reply #2 on: February 04, 2012, 08:49:16 AM »

Improving custom votes abilites may be good (e.g. going over 12 entries in menu and over 4k total characters limits maybe?)... but about capturelimit voting, I really think that should be hard-coded in the game, plus new g_votemincapturelimit and g_votemaxcapturelimit variables. Capturelimit is worth of the same degree of integration that timelimit and fraglimit have.

Of course, making better custom votes may be good (but probably some ehancements are not easy to implement and to keep safe from abusing)... but capturelimit should not need a such tweaking, it should be integrated in stock game (and that should be easy enough to do, mainly copy pasting fraglimit voting code).
Logged

I never want to be aggressive, offensive or ironic with my posts. If you find something offending in my posts, read them again searching for a different mood there. If you still see something bad with them, please ask me infos. I can be wrong at times, but I never want to upset anyone.
GrosBedo
Member


Cakes 20
Posts: 710


« Reply #3 on: February 04, 2012, 09:07:30 AM »

@Gig: about capturelimit, I agree that this should be hard-coded, but there may be a lot of other needs, such as the addbots I described (often it happens that players disagree on whether they want at least 2 bots on each team in CTF when there are not enough players, or 1, or even none when bots become an annoyance).
Logged
sago007
Posts a lot
*

Cakes 62
Posts: 1664


Open Arena Developer


WWW
« Reply #4 on: February 04, 2012, 01:08:19 PM »

Maybe an extra line with some sort of way to show allowed values:

Code:
{
define nbbots in integer[1;10] as "Number of bots"
votecommand "addbots $nbbots"
displayname "Add some bots if there's not enough people on server"
display         "Use $nbbots bots?"
command "seta bot_minplayers $nbbots"
}

Also consider how a vote like: "callvote addbots \"2\t set rconpassword test\"" should be handled. ioquake3 change the engine at one point so that the server now filters chars that caused massive holes almost all mods that used custom votesystems (because the code heavily encouraged the coder to do it that way).
Logged

There are nothing offending in my posts.
Pages: [1]
  Print  
 
Jump to: