Page 1 of 1

Advanced enemy AI, hooks and random level generation

Posted: Mon Oct 08, 2012 11:28 pm
by BeNNyBiLL
Hello LOG team and forum users,

I've been trying out the level editor over the past few days and can see myself doing promising things with it. But I have a few issues with the more advanced features. I am aware this is only the beta and there may be more to come, but I would like to know what is actually possible now, what is soon to become possible and what will never be possible.

I think the biggest attraction to me with modding this game will be for making new monsters. As custom "AI states" and "brains" don't seem possible at this point in time I have been trying to manipulate new enemy logic through their hooks. I think the first thing I noticed was the inability to invoke a monster to perform an action. Say force a monster to attack when it wouldn't normally attack (e.g. a monster that can attack backwards would need to be forced to its onAttack hook when the player is behind that monster). I would expect this logic to be encompassed by the monster brain, but as I recently mentioned, I can't change these as of yet. So will custom brains come in the near future, or will there be a way to invoke actions for monsters? (OR can this be done already and I've missed something?)

Next thing I found is that actions such as a "rush" from an ogre is not caught by any hook. I would expect onAttack to return "rush" as its "attack" parameter when an ogre readies itself to charge. Wouldn't you just love to see a rushing ogre thats run straight past you, then teleport to your side while continuously charging attacking at every flank? Yes, I want to make a warp beast ;-)

Lastly I would like to mention the huge scope for turing Grimrock into a Roguelike. Being able to script almost all aspects of the game should easily allow for random level creation and infinite Grimrock dungeons. I for one find this an exciting concept, and one I may persue. But curently I have a few issues. Can I create rooms (i.e. create empty space for rooms, corridoors, etc) using LUA script only? So basically, there will be no level editing, only what the script makes from random numbers. From the scripting references I've looked at this currently looks impossible, although maybe this could be added as a future feature? The other alternative would be to have all rooms pre-drawn in the level editor, and have their contents created via script on launch of the level (I'm thinking like the old board game hero quest, or something along those lines). Use randomly placed hidden walls to change the whole dungeon layout and randomly generate each rooms contents and you have a Grimrock Roguelike.

So, anyone got any thoughts on these issues?

Re: Advanced enemy AI, hooks and random level generation

Posted: Tue Oct 09, 2012 12:54 pm
by Wolfrug
I think there was some discussion earlier about randomly generated dungeons. Basically the walls-not-walls part cannot be scripted, as the layout of the dungeon is determined when it loads, BUT you can use secret doors to create walls and then close/open them to create random rooms. The algorithms for this is waaaay beyond me though, but it's theoretically possible at least.

As to random or semi-random monster and loot spawns, this is pretty easy to do. I've got a bunch of dungeon levels I'm working on currently that have working semi random monster and loot spawns. Self-promotion: I'm recreating the Mordor: Depths of Dejenol dungeon experience, which was a kind of semi-roguelike dungeon crawl with random monsters that got more difficult the deeper you went but with fixed dungeons. If someone figured out the algorithms needed to create random rooms, we'd pretty much have a roguelike right there :)

As to enemy AI hooks, I don't know! Maybe they'll let us script custom brains in the future at some point - maybe through some kind of FSM system? I dunno!

-Wolfrug

Re: Advanced enemy AI, hooks and random level generation

Posted: Tue Oct 09, 2012 1:54 pm
by djoldgames
As wolfrung posts, only chance to build the custom dungeon after it loads is using grimrock entities - like closed secret walls for example.

Your other option is generate the dungeon like grimrock generate it - create your own file "dungeon.lua" with map, scripts etc... This could be an external aplication, for example: you can create a PHP web site to generate the rogue-like dungeons for grimrock ;-)

Re: Advanced enemy AI, hooks and random level generation

Posted: Tue Oct 09, 2012 7:00 pm
by BeNNyBiLL
Thank you for your insight guys. I think I may have found the thread you were reffering to viewtopic.php?f=14&t=3390&p=34293&hilit ... ike#p34293. Looks like I'm on the ball with how I need to go about making a roguelike with Grimrock. The external map idea sounds really cool, but I think I'm going to generate it all on the fly. I have lots of ideas floating about in my head and I'm confident I can do it, I'll see how fast I can create a tech demo for it.

On another note, is there anyway to expose custom variables to the entity inspector of the editor? I have the feeling I'm going to have to hard code a lot of stuff! :shock: