Hello, I'm new here and a programming thing is quite new to me as well (but I know how to make formulas in excel quite good and did some *.bat scripts before only such "big" project is totaly new to me)
Anyway I decided to give it a try and I managed to make something wich works:
rooms are generated and connected (bsp file)
path finding algoritm is done (astar file)
monsters are moving with different speed (monsterMove file)
as i said - first try (but it took me week to make it:) )
At first I was a little afraid of posting it here but otherwise I wouldn't learn much so if you guys have a time then pls take a look at this and point out all things I did wrong (probably 90%)
the file is quite big because fonts are included (DejaVuSansMono.ttf)
you can move with arrows
generate new level with enter
display a path to the exit with 2
quit with escape
nothing else.
Thank You.
that is my first attempt of doing some dungeons
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
that is my first attempt of doing some dungeons
- Attachments
-
- outline.love
- (191.05 KiB) Downloaded 78 times
Last edited by pch on Wed Mar 07, 2012 6:51 pm, edited 1 time in total.
Re: that is my first attempt of doing some dungeons
It crashes when you are on the exit and try to calculate the way to the exit xD Otherwise it works flawlessly, nice job
Re: that is my first attempt of doing some dungeons
oh man!
I wouldn't even think of that
thanks for checking!
I wouldn't even think of that
thanks for checking!
Re: that is my first attempt of doing some dungeons
Ah, the very beggining of an ascii roguelike engine. Simple, good. Till now didn't notice problems. I will like study your astar and bsp engines. Nice work!
Re: that is my first attempt of doing some dungeons
that would be very nice!
astar is quite simple - I found tutorial and then I took a piece of paper and made a grid and found out how it works. I did 4 versions - this one is far the fastest one - so I kept it.
bsp is a mess - i found an article on wiki and tried to make it work - room generator is fine (I think) but I had a lot of trouble with corridors - most likely it can be much simpler - sorry but there are no coments (just a couple)
astar is quite simple - I found tutorial and then I took a piece of paper and made a grid and found out how it works. I did 4 versions - this one is far the fastest one - so I kept it.
bsp is a mess - i found an article on wiki and tried to make it work - room generator is fine (I think) but I had a lot of trouble with corridors - most likely it can be much simpler - sorry but there are no coments (just a couple)
Re: that is my first attempt of doing some dungeons
Your astar is quite simple but is working well and I think calculating "rogue" diagonals as It should . Simple suggestion. When Astar active why don't "realtime" recalculate path when you move? A cool thing could be using "tab" or other key for generate instead alt path between player and enemies. Also, since you had path finding done instead of random move why not introduce a chasing mode for mobs?pch wrote:that would be very nice!
astar is quite simple - I found tutorial and then I took a piece of paper and made a grid and found out how it works. I did 4 versions - this one is far the fastest one - so I kept it.
bsp is a mess - i found an article on wiki and tried to make it work - room generator is fine (I think) but I had a lot of trouble with corridors - most likely it can be much simpler - sorry but there are no coments (just a couple)
your bsp is more hard to read but also seems be random generating well with some bigger rooms ocasional. I liked.
Re: that is my first attempt of doing some dungeons
no more crashes when player is already standing on exit.
I just changed it slightly so now TAB toggles player->exit path on/off and the path is being calculated after every key press.
When I did the same to all monsters (path monster->player) my notebook died (it's gma500 with atom z550) - one move took ~3 sec (when 15 monsters were present).
I will definitely try correcting this but first would like to ask if storing a map in "layers" is good idea. Something like this:
map[y][x][1]-walls
map[y][x][2]-floors
map[y][x][3]-"furnitures"
map[y][x][4]-monsters
...
how can I simplyfy that long lines in love.draw - they are long because I keep player in the center. Is there another way of doing it?
also I'd like to ask if somebody is willing to rewrite attached astar code (it's very short) making it look a little bit more "pro" - that'd be a great way to understand this kind of writing and learn a little more.
Thanks
I just changed it slightly so now TAB toggles player->exit path on/off and the path is being calculated after every key press.
When I did the same to all monsters (path monster->player) my notebook died (it's gma500 with atom z550) - one move took ~3 sec (when 15 monsters were present).
I will definitely try correcting this but first would like to ask if storing a map in "layers" is good idea. Something like this:
map[y][x][1]-walls
map[y][x][2]-floors
map[y][x][3]-"furnitures"
map[y][x][4]-monsters
...
how can I simplyfy that long lines in love.draw - they are long because I keep player in the center. Is there another way of doing it?
also I'd like to ask if somebody is willing to rewrite attached astar code (it's very short) making it look a little bit more "pro" - that'd be a great way to understand this kind of writing and learn a little more.
Thanks
Re: that is my first attempt of doing some dungeons
to all??? I wasn't for sure thinking you do such, just "tab" to cycle between entities and draw a path between you and one selected enemy.pch wrote: When I did the same to all monsters (path monster->player) my notebook died (it's gma500 with atom z550) - one move took ~3 sec (when 15 monsters were present).
I don't have yet experience with path finding so I'm not the right guy to do that. But did you already checked other LOVE nice path findings? You have Roland_Yonaba's old engine viewtopic.php?f=5&t=3459, Marekk's Pie viewtopic.php?f=5&t=7174, kikito's new pulsar
viewtopic.php?f=5&t=7983. All great engines and with nice discussions about that matter.
About the layers it's important but I personally don't use so many layers. I use a more real physical aproach (Ground/Above Ground) and don't consider monsters as belonging to map type (but a lot of people do it that way). Also since furnitures can't usually overlap walls I don't have necessity of use different layers. But can be handy for some map layouts (like cuckoo clock in the wall). If you feel confortable with that layout go ahead, as long it suits you.
EDITED About your movement it's more elegant do a generic "move" function. Send coordinates where you want to move. This style
Code: Select all
if p_key == 'q' or p_key == 'kp7' and hero.y-1 > 0 and hero.x-1 > 0 then
hero.move (-1,-1)
end/else
Re: that is my first attempt of doing some dungeons
thanks for the links and explanation - will check them (links) right away and will think over my approach.
well, yes - one monster or just a bunch of them whithin small range should work
i've started reading some FOV (field of view), LOS (line of sight) tutorials so I'd like to include it there (but at the moment it just scares me off).
eta:
haven't seen your sugestion about movement - will check it out
well, yes - one monster or just a bunch of them whithin small range should work
i've started reading some FOV (field of view), LOS (line of sight) tutorials so I'd like to include it there (but at the moment it just scares me off).
eta:
haven't seen your sugestion about movement - will check it out
Re: that is my first attempt of doing some dungeons
You could try read this awesome resource http://www-cs-students.stanford.edu/~am ... html#pathspch wrote:thanks for the links and explanation - will check them (links) right away and will think over my approach.
well, yes - one monster or just a bunch of them whithin small range should work
i've started reading some FOV (field of view), LOS (line of sight) tutorials so I'd like to include it there (but at the moment it just scares me off).
eta:
haven't seen your sugestion about movement - will check it out
About tun based FOV/LOS in LOVE
viewtopic.php?f=5&t=1797
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 9 guests