[Ohrrpgce] SVN: james/8803 Pathfinding NPCs can now path around other NPCs and zone restrictions by

Ralph Versteegen teeemcee at gmail.com
Sat Jun 3 08:07:16 PDT 2017


On 3 June 2017 at 09:25, <subversion at hamsterrepublic.com> wrote:

> james
> 2017-06-02 14:25:38 -0700 (Fri, 02 Jun 2017)
> 181
> Pathfinding NPCs can now path around other NPCs and zone restrictions by
> using npc_collision_check_at() instead of just check_wall_edges()
>
> This causes a noticeable performance hit
> ---
> U   wip/game.bas
> U   wip/pathfinding.bas
> U   wip/pathfinding.bi


With gengcc=1 debug=0, the 100 NPC map now (barely) runs at 30fps for me.

npc_collision_check_at does a whole bunch of stuff, but the slowest part in
generally will be checking for collisions with all other npcs. (I did
profile, this is where most of time is spent on the 100 slime map)
We could speed this up by using a map with one integer per tile which says
how many obstructing npcs there are at that tile. wrapcollision just
calculates the effective tile for both thngs passed into it and checks for
equality. (The half-way solution would be to cache that position).
The only practical way to keep that map up-to-date would be member
functions/properties.

This isn't really critical right now, but even since I played Mutant
Warzone (a Megazeux game) by Robot/8bit, I've wanted to be able to have
thousands of NPCs on the map at once. Eventually.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/attachments/20170604/55f2c0b8/attachment-0001.htm>


More information about the Ohrrpgce mailing list