Modify a dungeon without restarting playing it

Are you looking for fun Custom Dungeons that you could play or do you want to share your mod with others? Then this forum is for you!
Post Reply
fiucio
Posts: 1
Joined: Sun Jun 28, 2015 9:41 am

Modify a dungeon without restarting playing it

Post by fiucio »

Hi,
I created a custom dungeon quite large and start playing with it. Unfortunately, I found a couple of mistakes. I corrected them but then I need to re-start the dungeon from the beginning, which is quite annoying. Is there any trick to change the dungeon and then load the saved game and continue with the corrected version of the dungeon?

Thanks
Emanuele
Azel
Posts: 808
Joined: Thu Nov 06, 2014 10:40 pm

Re: Modify a dungeon without restarting playing it

Post by Azel »

I think that "some" changes will take effect, but any major changes do require starting over.

Folks with better knowledge than myself can guide you better over at the Modding forum: http://grimrock.net/forum/viewforum.php?f=22 :mrgreen:

I read something recently that talked about a way to make it easier to implement an update without requiring players to re-start; I don't recall the specifics but I remember seeing it and thinking that it didn't really help with major updates (like fixing bugs with scripts that have already executed, or triggered events that already fired).

It's great that you are exporting your dungeon and playing through it entirely as part of the Quality Assurance process, but if you're having to restart a lot then it sounds like you may need to spend more time testing from inside the Editor itself. It tends to be more difficult to test in the Editor, when compared to an exported game, with things related to character progression: balancing character levels with enemy traps, monsters, and boss battles.

Although even that can be simulated more accurately via the Editor by simply using scripts to advance your characters to whatever level you need them to be, and any items they "should have" ata specific point in the game.

I understand though, even with the demo release of my Mod (mystrock), I can say that 90% of the bugs found after release could have easily been caught via Editor testing :o
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: Modify a dungeon without restarting playing it

Post by minmay »

I believe dungeon.lua is not loaded again at all, so changes to tiles, heightmap, etc. will not be applied. Changes to things like script entity source will certainly not be applied. I don't know if changes to external scripts loaded by script entities will be applied or not.
Assets and are not saved and will be reloaded. Since objects without minimalSaveState have their complete states saved, you probably won't be able to change existing objects/items/monsters much, only newly spawned ones.
It is easy to implement a version check in your mod. The easiest way is to put "GameMode.ModVersion = 100" or whatever in your init.lua, and then "GameMode.SavegameVersion = GameMode.ModVersion" in code that will run once at the beginning of the game (for example, the source of a script_entity). Then any file loaded after your init.lua other than dungeon.lua, or any other code that runs whenever the game reloads (such as an onInit hook in an object with minimalSaveState only), can compare the two versions and make adjustments if they are different. Actually making those adjustments is the difficult part.
If you don't like changing the global tables you can accomplish the same thing with a script entity and a minimalSaveState onInit hook instead of an init.lua line.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Post Reply