Page 71 of 74
Re: [DONE] Grimrock Model Tookit
Posted: Fri Apr 30, 2021 8:32 pm
by Zo Kath Ra
wagtunes wrote: ↑Fri Apr 30, 2021 6:51 pm
So my question is this. Is the items.dds file part of the base game and located somewhere else? I did a complete hard drive search and the only place this file shows up is in the asset pack which I do not have in the path of my dungeon anyway.
The files in the asset pack (plus a few that aren't) are part of the base game, and contained in grimrock.dat
An item
* must have a gfxIndex
* can optionally have a gfxAtlas
If an item has no gfxAtlas, then the default gfxAtlas is used.
The default gfxAtlas consists of these files, chained together:
* assets/textures/gui/items.dds
* assets/textures/gui/items2.dds
The indices in a gfxAtlas are calculated automatically.
Index 0 is the leftmost icon in the top row.
Index 1 is the icon directly to the right of icon 0.
When you reach the rightmost icon in a row, increasing the index by 1 goes to the leftmost icon in the next row.
The item icons are 75x75 pixels each, but the width and height of a DDS file must both be a power of 2.
(not necessarily the same power of 2, AFAIK)
That's why items.dds is 1024x1024, even though only 975x975 are actually used.
If an item has a gfxAtlas:
See Isaac's explanation.
http://www.grimrock.net/modding_log1/cr ... om-assets/
has a section on "Using Custom Graphics"
Re: [DONE] Grimrock Model Tookit
Posted: Fri Apr 30, 2021 9:52 pm
by Isaac
A file location inside the asset pack is typically the same as the location in grimrock.dat; so you can use the path from the asset pack, and at runtime, your scripts will see it in grimrock.dat.
Re: [DONE] Grimrock Model Tookit
Posted: Fri Apr 30, 2021 9:54 pm
by wagtunes
minmay wrote: ↑Fri Apr 30, 2021 8:25 pm
This particular question is covered in the
official modding guide in the
Asset Definition Reference page:
gfxIndex: index of the item graphics in texture atlas.
gfxAtlas: filename of the texture atlas containing the item icon. The filename must be a valid asset reference ending with “.tga”.
Here is another concrete example:
Code: Select all
defineObject{
name = "armour_scale_greaves",
class = "Item",
uiName = "Scale Greaves",
model = "assets/models/items/leather_greaves.fbx",
slot = "Legs",
armorSkill = "light_armor",
armorSet = "steel_light",
gfxAtlas = "mod_assets/textures/items.tga",
gfxIndex = 20,
protection = 6,
weight = 2.0,
}
wagtunes wrote: ↑Fri Apr 30, 2021 6:51 pmSo my question is this. Is the items.dds file part of the base game and located somewhere else? I did a complete hard drive search and the only place this file shows up is in the asset pack which I do not have in the path of my dungeon anyway.
Everything in the asset pack is part of the base game.
You might also find it helpful to look at the source code for some existing dungeons that have released source code, like
The Mine of Malan Vael or
The Sunset Gate
Thanks. Much appreciated. I actually have the source files for the following dungeons.
Master Quest (the remake)
One Room Round Robin 2
ORR2 is quite complex. My head spins just looking at it. But I think if I slog my way through it I can learn an awful lot. The learning curve for coding this game is off the charts. If the game was this hard to play (thank God it's not) I would have given up after a week.
Re: [DONE] Grimrock Model Tookit
Posted: Fri Apr 30, 2021 10:02 pm
by wagtunes
Zo Kath Ra wrote: ↑Fri Apr 30, 2021 8:32 pm
wagtunes wrote: ↑Fri Apr 30, 2021 6:51 pm
So my question is this. Is the items.dds file part of the base game and located somewhere else? I did a complete hard drive search and the only place this file shows up is in the asset pack which I do not have in the path of my dungeon anyway.
The files in the asset pack (plus a few that aren't) are part of the base game, and contained in grimrock.dat
An item
* must have a gfxIndex
* can optionally have a gfxAtlas
If an item has no gfxAtlas, then the default gfxAtlas is used.
The default gfxAtlas consists of these files, chained together:
* assets/textures/gui/items.dds
* assets/textures/gui/items2.dds
The indices in a gfxAtlas are calculated automatically.
Index 0 is the leftmost icon in the top row.
Index 1 is the icon directly to the right of icon 0.
When you reach the rightmost icon in a row, increasing the index by 1 goes to the leftmost icon in the next row.
The item icons are 75x75 pixels each, but the width and height of a DDS file must both be a power of 2.
(not necessarily the same power of 2, AFAIK)
That's why items.dds is 1024x1024, even though only 975x975 are actually used.
If an item has a gfxAtlas:
See Isaac's explanation.
http://www.grimrock.net/modding_log1/cr ... om-assets/
has a section on "Using Custom Graphics"
Okay, here's my question. This is what I'm confused about.
I know that index 0 from the base game is Sword of Nex. If I create a custom atlas with just one icon, which would be index 0 and designate that atlas in the script file on load, you're saying that the game will load my custom icon instead of the Sword Of Nex. Correct?
Next question. In loading the items.dds file, I see that the items themselves are one after another, row by row. But there doesn't seem to be any actual separator between icons. So how does the software know where one icon ends and the next icon begins? How exactly was items.dds constructed so that each icon is in fact separate? Somehow I( think if I open up a 1024x1024 blank file in Photoshop and place images, one after another in a row, that the software is going to recognize each one as a separate icon. There has to be something we have to program so that the software knows where each icon is. Yes, no?
What am I missing?
Re: [DONE] Grimrock Model Tookit
Posted: Fri Apr 30, 2021 10:06 pm
by Isaac
wagtunes wrote: ↑Fri Apr 30, 2021 9:54 pmORR2 is quite complex. My head spins just looking at it. But I think if I slog my way through it I can learn an awful lot. The learning curve for coding this game is off the charts. If the game was this hard to play (thank God it's not) I would have given up after a week.
Not just the scripts, examine some of the models too.
*Buttons were the only way to add complex animations to [non-monster] objects in LoG1. LoG2 changes the way scripts need to be written, but it improves over LoG1's scripting by a great deal, and makes trivial some of the tasks that we had to jump through hoops to manage in LoG1.
wagtunes wrote: ↑Fri Apr 30, 2021 10:02 pmIf I create a custom atlas with just one icon, which would be index 0 and designate that atlas in the script file on load, you're saying that the game will load my custom icon instead of the Sword Of Nex. Correct?
Yes; it will use icon #0 of the custom atlas.
Next question. In loading the items.dds file, I see that the items themselves are one after another, row by row. But there doesn't seem to be any actual separator between icons. So how does the software know where one icon ends and the next icon begins?
75 pixels per square icon.
How exactly was items.dds constructed so that each icon is in fact separate? Somehow I( think if I open up a 1024x1024 blank file in Photoshop and place images, one after another in a row, that the software is going to recognize each one as a separate icon. There has to be something we have to program so that the software knows where each icon is. Yes, no?
Careful manual layout is needed to build an atlas from scratch by hand. You might be able to use Photoshop's built in Contact Sheet script to align a folder of icons into an atlas, but The Grimrock Atlas Toolkit handles the layout perfect, and automatically.
Re: [DONE] Grimrock Model Tookit
Posted: Fri Apr 30, 2021 11:17 pm
by wagtunes
Isaac wrote: ↑Fri Apr 30, 2021 10:06 pm
wagtunes wrote: ↑Fri Apr 30, 2021 9:54 pmORR2 is quite complex. My head spins just looking at it. But I think if I slog my way through it I can learn an awful lot. The learning curve for coding this game is off the charts. If the game was this hard to play (thank God it's not) I would have given up after a week.
Not just the scripts, examine some of the models too.
*Buttons were the only to add complex animations to [non-monster] objects in LoG1. LoG2 changes the way scripts need to be written, but it improves over LoG1 scripting by a great deal, and makes trivial some of the tasks that we had to jump through hoops to manage in LoG1.
wagtunes wrote: ↑Fri Apr 30, 2021 10:02 pmIf I create a custom atlas with just one icon, which would be index 0 and designate that atlas in the script file on load, you're saying that the game will load my custom icon instead of the Sword Of Nex. Correct?
Yes; it will use icon #0 of the custom atlas.
Next question. In loading the items.dds file, I see that the items themselves are one after another, row by row. But there doesn't seem to be any actual separator between icons. So how does the software know where one icon ends and the next icon begins?
75 pixels per square icon.
How exactly was items.dds constructed so that each icon is in fact separate? Somehow I( think if I open up a 1024x1024 blank file in Photoshop and place images, one after another in a row, that the software is going to recognize each one as a separate icon. There has to be something we have to program so that the software knows where each icon is. Yes, no?
Careful manual layout is needed to build an atlas from scratch by hand. You might be able to use Photoshop's built in Contact Sheet script to align a folder of icons into an atlas, but The Grimrock Atlas Toolkit handles the layout perfect, and automatically.
Ah, okay, So it really is a matter of placing 75x75 graphics one after another and the software does the job of delineating everything. But yeah, some kind of template that helps align things would make it a lot easier.
Okay, I think I can take it from here. I certainly have a lot of material to go through.
Thank you again for everything. I really appreciate it.
Re: [DONE] Grimrock Model Tookit
Posted: Fri Apr 30, 2021 11:21 pm
by Isaac
Tip In Photoshop, before the Atlas toolkit, I would place colored [single] pixels at the corners of the 75x75 pixel icons. This makes it easier to align the icons, and won't show in the game if the icon alpha channel is black at the corners.
Re: [DONE] Grimrock Model Tookit
Posted: Sat May 01, 2021 2:20 am
by wagtunes
Okay, here is where I am. I thought I had this but now I'm totally confused.
I found an image of runes laid out in icon format. I brought it into photoshop, made sure everything lined up with the items.dds and saved as a PNG file. I then imported the PNG file into Graphics Atlas, which assigned each rune an index perfectly, and then exported as a DDS file.
I then went into my script and defined my runes.dds file as my atlas file, making sure I made the file type tga.
When I start up the dungeon, I get this error message.
[String "item.lua"]:0: Unknown uncompressed DDS pixel format in file mod_assets/textures/items/runes.dds
Why?
When I bring items.dds into photoshop, every icon is crystal clear. When I bring runes.dds into photoshop, it's almost just a black photo. You can't make out anything.
So the atlas program didn't create the DDS file properly. What I don't understand is why? What could have possibly been wrong with the file I imported? Everything looked good in the atlas program and every icon was given an index.
Help.
Re: [DONE] Grimrock Model Tookit
Posted: Sat May 01, 2021 3:33 am
by Isaac
There are various DDS compression modes, and uncompressed modes.
The one used for GUI icons is D3DFMT_A8R8G8B8 ; or... A8R8G8B8
Link:
http://www.grimrock.net/modding_log1/cr ... 20Graphics
(This link might scroll to the intended paragraph, but if not... scroll down to the section on "Using Custom Graphics".)
Try changing the compression mode to A8R8G8B8 when exporting.
Also: There is this thread from a while back:
http://www.grimrock.net/forum/viewtopic ... ion#p96967
Re: [DONE] Grimrock Model Tookit
Posted: Sat May 01, 2021 3:59 am
by wagtunes
I went into Photshop and tried every format that was even close to what you have above. The closest I come to making this work (and this is really weird) is the rune icon texture wraps around the sword of nex. So you see a yellow colored sword.
I am out of ideas.