Page 2 of 5

Re: Merry Christmas!

Posted: Fri Dec 25, 2020 12:37 am
by JohnWordsworth
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!

Re: Merry Christmas!

Posted: Fri Dec 25, 2020 12:42 am
by minmay
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...

Re: Merry Christmas!

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

Re: Merry Christmas!

Posted: Fri Dec 25, 2020 9:57 am
by petri
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.

Re: Merry Christmas!

Posted: Fri Dec 25, 2020 3:56 pm
by ratman
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

Re: Merry Christmas!

Posted: Sat Dec 26, 2020 12:15 am
by JohnWordsworth
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!

Re: Merry Christmas!

Posted: Sat Dec 26, 2020 8:21 am
by petri
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/

Re: Merry Christmas!

Posted: Sat Dec 26, 2020 10:35 am
by Kirill
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.

Re: Merry Christmas!

Posted: Sat Dec 26, 2020 11:42 am
by antti
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?

Re: Merry Christmas!

Posted: Sat Dec 26, 2020 12:15 pm
by Zo Kath Ra
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?