Everything is scriptableFebruary 1, 2013|
We are now ramping up development of the yet unannounced “new Grimrock project” and we thought we could share some tidbits of development goodness to you. This week I’m going to talk a little about the changes under the hood of the engine.
Up to now mostly everything in the dungeon has been scriptable. This means that we (and modders) can spawn and destroy alcoves, pressure plates, monsters, items and so on at will. This has proven to be tremendously useful. But one thing has been lacking: the dungeon walls themselves have been living outside the realm of scripting. In fact, for performance reasons they were originally implemented as a special case making them completely static. So, for example, spawning an alcove on top of a wall results in the alcove overlapping with the wall since the wall and alcove share the same space.
We thought about various ways to workaround this problem, but quickly we realised that fixing this problem once and for all means that we should have access to the walls from script and being able to dynamically destroy them. And this is exactly what I have been working on this week. Now everything, including the walls, floors, ceilings and pillars are fully scriptable entities. It is now possible to retrieve the wall entity from the dungeon and call methods such as “destroy” on it. In fact, spawning an alcove now takes care of destroying the wall automatically, so we (or modders) don’t even need to bother with deleting it using script. Likewise, spawning a wall on top of an alcove destroys the alcove automatically. This works for pressure plates and everything else that should replace the existing object automatically. (In modding terms: this works because the alcove and wall entities have the “replacesWall” property set and alcoves and walls have both wall placement.)
We have also added all walls, floors and ceilings to the editor as placeable entities. This way it is very easy to mix and match different wallsets. Another improvement is the addition of onInit hooks to all entities. The hook is called when the map has been loaded and it allows customizing the dungeon geometry easily. For example, we wanted to have huge chasms that span multiple squares with custom objects that are placed at the boundary of the chasm. Placing the objects manually by hand is tedious work so we added a small piece of script that automatically adds them.
What this means in practice? Simply put dungeons can now be much more dynamic and scripting possibilities have been much improved.