Merry Christmas!

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: Merry Christmas!

Post by JohnWordsworth » Fri Dec 25, 2020 12:37 am

Merry Christmas @petri and Everyone!

Not been around much due to, well, real life and the like - but looking forward to firing up Grimrock 2 again and poking around based on the comments here!

In completely random news - I have an M1 MacMini and Grimrock 2 was one of the first games I fired up on it. Obviously, it's still an integrated GPU on the SoC but it runs at around 60fps (often at 60fps, but sometimes 55fps) during the first 20 minutes or so of game play (low GFX mode). Nice that it works through Rosetta2 though and I'm sure it'll run great on the MBP's that come out next year with better GPUs!
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.

minmay
Posts: 2697
Joined: Mon Sep 23, 2013 2:24 am

Re: Merry Christmas!

Post by minmay » Fri Dec 25, 2020 12:42 am

I feel like I ought to apologize about something I did a few years ago ;p

This definitely wasn't something I expected! Impressed, excited, grateful, etc.

Though the real puzzle for me is going to be figuring out how to make a .cfg file that lets Windows users switch between the Direct3D and OpenGL render engines...
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.

User avatar
7Soul
Posts: 166
Joined: Sun Oct 19, 2014 1:56 am
Location: Brazil

Re: Merry Christmas!

Post by 7Soul » Fri Dec 25, 2020 3:27 am

Join the LoG discord server: https://discord.gg/ArgAgNN :D

My Mod The Old Nexus (wip)

User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: Merry Christmas!

Post by petri » Fri Dec 25, 2020 9:57 am

Hah, that's a clever way to break free from the cage! :)

Reminder, let's try to make umods as minimal as possible. Usually there's a cleaner way than to copy-paste code and modify it. The problem with that approach is that mods can easily conflict with each other, and if/when we make game updates in the future, your mod can easily override them.

I didn't test it, but I think the longhands mods could be condensed to this:

Code: Select all

function PartyComponent:canReach(pos)
    return true
end

function PartyComponent:canReach2(obj)
    return true
end
Anyway, not a biggie for this PoC mod, but something to keep in mind.

ratman
Posts: 137
Joined: Fri Jan 10, 2020 1:13 am

Re: Merry Christmas!

Post by ratman » Fri Dec 25, 2020 3:56 pm

Merry Christmas everyone!
I will probably not be looking at this untill tomorrow, but I am very impatient. What do you mean by 'hook any function in the game?' Is there some that you can't normally?
edit: Nevermind, I opened it. I don't think I'm nearly advanced enough at scripting to do anything with this though

User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: Merry Christmas!

Post by JohnWordsworth » Sat Dec 26, 2020 12:15 am

Hypothetical question here... Would this allow you to require('sockets') to load the socket library (after placing the library in the right place / updating the path in Lua to find it)?

Just thinking, it could be pretty cool to do one of two things;

1. Build a Twitch extension so that players can interact with the game.
2. Provide a simple server that could be used to connect a separate application to the game to show the map in a second window.

Now, I probably won't have time to actually do either of those things - but it's interesting to ponder!
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.

User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: Merry Christmas!

Post by petri » Sat Dec 26, 2020 8:21 am

Hi! That is an interesting idea! However, umods code must be disributed as plain text files. That rules out any native extensions like that, the licensing terms explicitly forbid precompiled code. This is for security reasons so that anyone can check that the mod is not doing bad things if needed, and also so that the mod can (at least in theory) work on any platform where Grimrock can run.

Modding and Asset Usage Terms:
http://www.grimrock.net/modding_log1/mo ... age-terms/

Kirill
Posts: 79
Joined: Mon Dec 21, 2020 5:36 pm

Re: Merry Christmas!

Post by Kirill » Sat Dec 26, 2020 10:35 am

Thank you a lot! Since there wont be Legend of grimrock 3 (i finished Druidstone, but not like that much), at least we can play mods. I know several good ones. The Forbidden halls for LoG1, Eye of Atlantis and The Guardians for LoG2, etc.

User avatar
antti
Posts: 686
Joined: Thu Feb 23, 2012 1:43 pm
Location: Espoo, Finland
Contact:

Re: Merry Christmas!

Post by antti » Sat Dec 26, 2020 11:42 am

Hello everyone. I hope your holiday times were fun and merry, despite the weird year.

Here's a quickie mod I made when testing the system: "Barely Working Turn-Based Grimrock"! :lol:

It shoehorns a very rudimentary turn-based system into the game where the monsters wait for you to act before doing something themselves. It's broken in a thousand ways, can easily be cheesed (by, for example, performing moves at a faster pace than the monsters do) and it's probably not fun at all but I'll leave it here to serve as a lightweight example umod on how to hook into old functions and expand them etc.

Code: Select all

-- Barely Working Turn-Based Grimrock
-- You may use and modify this freely for producing new Grimrock 2 umods

local oldNewGame = GameMode.newGame
local oldPartyComponentMove = PartyComponent.move
local oldPartyComponentTurn = PartyComponent.turn
local oldBrainComponentUpdate = BrainComponent.update
local oldChampionAttack = Champion.attack
local oldChampionCastSpell = Champion.castSpell

local monsterLastTurnTime = 0

local function log(s, duration)
	gui:hudPrint(tostring(s), duration or 6)
end

----------------------------------

-- monsters

local function monsterTurnBegin()
	monsterLastTurnTime = Time.currentTime
	log("New turn.", 2)
end

function BrainComponent:update()
	if Time.currentTime - 1.0 < monsterLastTurnTime then
		self.waitingEndTime = nil
		oldBrainComponentUpdate(self)
	end
end

----------------------------------

-- party

function PartyComponent:move(direction)
	oldPartyComponentMove(self, direction)
	monsterTurnBegin()
end

function PartyComponent:turn(direction)
	oldPartyComponentTurn(self, direction)
	monsterTurnBegin()
end

function Champion:attack(slot, powerAttack)
	oldChampionAttack(self, slot, powerAttack)
	monsterTurnBegin()
end

function Champion:castSpell(gesture)
	oldChampionCastSpell(self, gesture)
	monsterTurnBegin()
end

----------------------------------

-- init

function GameMode:newGame()
	oldNewGame(self)
	party.go:setPosition(6,30,0)
	log("Welcome to Barely Working Turn-Based Grimrock!", 10)
end
To fuel the imagination here's some examples that should be possible to do with umods and that might be fun scripting challenges:
- Replace fighting the monsters using the attack panel with a different system. Oldschool JRPG combat? A card game?
- Change the perspective. Turn Grimrock into an isometric or top-down game? Or maybe a freely moving FPS-style player could work even if the rest of the game is still on grid?
- Characters permadie but any time you touch a crystal a new random character is added to the party. Be prepared to locate many hardcoded number 4s from the source code and to rework a lot of the UI to support larger parties!
- Everything procedural should be easier with umods. Randomizers, procedural level generation.
- An altogether different game. umods turn Grimrock into basically a 3D/2D game engine. Almost everything that makes Grimrock what it is is in the Lua source files and other assets. That being said it's definitely not the smartest way to go about making a game from scratch but who cares about doing things the smart way! :lol:

I'm keen to hear what kinds of ideas pop into YOUR heads with a system like this or what kinds of limitations have caused you frustration with the Dungeon Editor?
Steven Seagal of gaming industry

Zo Kath Ra
Posts: 863
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Merry Christmas!

Post by Zo Kath Ra » Sat Dec 26, 2020 12:15 pm

antti wrote:
Sat Dec 26, 2020 11:42 am
I'm keen to hear what kinds of ideas pop into YOUR heads with a system like this or what kinds of limitations have caused you frustration with the Dungeon Editor?
I've wanted to make items that store energy (or health).

When you equip the item, it increases the champion's max energy.
When you un-equip the item, it stores the surplus energy that would otherwise be lost.
When equip it again, the stored energy flows into the champion.

I think there's a way to do this in 2.2.4, but it's very hacky.

edit:
Are map sizes other than 32x32 possible?
You can make them in 2.2.4 with a bit of editing, but the automap doesn't show the entire level, and maybe there are other things that don't work.

What about maps that wrap?

edit 2:
SteamContext.lua => Can modders break the 100 MB limit for mod sizes on Steam now?

Post Reply