Saml1er

[Testing] Custom IFP Animations in MTA:SA 1.5.x

Recommended Posts

Posted (edited)

Hello!

I've been working with MTA team on implementing the ability to play custom IFP animations in MTA since a couple of months. Today, I want to notify you all that it's done after a lot work, this means you can create your own IFP animations in 3ds Max using Kam's script, play them in MTA:SA (not released yet) using Lua scripting functions. I've created my pull request on github which you can find here.

Everything's pretty much done, but there's one problem, the pull request cannot be merged into the master branch because there's a lot of code to go through, this will make fixing bugs very difficult, so we'll need to test everything in every way possible before releasing. MTA used to have a lot of developers back in the days who designed the core of the software that we have today, I appreciate their work, and I'm forever grateful for their contribution. There are still a few developers from the MTA team and other old contributors who spends hours upon hours on making MTA better, and get literally nothing out of MTA for their work, but they still do it :-). My point is, MTA has potential, and together, we can make it better, not having enough time to test everything out is on the main reason why we still don't have this feature implemented into MTA's main branch, so I'm here to ask the community for help in testing this feature.

There are so many gamemodes that can take advantage of this feature. We still have plenty of RP servers here, and they still keep increasing till this day. RP servers have almost everything they need, server developers keep trying their best to push the limits in order to have more realism, I honestly believe this will fix that problem, or at least improve it.

Here are two video:

Spoiler

This one is by @CrosRoad5, who is testing parkour.ifp from: https://bugs.mtasa.com/view.php?id=4571

A video from me where I test GTA VC animations in MTA:

 

 

 

What is IFP?

IFP is the animation file format for GTA III, SA, and VC. Adding support for this file format will allow us to play any custom animation which are made for GTA:SA and GTA:VC. You can load as many IFP files you wish to, you can have hundreds of thousands of animations.

Note: GTA III animations are not supported for now.

How you can help:

As much as everyone wants to have custom animations in MTA, I would love to see them as well. You can help by testing different IFP files, and report bugs on this thread.

  1. Download the new MTA:SA from here: https://ci.appveyor.com/api/buildjobs/67st54i25p8ge8is/artifacts/InstallFiles.zip
  2. Right-click on InstallFiles.zip, extract the files to some location on your computer, I usually extract them to my desktop.
  3. Download the resources from here: https://drive.google.com/file/d/1TIK0-M3CNFR_1Yjn6pjImrS7184SS8jS/view?usp=sharing
  4. Create a folder with name "resources" in InstallFiles\server\mods\deathmatch, and extract resources.zip to InstallFiles\server\mods\deathmatch\resources.
  5. Start your MTA:SA server from location: InstallFiles\server\MTA Server.exe, and then start the ifp test resource from console "start ifptest"
  6. Now launch MTA from InstallFiles\Multi Theft Auto.exe, join your server.
  7. Use keys 1, 2, 3, 4, or 5 to play the custom parkour animation from parkour.ifp in ifptest.

How to report bugs?

When you are playing custom animations, if something's not working the way it should be, or if MTA crashes then please fill this form and reply to this thread:

IFP download link: (put the download link here for IFP, so I can download and test it myself)
Description: (Explain what the bug is)
Steps To Reproduce: (write the steps on how I can reproduce the bug myself)

Example:

IFP download link: https://www.website.com/gta4.ifp
Description: When I play this animation named "CartWheel," I can't move for a while, and MTA crashes.
Steps To Reproduce: 
1. Load "gta4.ifp".
2. play animation named "CartWheel" using setPedAnimation.
3. MTA crashes.

If you want to submit the bug report by PM on forum then feel free to do so.

I've added the resource "ifptest" to show you how to play custom animations. You can check how I did it by checking InstallFiles\server\mods\deathmatch\resources\ifptest\client.lua.

About the new Lua functions, quoting myself:

"There are three new Lua functions added:

// loads IFP with a custom block name
ifp engineLoadIFP ( string ifp_file_path, string custom_block_name )

// this will replace an internal GTA animation with custom one, it's a light-weight operation,
// don't worry too much about performance. Different peds can have different running, walking,
// crouching, shooting, etc. animations all running simultaneously because we are not actually
// replacing animation hierarchies, we are merely storing everything in std::map which is in
// CClientPed. When an animation triggers, we get the ped by clump, and play the animation
// we wish to play. setPedAnimation works a little different than this, but the idea is same.
bool engineReplaceAnimation ( ped thePed, string block_name, string anim_name, string custom_block_name, string custom_anim_name )

// This will restore animation replaced using engineReplaceAnimation, if only 1 parameter
// is provided which is ped, then it will restore all animations, if  block name is also provided,
// then it will restore animations of that block only, if animation name is provided as well,
// it will restore that specific animation only.
bool engineRestoreAnimation ( ped thePed [, string block_name, string anim_name ] )

"

To add your own ifp file, just add this to meta.xml:

<file src="YourIFPFileNameHere.ifp" />

then in client-side Lua script, you can do:

local customIfp = engineLoadIFP ("YourIfpNameHere.ifp", "YourCustomBlockNameHere")
setPedAnimation ( localPlayer, "YourCustomBlockNameHere", "YourCustomAnimationNameHere" )

If you have any questions, write them here.

Edited by Saml1er
  • Like 4
  • Thanks 1

Share this post


Link to post

Very good :D:D When will it be introduced?

Share this post


Link to post
17 hours ago, Hexon said:

Very good :D:D When will it be introduced?

Thanks. It will be released when we are done testing.

  • Like 2

Share this post


Link to post
Posted (edited)

Very nice :D Great work

EDIT/ There is problem, I can't rejoin my own server it crash with your resources.

Edited by ma2med

Share this post


Link to post

You still planning on doing a set bone position function?

Share this post


Link to post
9 hours ago, ma2med said:

Very nice :D Great work

EDIT/ There is problem, I can't rejoin my own server it crash with your resources.

What is the crash message? can you take a screenshot? what exactly happens? You should be able to rejoin your server. Did you start the resource "ifptest"?

33 minutes ago, CodyJ(L) said:

You still planning on doing a set bone position function?

Yeah, I'm planning to do it, but it's a part of my another project where I rewrite entire animation system to get full control, I can work on other stuff only when my current pull request gets merged.

Share this post


Link to post
Posted (edited)

Alright that'd be amazing because I plan on adding an entirely new animation set that's fully dynamic. (Meaning no animation is static, every animation has a random movement added; (running, one leg may fall ahead or behind of the other by a small amount, shooting your hands follow  the trigger / handle, driving your hands follow the steering wheel, ect along with ziplines and crap in the future.)

Edited by CodyJ(L)

Share this post


Link to post
Posted (edited)

That's nice. I think you mean partial animations, which are currently not supported, quoting myself from github:

Quote

 

Something important about engineReplaceAnimation:

I forgot to mention that partial animations are not supported for replacing, if you replace them, MTA won't crash, but the animation will get glitched, most probably not what you want. Those are animations which usually run parallel with other animations like punching while running can't be replaced. You can replace running, punching, crouching, shooting with weapons, swimming, and hundreds of more similar animations, but there are few that you can't replace properly, and those few animations are partial animations.

The only reason why I did not fix this is because it will require me to rewrite the entire animation system including GTA task system. The amount of bones to be moved for every animation is hardcoded in GTA:SA for every task, and it will literally take me 4-5 more months to completely reverse it, and a few more to write code properly for MTA. That's roughly 1 year :)

I do have plans to add support for partial animations and the ability to have any amount of bones. Currently, bone limit is 32. I want to lift this limit and add a few more functions like setPedBonePosition and setPedBoneRotation. Hopefully, next year.

 

Adding partial animations will give animators full freedom, however, you can still achieve what you want, but it will require you to create more animations to play at the appropriate moment. When I add support for them, I'll probably add a new function, like setPedPartialAnimation, or I might simply modify setPedAnimation.

Edited by Saml1er

Share this post


Link to post
Posted (edited)

No I mean I'm asking about setBonePosition, partial animations are nice; but not what I'm mentioning. I'm looking for a setBonePosition so I can have full freedom over how the animations play out

Edited by CodyJ(L)

Share this post


Link to post
13 hours ago, CodyJ(L) said:

No I mean I'm asking about setBonePosition, partial animations are nice; but not what I'm mentioning. I'm looking for a setBonePosition so I can have full freedom over how the animations play out

Yeah, it's on my to-do list.

Share this post


Link to post
Posted (edited)

You no longer have to follow the steps in the original post, instead you can download latest nightly from: nightly.mtasa.com, it has all the latest IFP functions. You can also check the wiki.

https://wiki.multitheftauto.com/wiki/EngineLoadIFP

https://wiki.multitheftauto.com/wiki/EngineRestoreAnimation

https://wiki.multitheftauto.com/wiki/EngineReplaceAnimation

Edited by Saml1er
  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.