Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 54 55 [56] 57 58 ... 72

Author Topic: The Roguelike Development Megathread  (Read 245566 times)

Girlinhat

  • Bay Watcher
  • [PREFSTRING:large ears]
    • View Profile
Re: The Roguelike Development Megathread
« Reply #825 on: November 21, 2012, 07:39:03 pm »

But how would I get creatures to path to something they can't see?

Kerbobotat

  • Escaped Lunatic
    • View Profile
Re: The Roguelike Development Megathread
« Reply #826 on: November 21, 2012, 08:52:33 pm »

Hey guys, Ive been a long time lurker of B12 and this thread in particular. For a long time Ive been working on my own roguelike in python and libtcod, but Ive hit a problem when I decided to change over to using notepad++ as my editor. Its the common "module not found" error and its driving me nuts. Ive had a look at the various explanations of what to do, but I cannot seem to make it work. It just will not execute the python file. Any chance one of you fine gentlemen would be able to help me set up notepad++ and libtcod for python?
Logged

Girlinhat

  • Bay Watcher
  • [PREFSTRING:large ears]
    • View Profile
Re: The Roguelike Development Megathread
« Reply #827 on: November 21, 2012, 09:01:33 pm »

Can you run it in IDLE but the identical code doesn't run in N++?

jhxmt

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #828 on: November 22, 2012, 04:57:32 am »

But how would I get creatures to path to something they can't see?

Well, all you need are the x and y coordinates to feed to the path calculation. In my example above, I check to see if the monster is in the player's fov, then feed the path calculator the player's coordinates if so. But you could just as easily remove the fov check and have every monster, seen or unseen, path to the player - or indeed to the coordinates of any other object you're able to identify.

Also, I did have an example somewhere of monsters using their own fov, with a different sight range to the player's (monsters see better in the dark ;)). Not sure that's the best way to implement different sight ranges, though.
Logged
Quote from: beefsupreme
Try slaughtering a ton of animals, meat makes less decisions than animals.

Why Your Ramps Don't Work
How To Breach A Volcano Safely

BlindKitty

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #829 on: November 22, 2012, 02:03:39 pm »

Congratulations, jhxmt. :) Conceiving life is always a great accomplishment. :D Hope you won't stumble upon similar bugs all too often... But hey, since I have noticed that I made current_attack_skill and current_defense_skill static in my Creature class (which every living being, player or enemy, inherits from) - and therefore had big-bulky-almost-non-moving enemy using dodge (which he had close to 0) because I chose it a moment before - I'm pretty sure that almost every person making any sort of game is more perceptive than I am. So, you will probably have easy times dealing with any bugs, since I'm pretty perceptive, glasses on. :D

Kerbobotat - since I know nothing of Python, I can not help you, but I think I can suggest a place to search for an answer: stackoverflow.com. I had a lot of luck searching for answers there, so maybe give it a shot? You also can post your own question if you like to.
Logged
My little roguelike craft-centered game thread. Check it out.

GENERATION 10: The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: The Roguelike Development Megathread
« Reply #830 on: November 22, 2012, 02:34:25 pm »

Started revamping my item infrastructure for my roguelike/dungeon management game last night.  Once its finally all in place(which it mostly is) I can finish the loading/saving functionality, which is almost in place as well.  Then I can finally move on to some of the more interesting things.

I think my next goal will be to add a sleep mechanic for my monsters and get a barracks/beds implemented. 
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

Kerbobotat

  • Escaped Lunatic
    • View Profile
Re: The Roguelike Development Megathread
« Reply #831 on: November 22, 2012, 03:37:29 pm »

Can you run it in IDLE but the identical code doesn't run in N++?

Thats it exactly. Works fine from IDLE, and while Ive been using IDLE initally while learning python, I'd like to switch to NP++ because its a much nicer enviroment for coding in.

When I try to run it, it throws this error at me:

Code: [Select]
Traceback (most recent call last):
  File "C:\Users\Kerbobotat\Documents\Python Projects\RT\rogue.py", line 1, in <module>
    import libtcodpy as libtcod
  File "C:\Users\Kerbobotat\Documents\Python Projects\RT\libtcodpy.py", line 60, in <module>
    _lib = ctypes.cdll['./libtcod-VS.dll']
  File "C:\Python27\lib\ctypes\__init__.py", line 440, in __getitem__
    return getattr(self, name)
  File "C:\Python27\lib\ctypes\__init__.py", line 435, in __getattr__
    dll = self._dlltype(name)
  File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found

Any help at all would be great. I've unfortunately been putting off working on my project because of this annoyance. (At least, that's how 'Im justifying it)
Logged

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: The Roguelike Development Megathread
« Reply #832 on: November 22, 2012, 03:55:04 pm »

I wonder if the working directory has changed when using NP++?  Then it might be looking for libtcod-VS.dll elsewhere instead of in your code directory.  Might be worth looking around for an NP++ path config option.
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

jhxmt

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #833 on: November 22, 2012, 04:17:28 pm »

I wonder if the working directory has changed when using NP++?  Then it might be looking for libtcod-VS.dll elsewhere instead of in your code directory.  Might be worth looking around for an NP++ path config option.

Yeah, I ran into a similar error when I shifted my working directories around (trying to lend a bit of structure to my floundering) and forgot to copy the libtcod DLL along with everything else.  All files where they should be?
Logged
Quote from: beefsupreme
Try slaughtering a ton of animals, meat makes less decisions than animals.

Why Your Ramps Don't Work
How To Breach A Volcano Safely

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: The Roguelike Development Megathread
« Reply #834 on: November 22, 2012, 04:21:23 pm »

I wonder if the working directory has changed when using NP++?  Then it might be looking for libtcod-VS.dll elsewhere instead of in your code directory.  Might be worth looking around for an NP++ path config option.

Yeah, I ran into a similar error when I shifted my working directories around (trying to lend a bit of structure to my floundering) and forgot to copy the libtcod DLL along with everything else.  All files where they should be?

I'm sure your files are fine where they are, its probably just NP++ that is confused.  I did find this when googling:  http://stackoverflow.com/questions/11600896/notepad-cannot-find-filepath

If that last post doesn't help, I'm not sure what else it could be.
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

jhxmt

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #835 on: November 22, 2012, 05:27:26 pm »

I'm sure your files are fine where they are, its probably just NP++ that is confused.  I did find this when googling:  http://stackoverflow.com/questions/11600896/notepad-cannot-find-filepath

Sorry, I may have confused things with my quoting - I mean, I ran into the same error message as Kerbobotat (though in my case I wasn't using NP++ at all), and in my case it was due to a misplaced file.  But yes, it may also be NP++ specific, as per the post you linked.  Apologies for any confusion!  :)

I have set myself the task of unpicking the map generation function from the Complete Roguelike Tutorial.  I dislike how it mixes creating the map (of the terrain), creating objects within that map, including monsters, and then initialises the fov after all that's done.  I would much rather create the terrain map, possibly then the non-monster objects, then initialise the fov, and then be able to create the monsters subsequently.  This would allow me to initialise the monsters with path objects, as I'd be able to pass the fov_map to them.  I'd then have to subsequently recompute the fov_map (and therefore any calculated paths) before actual playtime starts, but at least the fov_map would be available at monster initialisation, which would mean one less check every time a monster AI had to take_turn.  For some reason I'm thinking that's a better way.  I may be proven to be wrong when I actually try and do it.  Hmm.

Edit: for grammar.
Logged
Quote from: beefsupreme
Try slaughtering a ton of animals, meat makes less decisions than animals.

Why Your Ramps Don't Work
How To Breach A Volcano Safely

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: The Roguelike Development Megathread
« Reply #836 on: November 22, 2012, 05:35:07 pm »

Seems reasonable to me.  :)  Experimentation is definitely the best way to find out what works best in my opinion.  I swear I've spent 90% of my current project rewriting and rewriting my infrastructure until it worked better and better for me.  :D 

I think in my code I ditched the FOV map entirely and just used simple line drawing + distance for LOS to simplify things.  I figured that nobody will be able to really tell if the monster was able to see at an angle anyway.  I can't quite remember what I did for pathing, but I seem to remember I had a hard time making it work well and be efficient.  Oh well.
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

da dwarf lord

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #837 on: November 22, 2012, 05:36:05 pm »

I'm sure your files are fine where they are, its probably just NP++ that is confused.  I did find this when googling:  http://stackoverflow.com/questions/11600896/notepad-cannot-find-filepath

Sorry, I may have confused things with my quoting - I mean, I ran into the same error message as Kerbobotat (though in my case I wasn't using NP++ at all), and in my case it was due to a misplaced file.  But yes, it may also be NP++ specific, as per the post you linked.  Apologies for any confusion!  :)

I have set myself the task of unpicking the map generation function from the Complete Roguelike Tutorial.  I dislike how it mixes creating the map (of the terrain), creating objects within that map, including monsters, and then initialises the fov after all that's done.  I would much rather create the terrain map, possibly then the non-monster objects, then initialise the fov, and then be able to create the monsters subsequently.  This would allow me to initialise the monsters with path objects, as I'd be able to pass the fov_map to them.  I'd then have to subsequently recompute the fov_map (and therefore any calculated paths) before actual playtime starts, but at least the fov_map would be available at monster initialisation, which would mean one less check every time a monster AI had to take_turn.  For some reason I'm thinking that's a better way.  I may be proven to be wrong when I actually try and do it.  Hmm.

Edit: for grammar.

AFAIK you could just initialize the empty map at the start of the program as an empty FOV map, use the empty fov_map to initialize the path objects for the monsters but not compute them, then after the fov_map is computed go back and recompute the path objects to actually contain the path info?
Logged

jhxmt

  • Bay Watcher
    • View Profile
Re: The Roguelike Development Megathread
« Reply #838 on: November 22, 2012, 06:02:16 pm »

I think in my code I ditched the FOV map entirely and just used simple line drawing + distance for LOS to simplify things.  I figured that nobody will be able to really tell if the monster was able to see at an angle anyway.  I can't quite remember what I did for pathing, but I seem to remember I had a hard time making it work well and be efficient.  Oh well.

I may end up doing something like this in the long run - LOS makes more (conceptual) sense to me, and given I eventually want to be able to implement terrain costs for movement and other fun things I'm going to have to either write my own pathfinding function or gut the existing one anyway.  ;)

AFAIK you could just initialize the empty map at the start of the program as an empty FOV map, use the empty fov_map to initialize the path objects for the monsters but not compute them, then after the fov_map is computed go back and recompute the path objects to actually contain the path info?

That actually sounds like an excellent plan - I might do that!

Although it appears that even having worked around the fov-map-being-ready-before-monsters-are-initialised problem, it's refusing to work.  It seems that any call to libtcod.path_new_using_map(fov_map,1.41) in my AI __init__ is causing an assertion somewhere in libtcod's own pathing module.  Not a clue what's causing that.  I may stick with my original usage - checking for a path object when the AI takes its first turn, and creating one then if not found.  That kinda makes sense, anyway...it only needs a path if it's planning on taking a turn, after all!  :P
Logged
Quote from: beefsupreme
Try slaughtering a ton of animals, meat makes less decisions than animals.

Why Your Ramps Don't Work
How To Breach A Volcano Safely

Urist McScoopbeard

  • Bay Watcher
  • Damnit Scoopz!
    • View Profile
Re: The Roguelike Development Megathread
« Reply #839 on: November 23, 2012, 03:09:46 pm »

So, I got my graphics libraries working and have been thinking about doing a RL game, I've started doing a little coding, but I'd like to know how y'all are rendering your maps.

As it stands, I just define each tile indepently (in an array) and was trying to develop an algorithm to set the coordinates of each one, but after some testing that is blatantly inefficient and time consuming, FPS destroying in fact. I guess I should be using some classes from openGL to render the thing, but frankly I think I need an explanation.

All help appreciated. Thanks!

EDIT: I should mention i'm using LWJGL and Slick2D
Logged
This conversation is getting disturbing fast, disturbingly erotic.
Pages: 1 ... 54 55 [56] 57 58 ... 72