JACoders / OpenJK

Community effort to maintain and improve Jedi Academy (SP & MP) + Jedi Outcast (SP only) released by Raven Software
GNU General Public License v2.0
2.03k stars 615 forks source link

More friendliness to animation mods #845

Open dusty22 opened 8 years ago

dusty22 commented 8 years ago

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:

  1. 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

  1. 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.

  1. 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, animationsp.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.
  2. 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/

AlexCS1337 commented 8 years ago

If you ever played on a regular jka 1.00 linux server, you can do every animation lol fun times

ensiform commented 8 years ago

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:

AlexCS1337 commented 8 years ago

gg

dusty22 commented 8 years ago

Oh that's too bad. What in particular makes it so complex?

Also Alex, what doth thou speak of?

Razish commented 8 years ago

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.

Archangel35757 commented 8 years ago

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???

ensiform commented 8 years ago

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.

Archangel35757 commented 8 years ago

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 #...

ensiform commented 8 years ago

I don't think that could work like you'd want unfortunately.

dusty22 commented 8 years ago

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)

ensiform commented 8 years ago

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.

Archangel35757 commented 8 years ago

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?

ensiform commented 8 years ago

How would you merge it? The animation.cfg and animevents are loaded by the mod code.

Archangel35757 commented 8 years ago

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.

ensiform commented 8 years ago

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.

mrwonko commented 8 years ago

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.

ensiform commented 8 years ago

Right, I don't condone it either.

Archangel35757 commented 8 years ago

then why don't you guys come up with a way that you think will work.

mrwonko commented 8 years ago

Because we have more pressing issues.

Archangel35757 commented 8 years ago

@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.

Razish commented 8 years ago

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.

Archangel35757 commented 8 years ago

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)?

ensiform commented 8 years ago

You say needs but this is still at 13 year old game remember, not trying to turn it into a jk4 lol.

xycaleth commented 8 years ago

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.

mrwonko commented 8 years ago

On a tangentially related note, having the convention of appending _1 invites name clashes, I'd prefer _humanoid.gla/myextension.gla.

ensiform commented 8 years ago

That clashes with folders.

dusty22 commented 8 years ago

When you say break compatibility with every mod, what does that mean exactly? That sounds quite catastrophic.

ensiform commented 8 years ago

Every code mod like JA+ would be not compatible.

dusty22 commented 8 years ago

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.)

Archangel35757 commented 8 years ago

Yes, for Single Player!

ensiform commented 8 years ago

Well considering SP gets very little focus plus is buggy and OpenJK as it is, don't get your hopes up that this will be a higher priority than other issues to be worked on right now.

dusty22 commented 8 years ago

A new animation system would be sweet, even if it was just for SP... what small changes would be good though?

SP things I would personally like:

  1. Not having to start a new game for animation mods
  2. Fixing the bug that causes loop animations played in reverse to get stuck (this might only happen in SP anyway)
  3. Model-specific animations without requiring a separate .gla file (it's lame to copy the whole gla if you only want to change their animevents or animation.cfg)
  4. Option to have separate global animation files for SP. If you make a mod that changes moves or animation properties for SP you don't necessarily want it to affect MP. (Even though the MP effects are only client-side)

Any of those sound remotely reasonable? Anybody have any thoughts or other suggestions?

dusty22 commented 8 years ago

Is it feasible for any of those changes to be made?

@Archangel35757 : Anything to add?

@ensiform @Razish @mrwonko @xycaleth

Archangel35757 commented 8 years ago

...just the ability to either append new animations to the GLA (and update config) or leave base _humanoid.gla alone and put additional custom animations in a separate GLA/cfg and the game loads up all anims for that character.