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

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
bartoleo
Party member
Posts: 118
Joined: Wed Jul 14, 2010 10:57 am
Location: Savigliano

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

Post 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)
Attachments
mrpas.love
(13.42 KiB) Downloaded 426 times
Last edited by bartoleo on Tue Aug 17, 2010 2:32 pm, edited 8 times in total.
Bartoleo
User avatar
ljdp
Party member
Posts: 209
Joined: Sat Jan 03, 2009 1:04 pm
Contact:

Re: Porting of Field of Vision MRPAS

Post by ljdp »

Very interesting, it's like an inverse shadow function
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Porting of Field of Vision MRPAS

Post 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.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Porting of Field of Vision MRPAS

Post by kikito »

I'm very impressed with this. Thanks for sharing!
When I write def I mean function.
User avatar
bartoleo
Party member
Posts: 118
Joined: Wed Jul 14, 2010 10:57 am
Location: Savigliano

Re: Porting of Field of Vision MRPAS

Post 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
Bartoleo
User avatar
bartoleo
Party member
Posts: 118
Joined: Wed Jul 14, 2010 10:57 am
Location: Savigliano

Re: Porting of Field of Vision MRPAS

Post 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:
Bartoleo
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: Porting of Field of Vision MRPAS

Post by vrld »

Very nice, I like it!
The path found by A* seems a bit ... rectangular though.
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
User avatar
bartoleo
Party member
Posts: 118
Joined: Wed Jul 14, 2010 10:57 am
Location: Savigliano

Re: Porting of Field of Vision MRPAS

Post by bartoleo »

yes it's too rectangular...
i'm porting another a*star code
Bartoleo
User avatar
bartoleo
Party member
Posts: 118
Joined: Wed Jul 14, 2010 10:57 am
Location: Savigliano

Re: Porting of Field of Vision MRPAS

Post 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
Bartoleo
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

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

Post 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.
When I write def I mean function.
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests