OpenJK
OpenJK copied to clipboard
More friendliness to animation mods
Personally, I find JA very unfriendly to animation mods. For example most animation mods are incompatible without making a new mod that combines them. Then there are other things, like the fact you must always start a new game for animations to take effect...
I have a list of proposals, that I think would make OpenJK way more friendly to animation modding:
- Allow multiple .gla files to exist. And allow specification of which .gla to load frames from for an animation slot in the animation config.
Current style: BOTH_A7_KICK_S 1008 34 -1 20 My proposal: BOTH_A7_KICK_S 1008 34 -1 20 spinkick
This would load BOTH_A1_BL_TR from spinkick.gla in the _humanoid folder. Otherwise it would default to _humanoid.gla
- Allow multiple config files to exist. Sort of like with pk3s, the last loaded config file will take priority for controlling the properties of any animation slot it defines.
An example _humanoid folder: animation.cfg (in animation.cfg: BOTH_A7_KICK_S 1008 34 -1 20) spinkick.cfg (in spinkick.cfg: BOTH_A7_KICK_S 0 27 -1 45)
The properties of the definition of BOTH_A7_KICK_S in spinkick.cfg would take priority over the one in animation.cfg in this scenario.
- Separate config and animevents files for SP and MP. More compartmentalization this way. Any files with a _sp suffix in their name (i.e. spinkick_sp.cfg, animevents_sp.cfg, animation_sp.cfg) would take priority in being loaded by Single Player, and would be ignored by multiplayer. That way old mods still work, but you can make mods that are specific to one side of the game.
- Other things that could use addressing. You shouldn't have to start a new game to get an animation mod to work. The bug where looping animations played in reverse tending to get stuck could use fixing. Also, it would be nice if you could specify in the animation.cfg whether an animation should be played only on the upper body or lower body (but maybe that's asking too much).
I understand most or all of these would break save game compatibility. This new animation system could just be ifdef'd in that case. But even then, animation mods by nature break save game compatibility, and people can just use cheats to remake their savegames. If I am completely honest, I don't see why that's such a big deal.
Link to forum topic: https://jkhub.org/topic/7909-more-friendliness-to-animation-mods/
If you ever played on a regular jka 1.00 linux server, you can do every animation lol fun times
Added forum post contents to the OP and left the link to forum post. :ok_hand:
However this is going to be immensely complex to do what you are asking. Especially for MP! :finnadie:
gg
Oh that's too bad. What in particular makes it so complex?
Also Alex, what doth thou speak of?
There are a lot of assumptions across modcode, engine and renderer regarding animations. You're essentially asking for a major rewrite, it won't be easy to implement any of these requests.
what if there was a way at "run-time" to use something like ASK's GLA Merge Tool to merge /append multiple separate GLA files to the _humanoid.gla file and anim config & events file so that at run-time you are only dealing with a single _humanoid.gla file set???
How exactly would that work? The files would need to be pk3s and you can't alter them from within pk3. Runtime there is only 1 file anyway because duplicate copies of the same filename are not read-in. Only the most current copy in the order of searchpath loading.
well... I was thinking each animation GLA, etc. could be merged into one large _humanoid.gla by the engine after it read them all from the PK3s. Like if it found _humanoid_1.gla, _humanoid_2.gla... the engine could simply append them to the base _humanoid.gla. the appendable gla file and their config files would would have to be numbered sequentially so as to start at the next available frame #...
I don't think that could work like you'd want unfortunately.
So the assumptions made everywhere are the problem, rather than the actual loading of the animations themselves?
That's too bad. I was hoping the animation loading was more modular. I think Archangel is onto something though... the current animation system might not have to be changed if code-side a virtual/in-the-code animation.cfg and _humanoid.gla were constructed beforehand, and these "files" were then used during the lifetime of the game session.
Or am I just spouting nonsense? (Entirely possible)
I don't know how you'd get it to load that in-place when the animation.cfg is loaded by the cgame and game code itself! Also the glm files specifically target _humanoid.gla in their file header structure.
when the code goes to look for and load the _humanoid.gla, animation.cfg, and animevents.cfg ...why couldn't that call be sent to a method that would build/merge said files and then return them or pass them by reference and then append/merge them and the unified files are then used for that session as dusty said?
How would you merge it? The animation.cfg and animevents are loaded by the mod code.
the animation.cfg and animevent files are text files I'm sure there is a standard method for appending their lists to the base files.
for the GLA files they would have to be merged sequentially using something like ASK's GLAMerge tool... recoded to append _humanoid_1.gla, etc to the base humanoid file.
There isn't a method for appending files without altering mods to append to the buffers that are stored there in the first place. Memory isn't freely exposed to just append across boundaries and certainly not without the memory address.
Well, I'm pretty sure mod code uses syscalls to read files, so those could be modified with special cases, but that's a pretty ugly hack I don't condone.
Right, I don't condone it either.
then why don't you guys come up with a way that you think will work.
Because we have more pressing issues.
@mrwonko, @Ensiform - I did not mean you had to brainstorm something today... but the game engine needs to be more friendly to animation modding. There needs to be a way for animators to create additional/new animations in separate GLA files without hacking the _humanoid.GLA as done in the past.
I don't think this could be done (easily) in a way that is binary and content compatible with basejka. It's a good idea, but not feasible IMO.
so you cannot think of a coding implementation that would take a PK3 with contents:
_humanoid_1.gla animations_1.cfg animevents_1.cfg
...and have those files merged/appended with the base _humanoid.gla, etc (when the game is launched)?
You say needs but this is still at 13 year old game remember, not trying to turn it into a jk4 lol.
The majority of the animation code is in the cgame and game modules. We could do it, but it won't be usable in any client or server who aren't using the OpenJK mod + binaries. You'd also break compatibility with every mod. As you know that's something we don't want to do.
Technically it's possible to do it all from the engine but in practice this would make it a worse situation for coders. The code base is already bad enough as it is. We don't want to make it any worse.
On a tangentially related note, having the convention of appending _1
invites name clashes, I'd prefer _humanoid.gla/myextension.gla
.
That clashes with folders.
When you say break compatibility with every mod, what does that mean exactly? That sounds quite catastrophic.
Every code mod like JA+ would be not compatible.
Ok. I see what you mean.
What if this sort of system was created only for Single Player? That's where it would make the most sense anyway. In MP you kind of expect everyone on the server to have the same animations most of the time. Heck in SP you can even do model-specific animations.
Also I just wanted to mention, even if drastic changes weren't feasible, even small improvements are welcome considering the animation system just isn't mod-friendly period. (small improvements being SP getting it's own files, not having to make a new save file, fixing bugs etc.)
Yes, for Single Player!