npcs are moving faster than character at same velocity

Started by
5 comments, last by ca_priest 21 years, 4 months ago
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.
...and that's where I saw the leprechaun...he told me to burn things.
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
Maybe you are updating the NPCs more than once per frame?

Brian
Brian J
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....

"Voilà! In view, a humble vaudevillian veteran, cast vicariously as both victim and villain by the vicissitudes of Fate. This visage, no mere veneer of vanity, is a vestige of the vox populi, now vacant, vanished. However, this valorous visitation of a bygone vexation stands vivified, and has vowed to vanquish these venal and virulent vermin vanguarding vice and vouchsafing the violently vicious and voracious violation of volition. The only verdict is vengeance; a vendetta held as a votive, not in vain, for the value and veracity of such shall one day vindicate the vigilant and the virtuous. Verily, this vichyssoise of verbiage veers most verbose, so let me simply add that it's my very good honor to meet you and you may call me V.".....V
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.
...and that's where I saw the leprechaun...he told me to burn things.
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
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.

This topic is closed to new replies.

Advertisement