0
\$\begingroup\$

So I have created a 2D game engine used for creating top down singleplayer shooters and now I encounter some massive input lags when I have spawned a few entities (maybe 20 opponents). This results in that the mouse and keyboard input is delayed: I move and turn around, shoot weapons and when I abort pressing anything then the input is still processed for 1 or 2 seconds. This makes the game unplayable. I reduced lag a bit when refusing to use WM_MOUSEMOVE in my WndProc and use GetCursorPos instead, but still, the input lag is there. Is this normal when using a single threaded application? I run everything (WndProc, game processings, drawings) in the main thread. Do I need to use multithreading in order to let the game run fluent? I know DX9 is dated, but it can't be caused by DX9 itself, since many games have been written with it, and those games even manage much more spawned entities than my game.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ You have not shown us enough of your code for us to spot what you've done wrong. Please edit your question to include a Minimal Complete Verifiable Example: the smallest set of code and instructions we can use to reproduce this problem in a new project. \$\endgroup\$ Commented Oct 8, 2021 at 12:03
  • \$\begingroup\$ Do you have any clue where the hold-up is? Do you have a huge number of unprocessed Win32 messages in your message loop? Does creating the Direct3D resources take a long time? Is it the first render frame after the new spawns? \$\endgroup\$ Commented Oct 13, 2021 at 2:07

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.