Page 1 of 3

Porting of Field of Vision MRPAS + LoS + A*Star

Posted: Tue Aug 10, 2010 4:49 pm
by bartoleo
Hi,
I made a Love2d-lua porting of Field of Vision MRPAS
original code: http://umbrarumregnum.110mb.com/download/mrpas
it is not 100% finished (I must rewrite map as object and not n-arrays)
but it works
you can toggle walls with mouse click
you can move @ character with arrows
key 1 : calculate FOV after move (as rogulikes do)
key 2 : calculate FOV every update (for benchmark)
key 3 : decativate LOS (line of sight)
key 4 : activate LOS
key 5 : deactivate A*Star pathfinding
key 6 : activate A*Star pathfinding
key 7 : move enemies (G characters) on A*Star path
key c : 'old' a*star, good paths, but slow (I have not yet understood why)
key C: 'old' a*star with 'closerpath', less beatiful paths, but slow (I have not yet understood why)
key left cntrl + c : new A*Star, less beatiful paths but it's faster (default now)

A*Star now OK!
A*Star T-Engine Version

file updated (17 aug 2010, corrected profiler)

Re: Porting of Field of Vision MRPAS

Posted: Tue Aug 10, 2010 6:21 pm
by ljdp
Very interesting, it's like an inverse shadow function

Re: Porting of Field of Vision MRPAS

Posted: Tue Aug 10, 2010 6:36 pm
by nevon
ljdp wrote:Very interesting, it's like an inverse shadow function
Isn't it exactly like a shadow function - if you see the player as the light source?

I've actually been toying with the same thing, but not in a tiled world.

Re: Porting of Field of Vision MRPAS

Posted: Tue Aug 10, 2010 9:42 pm
by kikito
I'm very impressed with this. Thanks for sharing!

Re: Porting of Field of Vision MRPAS

Posted: Wed Aug 11, 2010 11:10 am
by bartoleo
I've updated .love
cleaner version
with map cells as objects and mrpas functions as separate module

coming soon Line of Sight function and A*Star Pathfinding

Re: Porting of Field of Vision MRPAS

Posted: Wed Aug 11, 2010 4:13 pm
by bartoleo
i've updated .love

added LOS = Line of Sight
activate with key 4 (deactivate with 3)

added A*Star (taken from http://github.com/philnelson/A-Star-Pathfinding-For-Lua
activate with key 6 (deactivate with 5)

added monster movement (character G) on A*Star path

I'm rewriting A*Star , the implementation I took is too "rectangular", anyway thanks philnelson

sorry for my english :death:

Re: Porting of Field of Vision MRPAS

Posted: Wed Aug 11, 2010 4:34 pm
by vrld
Very nice, I like it!
The path found by A* seems a bit ... rectangular though.

Re: Porting of Field of Vision MRPAS

Posted: Thu Aug 12, 2010 8:03 am
by bartoleo
yes it's too rectangular...
i'm porting another a*star code

Re: Porting of Field of Vision MRPAS

Posted: Thu Aug 12, 2010 4:41 pm
by bartoleo
ok, i'm using another A* pathfinding algorithm
i took it here
http://wiki.garrysmod.com/?title=A-Star ... ing_Module
by Deco Da Man
it's dynamic and customizable

i've updated .love

now I have the elements for my game

Re: Porting of Field of Vision MRPAS + LoS + A*Star

Posted: Thu Aug 12, 2010 4:50 pm
by kikito
I like it very much.

One thing though: when A* is activated, my FPS drops dramatically ( from ~50 to ~3 ) when I "hide" behind the left wall.