Faster walk speed
Moderators: Bob the Hamster, marionline, SDHawk
-
- Slime Knight
- Posts: 254
- Joined: Thu Nov 16, 2017 5:22 am
Faster walk speed
I'm interested in speeding up the 'action' of my game without changing FPS. Is there a way to do that?
Wow, didn't dream of seeing you work on an OHR game again!
Increasing the walk speed is as simple as simple as using the "set hero speed" command...
I never realised before that changing the leader's walk speed stays in effect even if you add/remove/swap heroes; the speed isn't actually set on the hero, but applies to whoever is in the leader position.
So you only need to run this script as the newgame and loadgame script.
Unfortunately the only valid speeds are 1,2,4,5,10,20. Something I really need to fix, but it's going to be tricky.
Come to think of it, changing the party walk speed is so common that I should just make it an option in Custom.
Increasing the walk speed is as simple as simple as using the "set hero speed" command...
Code: Select all
plotscript, walk speed 5, begin
set hero speed(me, 5)
end
So you only need to run this script as the newgame and loadgame script.
Unfortunately the only valid speeds are 1,2,4,5,10,20. Something I really need to fix, but it's going to be tricky.
Come to think of it, changing the party walk speed is so common that I should just make it an option in Custom.
-
- Slime Knight
- Posts: 254
- Joined: Thu Nov 16, 2017 5:22 am
Well it's a glaring omission that you can change NPC speeds but not the hero speed, and now that you can change the FPS it needs to be customisable. That's also why I have to allow a broader range of walk speeds. Even speed 1 is quite fast at 60fps.
Changing the speed during the game (e.g. when you press a Run key) is probably something that should just be scripted, though.
Changing the speed during the game (e.g. when you press a Run key) is probably something that should just be scripted, though.
Last edited by TMC on Sun Feb 17, 2019 3:46 am, edited 1 time in total.
-
- Slime Knight
- Posts: 254
- Joined: Thu Nov 16, 2017 5:22 am
Run speed! That is a great idea.
In my case, that would drastically improve gameplay dynamics. If, say, you were more likely to get 'caught' because running makes more noise.
Also, games like Chrono Trigger and Pokemon vs. old Final Fantasy show how that tiny feature affects enjoyment. (Pokemon made it interesting by giving you a bike at some point).
In my case, that would drastically improve gameplay dynamics. If, say, you were more likely to get 'caught' because running makes more noise.
Also, games like Chrono Trigger and Pokemon vs. old Final Fantasy show how that tiny feature affects enjoyment. (Pokemon made it interesting by giving you a bike at some point).
- Pepsi Ranger
- Liquid Metal Slime
- Posts: 1457
- Joined: Thu Nov 22, 2007 6:25 am
- Location: South Florida
Or you could implement the backwards feature that Stardew Valley employs, which is to move in a perpetual state of running until you hit the "walk" key. I never understood why anyone would use that key, but it's there.
Alternatively, analog joystick movement, similar to sandbox 3D movement where you speed up the farther you push the stick, revolutionized in Super Mario 64, would be an interesting feature to include while controller support is being worked on.
I think custom speed would be easier to adjust if we had an option to select pixel-based movement as an alternative to tile movement (in other words, we could select a game to default to one or the other, while allowing scripts to override the function in certain cases where precision is important).
At any rate, I'll be in the same position soon. Once I raise the FPS of my game to 30, I'll want to reduce the hero's move speed by half to keep the original pacing while making ticks a bit faster.
Alternatively, analog joystick movement, similar to sandbox 3D movement where you speed up the farther you push the stick, revolutionized in Super Mario 64, would be an interesting feature to include while controller support is being worked on.
I think custom speed would be easier to adjust if we had an option to select pixel-based movement as an alternative to tile movement (in other words, we could select a game to default to one or the other, while allowing scripts to override the function in certain cases where precision is important).
At any rate, I'll be in the same position soon. Once I raise the FPS of my game to 30, I'll want to reduce the hero's move speed by half to keep the original pacing while making ticks a bit faster.
Place Obligatory Signature Here
-
- Slime Knight
- Posts: 254
- Joined: Thu Nov 16, 2017 5:22 am
Using gamepad joysticks to control movement speed/direction is a fun idea, but it's too bad that other players miss out. Well, I guess a run key and 8 directions is a passable substitute.
Yes, if the engine adjusted all the animation and movement speeds so everything's the same there wouldn't be much point using 30 instead of 60. (Well, I guess you still have to deal with scripts which use waits and timers, and 30 might screw things up less.)
Yes, if the engine adjusted all the animation and movement speeds so everything's the same there wouldn't be much point using 30 instead of 60. (Well, I guess you still have to deal with scripts which use waits and timers, and 30 might screw things up less.)
Last edited by TMC on Mon Feb 18, 2019 6:04 pm, edited 1 time in total.
you can always skip ahead and remove frame rate altogether, just unlock it to something extreme like 9999.
yeah, that's right. I'm talking DELTA TIME. save Pepsi Ranger from having to update his game a four hundredth time -and- open up the door for online multiplayer, and game timing independent of frame rate. can you imagine the fun the Q&A forum would become for you
yeah, that's right. I'm talking DELTA TIME. save Pepsi Ranger from having to update his game a four hundredth time -and- open up the door for online multiplayer, and game timing independent of frame rate. can you imagine the fun the Q&A forum would become for you
- Pepsi Ranger
- Liquid Metal Slime
- Posts: 1457
- Joined: Thu Nov 22, 2007 6:25 am
- Location: South Florida
I've considered it, if only because the monitor refresh rate isn't always 60Hz, so it's poor to make that assumption. I've also manually scripted a game that way (it did some heavy rendering that meant it didn't consistently hit 60Hz).
But it would be a big complication for many things, and would only be an advanced feature anyway, because you'd have to know what you're doing when writing scripts containing waits.
And anyway, when I unlock fps (--runfast cmdline arg) I couldn't hit 9999. But... drawing 3000 frames per second and only displaying 60 is clearly not optimal.
But it would be a big complication for many things, and would only be an advanced feature anyway, because you'd have to know what you're doing when writing scripts containing waits.
And anyway, when I unlock fps (--runfast cmdline arg) I couldn't hit 9999. But... drawing 3000 frames per second and only displaying 60 is clearly not optimal.
- Attachments
-
- vikings0072.gif (346.95 KiB) Viewed 3222 times
Last edited by TMC on Tue Feb 19, 2019 6:25 pm, edited 2 times in total.
- Pepsi Ranger
- Liquid Metal Slime
- Posts: 1457
- Joined: Thu Nov 22, 2007 6:25 am
- Location: South Florida
Just to quickly address this point: It's actually pretty easy to adjust script waits to match FPS if you lock in a scripting pattern that does away with hardcoded waits. I've actually scripted a future-proofing element to Entrepreneur that makes adjusting waits to FPS as easy as changing the value of a single function in the starting script:TMC wrote:But it would be a big complication for many things, and would only be an advanced feature anyway, because you'd have to know what you're doing when writing scripts containing waits.
Code: Select all
set frames per second speed (18)
This function is merely the "memorable name" version of setting a variable:
Code: Select all
script, set frames per second speed, spd, begin
fpstimer := spd
end
Code: Select all
set timer (0, 300, fpstimer, @work clock, 6)
That way, if scripting FPS is ever possible, which would be great because then we could give players the option to set their own preferred speeds, then control over time elements won't be lost by the changing of the frame rate.
Anyway, I can also harmonize waits regardless of FPS with the following script:
Code: Select all
script,wait equivalent,tick,begin
wait ((tick*fpstimer)/18)
end
wait equivalent (3)
So, yeah, there are simple ways to keep up with FPS changes on the fly. I'd actually recommend that most people update their waits and timers now to accommodate for any potential shifts in FPS.
Though, it would be really cool if we could simply pass an argument that measures the computer's clock speed and prints the FPS to the controlling function in real time. Then we'd never have to touch this function again, unless we deliberately wanted to slow something down.
Place Obligatory Signature Here
Yes, you could use a replacement for 'wait' that counts in seconds instead of frames - I'm going to add a command equivalent to your script as build in..
However, your scripts don't allow what Charbile was talking about, which is adapting to a variable framerate, which eg. might drop from 60 to 45 for a few seconds because something program is running in the background
But if you use a "wait" replacement that counts in actual-seconds-elapsed instead of ticks, that doesn't change the fact that all your scripts and everything else become non-deterministic. So you need to know what you're doing, because you can't just run your scripts once to test them, you'd need to test them under various and also variable framerates, and constantly worry about the framerate as you write them so that you get them correct the first time, because you'll never be able to fully test them.
So I think that for most games (not action games) it's actually preferable that the game logic slows down when the framerate drops, instead of doing more per frame to compensate. That way the game plays deterministically and doesn't get harder/easier as you use projectives. In other words, the "wait equivalent" script should work the way you wrote it, not actual-seconds-elapsed.
Oh, and you can get the framerate set in Custom like this:
However, your scripts don't allow what Charbile was talking about, which is adapting to a variable framerate, which eg. might drop from 60 to 45 for a few seconds because something program is running in the background
But if you use a "wait" replacement that counts in actual-seconds-elapsed instead of ticks, that doesn't change the fact that all your scripts and everything else become non-deterministic. So you need to know what you're doing, because you can't just run your scripts once to test them, you'd need to test them under various and also variable framerates, and constantly worry about the framerate as you write them so that you get them correct the first time, because you'll never be able to fully test them.
So I think that for most games (not action games) it's actually preferable that the game logic slows down when the framerate drops, instead of doing more per frame to compensate. That way the game plays deterministically and doesn't get harder/easier as you use projectives. In other words, the "wait equivalent" script should work the way you wrote it, not actual-seconds-elapsed.
Oh, and you can get the framerate set in Custom like this:
Code: Select all
script, target frame rate, begin
return (1000 / read general(198))
if (read general(198) == 16) then (return(60)) #Special cased to mean 60fps
end
Last edited by TMC on Wed Feb 20, 2019 5:53 am, edited 3 times in total.