Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

ca_priest

npcs are moving faster than character at same velocity

This topic is 5810 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

My game is a 2D rpg. My problem is that although npc''s and the playable character both have the same walking velocities, the npc''s are still moving faster. Im curious as to why and how i can fix this. The animation is smooth for both the character and npc''s and no frames are skipped. I even tried putting 17 npc''s on the same screen walking around with the character but still, all the npc''s move at a constant speed that is a little bit faster than the character. The only thing i can think of is that maybe it has somthing to do with the rate im gathering user input, and maybe key presses are being missed? If that was the case however id expect some frames in the sequence of animation to skip and that isnt happening. Any ideas are appreciated.

Share this post


Link to post
Share on other sites
Advertisement
You''re way too vague in your question.. your NPC could be moving faster for a multitude of reasons. Try posting some code or better describing your problem, when it occurs, etc..


swift URL | browse my bookmarks [server may not always be on]

Sensimed | Info/download

Share this post


Link to post
Share on other sites
unlikely, if that were the case the NPCs speed would be some multiple of the players speed, which would be more than ''a little bit''. on the other hand, at low speeds 2x the speed could seem like a little bit, so it''s worth checking all the same....

Share this post


Link to post
Share on other sites
Well i checked to see if that was the problem, and that isnt it. I too thought that wouldve been unlikely because the npc would have to be moving at least twice as fast. Both the npc''s and the character are moving at one pixel per cycle, each cycle being 1/50th of a second, as the fps is 50. This makes for some realistic walking speed. Anyway, just by watching objects move it looks to me like the npc''s are moving between 45 and 55 pixels per second, theres absolutely no way they''re moving 100 pixels per second, which would be the minimum speed if they were being redrawn. Maybe its possible that the character is being redrawn every other frame...it looks to me like hes moving about 30-35 pixels per second. The only diffrence between npc''s and the character is the way they get what direction to move next, or what action to do next. NPC''s get it from the AI and the character gets it from the keyboard, so unless this speed diffrence has somthing to do with keyboard input, im completely stumped.

Share this post


Link to post
Share on other sites
Try logging to file this information: each frame, output "\n ", then "NPC " if the NPC is moving one pixel this frame, and "Char " if the PC is moving one pixel this frame. Then log any other information( keyboard input, etc..) based on the information you got from the log.

ToohrVyk
-------------
Extatica - a free 3d game engine
Available soon!
Click here to learn more

Share this post


Link to post
Share on other sites
are you using windows messages for input? that will make your program ''think'' its getting less key updates than it should. even still, that could be the cause with directinput or sdl if thats what you are using.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!