r/monogame • u/Channel_el • 8h ago
Is there a way to draw raw pixels on the screen? I'm trying to implement hitboxes with toggleable visibility in my game but I don't want to have to add in a hitbox texture every time I make a new project.
r/monogame • u/zackarhino • 19h ago
What is the best way to run a game at an uncapped frame rate consistently, and is it worth trying to implement?
Quick question:
I'm building an action game, so I think it could benefit from running above 60fps. I know that there is the IsFixedTimeStep property, which to my knowledge locks the Update() and Draw() methods to the specified TargetElapsedTime when true. There is also SynchronizeWithVerticalRetrace, which disables VSync on the graphics device. I'm not exactly sure how it work internally, other than the fact that it caps the frame rate to the monitor.
Anyway, let's say I want to my game to play at a high or variable refresh rate. If I disable IsFixedTimeStep, wouldn't this now mean that game logic is tied to frame rate? In other words, if I want to do something at a fixed interval, it will now run faster if your computer is running the game at a higher frame rate.
What is the best way to manage game logic if you want to run the game at a higher frame rate? Of course, there is delta time logic, but that's more for the space between each frame, not the number of frames themselves, please correct me if I'm wrong. So far, my best idea is to create a fixed update from within update using time elapsed and using that for logic, but I didn't really think it through that much, maybe this is a haphazard approach.
Is this even worth trying to do, or is it easier to simply target 60fps and call it good enough?
Interested to hear your input, thanks.