LittleFlower
28th May 2004, 01:22 AM
I play all my FPS games with a joystick. Singleplayer and multiplayer. The game that I keep going back to is Unreal Tournament. A major part of UT is "dodging". This is where the programability of the CH Products joysticks come in very handy. I've spend quite some time to write a script that does *exactly* what I like. Dodging in UT is done by "doubleclicking" one of the WASD direction keys. My script is based emulating these keystrokes. One of the subtleties involved is the fact that the Unreal engine will only register a doubleclick of the WASD keys when the axis in that direction is not registering movement. So my script does something like:
if (JS1.B4) {
Â*compute into which direction the stick is pointing;
Â*if (dodging left) then
Â* Â*CMS.A1 = 128;
Â* Â*CMS.A2 = JS1.A2;
Â* Â*CMS.B111 = TRUE; Â* Â* Â* Â* // CMS.B111 emulates: KEYS +a -a +a -a
Â*else if (dodging right) then
Â* Â* Â*.... etc ....
endif
Because you can't dodge back to back, and because the axis during dodge influences how far you dodge, I want to keep control over CMS.A1 and CMS.A2 for about half a second after initiating the dodge. Now my big problem.
Whenever I try to do things in time, behaviour gets unpredictable. I read in the documentation that the TIMER function is doing stuff based on units of the time period for the character rate set in the GUI. I have set that rate to 25 milliseconds. Now I expect that the script runs every 25 ms. Is that true ? It sometimes seems that the script will only run when the input (axis or buttons) changes ? I also tried to do things like:
if (A100 > 0) then
Â*A100 = A100 - 1;
else
Â*// end of waiting period
Â*do something to finish action
endif
if (user did something) then
Â*start action;
Â*A100 = 20; // do something in 20 * 25 = 500 ms
endif
This should have the same result as using a TIMER(PERIOD, D1, 20) function, should it not ? In any case, when I use a similar construct, the resulting behaviour is unpredictable. Sometimes it works, sometimes it doesn't. E.g. when I play online, the renderer needs to display less frames, and therefor more CPU cycles should be available for other things like the joystick driver. However, against my expectation, it seems the control loop is running less often. I used a construct like "A100 = (JS1.A3 / 25);" so I could set the timer period based on the throttle, and do dynamic experimentation. The result was that under different circumstance, I can get the same behaviour by changing the timer period from 4 loops to 10 loops or viceversa. This all makes me believe that the control loop is run at random intervals, and not at exactly the 25 ms I have configured.
I would like to see a construct that allows us users to keep track of real time. Something similar to the TIMER commands, but where n is not loops, but milliseconds. It could be implement by a simple timestamp. You can set a timer for n milliseconds. And after n millisecond the timer becomes TRUE.
if (user does something) then
Â* initiate action;
Â* SETTIMER(T1, 100);
endif
if (T1) then
Â*finish action;
Â*T1 = FALSE; // Or UNSETTIMER(T1), or SETTIMER(T1, 0);
endif
Am I missing something ? Is there a construct already that does what I want ? If not, is there any chance my feature request will be implemented ? Thanks in advance,
Henk (aka LittleFlower).
if (JS1.B4) {
Â*compute into which direction the stick is pointing;
Â*if (dodging left) then
Â* Â*CMS.A1 = 128;
Â* Â*CMS.A2 = JS1.A2;
Â* Â*CMS.B111 = TRUE; Â* Â* Â* Â* // CMS.B111 emulates: KEYS +a -a +a -a
Â*else if (dodging right) then
Â* Â* Â*.... etc ....
endif
Because you can't dodge back to back, and because the axis during dodge influences how far you dodge, I want to keep control over CMS.A1 and CMS.A2 for about half a second after initiating the dodge. Now my big problem.
Whenever I try to do things in time, behaviour gets unpredictable. I read in the documentation that the TIMER function is doing stuff based on units of the time period for the character rate set in the GUI. I have set that rate to 25 milliseconds. Now I expect that the script runs every 25 ms. Is that true ? It sometimes seems that the script will only run when the input (axis or buttons) changes ? I also tried to do things like:
if (A100 > 0) then
Â*A100 = A100 - 1;
else
Â*// end of waiting period
Â*do something to finish action
endif
if (user did something) then
Â*start action;
Â*A100 = 20; // do something in 20 * 25 = 500 ms
endif
This should have the same result as using a TIMER(PERIOD, D1, 20) function, should it not ? In any case, when I use a similar construct, the resulting behaviour is unpredictable. Sometimes it works, sometimes it doesn't. E.g. when I play online, the renderer needs to display less frames, and therefor more CPU cycles should be available for other things like the joystick driver. However, against my expectation, it seems the control loop is running less often. I used a construct like "A100 = (JS1.A3 / 25);" so I could set the timer period based on the throttle, and do dynamic experimentation. The result was that under different circumstance, I can get the same behaviour by changing the timer period from 4 loops to 10 loops or viceversa. This all makes me believe that the control loop is run at random intervals, and not at exactly the 25 ms I have configured.
I would like to see a construct that allows us users to keep track of real time. Something similar to the TIMER commands, but where n is not loops, but milliseconds. It could be implement by a simple timestamp. You can set a timer for n milliseconds. And after n millisecond the timer becomes TRUE.
if (user does something) then
Â* initiate action;
Â* SETTIMER(T1, 100);
endif
if (T1) then
Â*finish action;
Â*T1 = FALSE; // Or UNSETTIMER(T1), or SETTIMER(T1, 0);
endif
Am I missing something ? Is there a construct already that does what I want ? If not, is there any chance my feature request will be implemented ? Thanks in advance,
Henk (aka LittleFlower).