Page 181 of 396
Re: Ask a simple question, get a simple answer
Posted: Sat Jan 21, 2017 9:57 pm
by minmay
You'll want a custom brain. If the door is controlled by a ButtonComponent or LeverComponent, then you can just use MonsterOperateDeviceComponent and BrainComponent:operate() to operate the button or lever. MonsterOperateDeviceComponent can't operate a PullChainComponent but you can fake it by manually playing the pullchain's sound and animation and toggling the door.
Re: Ask a simple question, get a simple answer
Posted: Sat Jan 21, 2017 10:05 pm
by CrEaToXx
When trying to make new icon portraits for races inside skills.dds, the next index to follow would be 111. I've correctly placed the modded base game skill.dds into...
myMod/mod_assets/textures/gui
...but the icon for new race is not showen in game. To exclude error from wrong import, does the editor automatically export the modded skill.dds to be used by the game?
I'm afraid I did something wrong while editing the .dds with Gimp, but wanted to exclude any other possible source of error.
Edit: the .dds is uncompressed and saved with mipmap creation, resulting in the same file size as the original. So it can't be wrong compression. Btw. what is the correct compression for .dds files?
Edit2: Got it working...had to import this line into my race trait definition...
Code: Select all
iconAtlas = "mod_assets/textures/gui/skills.tga",
Re: Ask a simple question, get a simple answer
Posted: Mon Jan 23, 2017 3:30 am
by zimberzimber
What kind of impact would deleting all minimalSaveState objects (that will not break anything in the process (i.e platforms)) upon leaving a level, and spawning all minimalSaveState objects on the level I'm currently entering.
For example -
Leaving a level that has 10 stone object and 3 doors. The stone objects are deleted.
Entering a level that should have 1 fountain, a pillar, and a healing crystal. The fountain and the pillar spawn.
Will this affect performance in a positive way, and to what extent?
Same question about disabling monster brains between levels.
Re: Ask a simple question, get a simple answer
Posted: Mon Jan 23, 2017 3:54 am
by minmay
zimberzimber wrote:What kind of impact would deleting all minimalSaveState objects (that will not break anything in the process (i.e platforms)) upon leaving a level, and spawning all minimalSaveState objects on the level I'm currently entering.
...Could you be more specific about what the impact you're
hoping for is? Are you trying to improve serialization performance, reduce memory usage, or something else?
Disabling monster brains between levels won't do anything significant except stop them from wandering around.
Re: Ask a simple question, get a simple answer
Posted: Mon Jan 23, 2017 3:59 am
by zimberzimber
Reduce memory usage.
But what other things may be affected by this and how?
Re: Ask a simple question, get a simple answer
Posted: Mon Jan 23, 2017 5:09 am
by akroma222
CrEaToXx wrote:When trying to make new icon portraits for races inside skills.dds, the next index to follow would be 111. I've correctly placed the modded base game skill.dds into...
myMod/mod_assets/textures/gui
...but the icon for new race is not showen in game. To exclude error from wrong import, does the editor automatically export the modded skill.dds to be used by the game?
I'm afraid I did something wrong while editing the .dds with Gimp, but wanted to exclude any other possible source of error.
Edit: the .dds is uncompressed and saved with mipmap creation, resulting in the same file size as the original. So it can't be wrong compression. Btw. what is the correct compression for .dds files?
Edit2: Got it working...had to import this line into my race trait definition...
Code: Select all
iconAtlas = "mod_assets/textures/gui/skills.tga",
Hey CrEaToXx,
seems you're in the midst adding Races/Classes... hopefully a couple of examples will help
Race: Gnome
Code: Select all
---------------------------------------------------------------------------------GNOME
defineRace{
name = "gnome",
uiName = "Gnome",
inventoryBackground = "assets/textures/gui/inventory_backgrounds/ratling.tga",
skills = {alchemy = 1, earth_magic = 1} --preset starting levels for skills
--you can not preset traits for Races here(as you can with Classes)
}
defineTrait{
name = "gnome",
uiName = "Gnome",
iconAtlas = "mod_assets/textures/legacy_custom_icons1.tga",
icon = 32,
description = "Gnomes prefer the comfort of study or quiet speculation over action and adventure. Luckily their prowess in the former more than prepares them for the unfortunate inconvenience of the latter. Gnomes are exceedingly clever with most sophisticated pursuits, but usually they favour Studying, Growing and Sorcery.\n<>-------------------------------------------------------------<> Base\nStrength -2, Willpower +4\nElemental Resistances +5\nGrow Herbs & Food in Fertile areas\nAwarded Bonuses for studying Scrolls & Tomes\n<>---------------------------------------------------------<> Optional\n[1] Arcane Adept [2] Apothecary [3] Earthbound",
onRecomputeStats = function(champion, level)
if level > 0 then
champion:addStatModifier("resist_fire", 5)
champion:addStatModifier("resist_cold", 5)
champion:addStatModifier("resist_poison", 5)
champion:addStatModifier("resist_shock", 5)
champion:addStatModifier("strength", -2)
champion:addStatModifier("willpower", 4)
end
end,
}
Class: Battle Mage
Code: Select all
------------------------------------------------------BATTLEMAGE
defineCharClass{
name = "battle_mage",
uiName = "Battle Mage",
optionalTraits = 2, --preset # of trait picks
skillPoints = 1, --preset starting # of skills points
traits = { "correct_resistance", "hand_caster", "armor_expert"}, --preset starting class traits (including hidden traits)
skills = {staves_runewands = 1} --preset starting levels for skills
}
defineTrait{
name = "battle_mage",
uiName = "Battle Mage",
iconAtlas = "mod_assets/textures/gui/legacy_custom_icons1.tga",
icon = 14,
description = "The Battle Mages of Old Amadacia are quite comfortable wielding front line Stave Weapons, as well as blasting with powerful Spells from afar. There are few Battle Mages left worthy of the Title, but one day they hope to gather whats left of their Order and restore the School of Wizardry's former prestige and magnificence.",
gameEffect = [[
<>-------------------------------------------------------------<> Base
Health 40, Energy 60
Staff & Wand Skill +1
<>----------------------------------------------------------<> Levelup
Health +4, Energy +6
Elemental Resistances +1
<>----------------------------------------------------------<> Special
Specialisation: Staves
Stave Special Attack Energy Costs -25%
Stave Special Attack Buildup Times -50%
Equipped Stave Willpower bonus +50%
Equipped Armour Weight -50%
Leadership: Staff Defense extends to Party
<>-----------------------------------------------------------<> Magic
Spellbooks: Mage & Enchanter
You can Cast Spells without RuneItems]],
onRecomputeStats = function(champion, level)
if level > 0 then
local lvl = champion:getLevel()
champion:addStatModifier("resist_fire", lvl)
champion:addStatModifier("resist_shock", lvl)
champion:addStatModifier("resist_cold", lvl)
champion:addStatModifier("resist_poison", lvl)
champion:addStatModifier("max_health", 40 + (lvl-1) * 4)
champion:addStatModifier("max_energy", 60 + (lvl-1) * 6)
---------------------------------------------------------stave WIL +50%
if champion:getLevel() > 1 then
for slot = 1,2 do
local item = champion:getItem(slot)
if item and item:hasTrait("stave") and item.go.equipmentitem and item.go.equipmentitem:getWillpower() then
local w = item.go.equipmentitem:getWillpower()
champion:addStatModifier("willpower", math.floor(w / 2))
end
end
end
end
end,
}
Also, regarding icons atlases ... are you just taking the asset pack skills icon atlas and cut/pasting your own icons into it?
I can certainly be done like that (glad you sorted that iconAtlas = "mod_assets/textures/gui/legacy_custom_icons1.tga" line)
If you want to know more on compression for the .dds - this thread will help
viewtopic.php?f=22&t=9627&p=107242&hilit=gfx#p107242
Further, if you require the gfxIndex sheets to open over a "blank slate" icon atlas, download all 3 sizes here:
(1024x1024 items, 750x900 traits, 256x256 conditions)
http://imgur.com/a/Is4EL
Good luck & have fun
Akroma
Re: Ask a simple question, get a simple answer
Posted: Mon Jan 23, 2017 5:35 am
by minmay
zimberzimber wrote:Reduce memory usage.
Then you will receive no significant benefit. Neither system memory nor video memory usage would be noticeably affected by doing this.
zimberzimber wrote:But what other things may be affected by this and how?
Your mod would be harder to maintain. Nothing else would be significantly affected.
Re: Ask a simple question, get a simple answer
Posted: Mon Jan 23, 2017 6:00 am
by akroma222
minmay wrote:zimberzimber wrote:Reduce memory usage.
Then you will receive no significant benefit. Neither system memory nor video memory usage would be noticeably affected by doing this.
zimberzimber wrote:But what other things may be affected by this and how?
Your mod would be harder to maintain. Nothing else would be significantly affected.
Hey minmay,
I can't exactly remember where I had read/heard this - but Ive been under the impression for a while now - that too many Levels with too many game objects (items in particular)
is something we needed to avoid (sorry to be so vague here) >> performance issues etc
As such I had planned my mod to consist of 5 large areas (chapters, whatevs) - each area containing 5 - 10 joining Levels.
Upon progressing from 1 area to another, I was going to completely (but, carefully) destroy everything I could in every level of the completed area.
I was also planning on relying heavily on scripts to spawn and place as many monsters, items etc as I could.
...but from what you have just said -sounds like the above^^ approach isn't really necessary??
(or am I missing some further details here..?)
Re: Ask a simple question, get a simple answer
Posted: Mon Jan 23, 2017 6:56 am
by minmay
The only situation where you need to worry about GameObject and Component count is serialization performance. When a minimalSaveState object is serialized, only its name, id, x, y, facing, elevation, and level are saved. To do what zimberzimber is suggesting, then for each object you destroy, in order to recreate it later, you need to store...its name, id, x, y, facing, elevation, and level.
You could bake the information for all the destroyed objects into one monstrous string and compress it (which you'd have to implement from scratch) and then sure you'd get a very very slight gain in serialization performance...but shaving a couple milliseconds off the time it takes to save the game is not worth that amount of complexity, in my opinion.
Since saved games get compressed, you have the usual zlib memory balloon, and the size of that will depend on how big the uncompressed save file is, i.e. how much information was serialized, and yes, this is a common place for people to get out of memory errors. But there's no way the sort of micro-optimizations you're talking about are going to help significantly with this. A single 1024x1024 DXT1 texture, for example, occupies about 700 kB in memory. It takes hundreds to thousands of serialized Components, or tens of thousands of minimalSaveState objects, to add that much to the saving memory balloon.
The only way this could be an issue is if you're doing something really strange (e.g. placing 10,000 herbs), or outright bungled something (e.g. failing to use minimalSaveState appropriately, accidentally placing 10,000 barrels when you meant to place 1). I made a quick tool for finding those problems, too; look at dungeonReport() in the ORRR3 source in mod_assets/ext/diagnostics/diagnostics_script.lua.
Re: Ask a simple question, get a simple answer
Posted: Mon Jan 23, 2017 8:58 am
by akroma222
Hehe! Ask a terribly vague question, get an excellently detailed answer!
Thankyou v much minmay- I understand now, ...and glad I asked now too.
(Im about to start building levels... finally)
I will chase up your dungeonReport() function v soon
(as the only 0RRR3 files I seem to have access to are from 2015)