[Ohrrpgce] SVN: james/8551 Clean up perform_npc_move() refactoring the collision detection for wall

Ralph Versteegen teeemcee at gmail.com
Fri Mar 17 21:46:23 PDT 2017


There's no need for the npc_collision_check overload without the
hero_collision_exception argument, because FB lets you make byref arguments
optional, by giving them a default value. That results in a temporary
variable getting initialised to the default value and passed to the
function. I do this in several places. One of those little things I like
about FB.

I see you made a small back-compat breaking change here, by changing the
determination of NPC tile X/Y position for the purpose of wall/zone
checking, using the center rather than the top-left of the walkabout. Of
course, this only happens when the NPC finishes a step, so there's only a
difference if the NPC is mis-aligned, in which case collision checking is
quite broken anyway. I wonder, does any game actually rely on that
brokenness? It seems unlikely actually. I tested Siv: journey of an egg and
didn't notice any problems.

Actually I don't think that change to using the tile center helps at all;
it's still going to be broken. I suggest fixing misalignment by walking
NPCs/heroes less than 20 pixels (whether by walknpc or builtin movement) so
that it realigns at the next tile boundary, and doing collision checking
like a pixel-base-moving NPC/hero until then.

Script commands would be great. I think there are two approaches: high
level "do NPC/hero obstacle checking exactly like the engine does" that
might be useful for scripting eg pathfinding, and could be affected by a
pixel-based-movement option, or low level "check for collisions with
walkabouts" that would be a building block for scripting your own movement.
So there could be commands for both, if they would actually get used. But
maybe the latter would not get used enough to bother... I know recently
I've said several times "use the wall checking commands and do your own
collision checking with 'find colliding slice'", but have have to look into
those specific use-cases actually were.
Plus, unfortunately the wall checking commands I added recently don't
support NPC zones or one-way walls.

On 18 March 2017 at 08:48, <subversion at hamsterrepublic.com> wrote:

> james
> 2017-03-17 12:48:56 -0700 (Fri, 17 Mar 2017)
> 389
> Clean up perform_npc_move() refactoring the collision detection for walls,
> zones, hero, and other npcs
> into the new npc_collision_check() function which can be used in other
> places (for example, new movement types)
>
> Haven't decided yet whether to expose a plotscripting interface towards
> this, leaning towards
> yes, but don't want to interfere with future non-tile-algined movement
> support
> ---
> U   wip/game.bas
> _______________________________________________
> Ohrrpgce mailing list
> ohrrpgce at lists.motherhamster.org
> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/attachments/20170318/b23830ca/attachment.htm>


More information about the Ohrrpgce mailing list