This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: [WIP] LK to BC M2 converter in C (aka The Endless Nightmare)  (Read 7994 times)

spik96

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 275
    • View Profile
Hi =)
First of all, sorry for my mistakes in the English language.

A week ago I started a converter in ANSI C between two M2 model formats : Wrath of the Lich King and The Burning Crusade. I used Stan84's converter as a reference. I will try to keep it well documented.

I want to load the whole model in structures. This is a different approach of what most people tried in the past (copying the file THEN modify it). I want to be able to, step by step
1) Parse it
2) Convert it
3) Write it

So when the day will come more converting options could be added.

I'm still at the parsing stage...
So far I have passed on Cameras, Ribbons and Partcles.. but Animations should be parsed properly. This was really hard due to the "layer" nature of animations (a suite of number and file-relative offsets) and the lack of templates in C.
I'm just a beginner student. In some parts, the code could be an algorithmic heresy.

I'm alone and I find this really difficult. If you know C programming and want to review the code and/or contribute, here is the GitHub page :

https://github.com/Koward/LKBC_Converter
« Last Edit: May 25, 2015, 03:31:23 pm by Admin »
Github ]https://github.com/Koward[/url]    Skype : koward723 =)

Skarn

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 807
    • View Profile
    • http://skarn-project.net
Re: [WIP] LK to BC M2 converter in C
« Reply #1 on: May 17, 2015, 10:59:38 am »
That's nice to know that someone is actually contributing to some software. Though, I've never understood why people stick with TBC or Vanilla. If you don't want LK content you can just remove or block it inside 3.3.5a and make 70 lvl cup. And you get achievements and all cool LK stuff and also better graphics. Also there is a bunch of tools for 3.3.5a, so modding it is much more easier.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

spik96

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 275
    • View Profile
Re: [WIP] LK to BC M2 converter in C
« Reply #2 on: May 17, 2015, 12:39:01 pm »
I don't know about the others, but my reasons for sticking with an old version are clear.
First of all, I like the old gameplay better. Without LFG tools and some convenience things Blizzard added (=>No LK). And I don't like flying mounts (they are a design error imo)(=>No BC).

"Just remove them from a 3.3.5a version then !" you may say.
Well, I don't think a custom server can reach the population of "stock" versions server. That's why I'm mainly playing on private vanilla servers.

I like the gameplay, that doesn't mean I can't like the new graphics Blizzard added later. So I'm trying to bring them on my old client. There is already a pretty good TBC>Classic converter, but no LK>BC, so I try to code one. If I succeed, I will be able to use the powerful tools existing for 3.3.5a models and then convert the models to TBC and after that to Vanilla.

Yeah, I kind of like hardcore things.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Github ]https://github.com/Koward[/url]    Skype : koward723 =)

Skarn

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 807
    • View Profile
    • http://skarn-project.net
Re: [WIP] LK to BC M2 converter in C
« Reply #3 on: May 17, 2015, 05:24:11 pm »
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

spik96

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 275
    • View Profile
Re: [WIP] LK to BC M2 converter in C
« Reply #4 on: May 17, 2015, 05:29:40 pm »
The converter you linked is limited. It can't convert creatures with a lot of animations. Its collision writing can bug when there is no collision in the original model (easy to fix tho, just a check on header values).
I have the source of this converter however and it has been really useful to start (even if most things have to be rewritten from scratch).
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Github ]https://github.com/Koward[/url]    Skype : koward723 =)

PhilipTNG

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 709
    • View Profile
Re: [WIP] LK to BC M2 converter in C
« Reply #5 on: May 18, 2015, 02:44:55 am »
@OP: I can't give any help but I'd like to say Good On You Brother!! , Atleast you're going about it in an actual programming language instead of a markup XD. I wish you the best man :)

Quote from: "Skarn"
I've never understood why people stick with TBC or Vanilla..
I dunno about other people, but for me, I just enjoy tinkering with data, especially when there's several handfuls of people saying something isn't possible to do in so and so... kinda makes you want to prove them wrong more and more :)

Kind of like all those guys that said Kaev was an ambitious dreamer with a goal he'd never reach... boy were they wrong XD.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

stan84

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 184
    • View Profile
Re: [WIP] LK to BC M2 converter in C
« Reply #6 on: May 18, 2015, 06:32:22 am »
Good job Spik! :)

I have sent you on PM an c source for particle converter that makes LK->BC conversion, still mostly undone, but i think the output particles structure is right. maybe you can merge that function it with the project. The main bug is that function crashes if number of particles is more than 5 ( probably i screwed something in loops).

the tool is cmd and requires 2 args, source and target file. It takes particles from oryginal lk model and puts it converted at the end of TBC one.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

spik96

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 275
    • View Profile
Re: [WIP] LK to BC M2 converter in C
« Reply #7 on: May 19, 2015, 09:51:57 am »
Thanks =) !

@Stan84 This code will be veeeery useful. ATM I'm not trying to do too much things at the same time.

I'm already struggling to find the best way to store data in Animation Blocks. I succeed by making one structure at the time but the complexity is hellish.
On the wiki, it looks easy, when you see this :
Code: [Select]
struct array_ref
 {
   uint32_t number;
   T* elements;
 };

But this pointer is a file relative offset. So, you read the N array_ref, then you must create a whole new structure with N*number elements. And you probably want to retrieve them individually later for writing or manipulating, so enjoy the arrays everywhere. But hey, that's the easy part.
In each LK Animation Block, you have
Code: [Select]
array_ref<array_ref<T>> valuesYup. Array_refs "pointed" by Array_refs. So, you have your ABlock with the first array_ref, create an array to store all the things your array_ref pointed, but these are also array_refs, so an array of arrays is useful because you need to store their values too.
Considering the sizes are not constant, you just tinker with pointers (real f*cking C pointers this time) all the time and hope.
And now, the best part : it's incredibly hard to see if you succeeded. There is no reference to know how each value should look ! You know the type but when these are ints are the value correct or just addresses you placed by mistake ? I try to change things and choose the best-looking values.
So that was for 1 ABlock.
Now, the particles have a dozen Animation Blocks. So my idea to store them must be solid or I will fail everywhere.

I understand why this has never been done before.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Github ]https://github.com/Koward[/url]    Skype : koward723 =)

PhilipTNG

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 709
    • View Profile
Re: [WIP] LK to BC M2 converter in C
« Reply #8 on: May 19, 2015, 10:02:50 pm »
Quote from: "spik96"
Now, the particles have a dozen Animation Blocks. So my idea to store them must be solid or I will fail everywhere.
Particles aren't too bad, just make sure your bones are done right so they face the right way... lol... like my crazy ass not realizing I did it wrong the first dozen times(probably a bit more :lol: ) and all my bones were facing in the opposite directions, so everything was shooting the wrong way lololol.  The most particles I had done was for a 2H Sword that had 22 particles on it, worked well enough as far as I could tell.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

spik96

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 275
    • View Profile
Re: [WIP] LK to BC M2 converter in C
« Reply #9 on: May 19, 2015, 10:37:22 pm »
How did you manage to make your bones face the wrong way ? x)
You used unsigned int instead of int or something like that ?
If there are easy stupid mistakes I can avoid.. Better don't fall in the same holes ><"
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Github ]https://github.com/Koward[/url]    Skype : koward723 =)

PhilipTNG

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 709
    • View Profile
Re: [WIP] LK to BC M2 converter in C
« Reply #10 on: May 20, 2015, 12:19:04 am »
Quote from: "spik96"
How did you manage to make your bones face the wrong way ? x)
You used unsigned int instead of int or something like that ?
If there are easy stupid mistakes I can avoid.. Better don't fall in the same holes ><"
I really don't remember, I kind of screwed up and forgot to end a line somewhere so it kept going and ended up adding values to the bone's data as it was storing it XD, but not just that, if you don't do the translation and rotation correctly, the bones can sometimes just point straight up as well., and the data's in Float, not Int.

I believe it was the Particle's Opacity data that is different between BC and LK.  in LK, it's an Int16 value 0-32767, in BC, it's a uint8 value, 0-255.  Also I think it was the colors as well, in BC, it's a uint8 value as well for RGB, 0-255. However in LK, it's capacity is still 0-255 HOWEVER.. it's now a float value, so all you need to do is convert the float value you store to a uint8 and it should be fine.  If you look at items that existed between LK and BC with particles, you'll see what I mean.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Kaev

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 308
    • View Profile
Re: [WIP] LK to BC M2 converter in C
« Reply #11 on: May 22, 2015, 01:47:17 pm »
Quote from: "PhilipTNG"
Kind of like all those guys that said Kaev was an ambitious dreamer with a goal he'd never reach... boy were they wrong XD.
I know that my post will be off topic, but fck that.
It was just possible, because i wrote Cromon a message in skype. Kudos to Cromon for nearly everything related to Neo. Without him, i would still be an ambitious dreamer with a goal that i would never reach, because i'm way too lazy to finish something like that. :P
Sadly my mainboard broke yesterday. I think after i got my new one, i'll finally finish the GO and creature editors that i started.

Don't want to be 100% off topic:
Best luck with the converter. Sadly i have no experience with M2 models or anything related at all, otherwise i would help out a bit.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

spik96

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 275
    • View Profile
Re: [WIP] LK to BC M2 converter in C
« Reply #12 on: May 24, 2015, 12:33:02 pm »
Thanks everyone. I have finals to study right now so the code don't grow as much as I want it to but during summer I will try to be more active on this. I have some algorithms on paper I really want to implement and if they work I don't see why we could not have Wotlk animated models (without .anim files atm) in TBC (beside, maybe, limits due to technical size of types but I have not taken them into account yet).

EDIT : I implemented animation conversion. The output structure should be correct, but I can't check as I don't have reference data. If you want, the values for each bone are currently printed when you use the program for debugging. This is the hardest thing I've ever seen, really. I can't believe how some things don't make any sense.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Github ]https://github.com/Koward[/url]    Skype : koward723 =)

spik96

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 275
    • View Profile
Re: [WIP] LK to BC M2 converter in C
« Reply #13 on: June 01, 2015, 07:44:10 pm »
I thought my Interpolation ranges and timestamps were correct but there seems to be some difference and at the moment I don't find their logic, AT, ALL. They are not just Anim Start Timestamp + WotLK Timestamp, and the ranges are not just indices. It seems there is no documentation at all about their special behaviours (what happens when there is 0 timestamp ? or 1 ? How do you define a range for an anim with 1 ts ?).

It seems I'm the first to ever work on this.
If anyone has any information about it, that would be massively useful.
Oh god I wish I had the Burning Crusade source or BC Model Viewer source. I would then see how it interprets timeranges and copy that..
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Github ]https://github.com/Koward[/url]    Skype : koward723 =)

Method

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 78
    • View Profile
Re: [WIP] LK to BC M2 converter in C (aka The Endless Nightm
« Reply #14 on: June 08, 2015, 04:23:34 pm »
1.12.1 is way more fun than TLK in my opinion, and especially now more than ever with Nostralius it's getting good traction.

Others may disagree, but this software is something every 1.12.1 player kinda wants. and I'm glad someone is finally working on it. Some of us don't like flying, or group finders, or achievements. If this gets completed then we'll finally be able to unlock the possibility of TLK content in vanilla, and then we can get the best of both worlds and none of the crap.

We just want the old rusted out WoW for what it is, with *a few* of the parts we liked from the present.

It is the main link between the new and the old.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Big Protodrake Gifs are really annoying aren\'t they?