CBM Posted November 6, 2019 (edited) Hi I am working on a console tool to help me auto generate modeldef information for a given MD2 file to use in ZDoom (I specifically use GZDoom when modding Doom) so far I can read the MD2 file, display the frame names, count the number of animations and frames (locally and globally) and generate sprite names based on the frame names (global frame count = the combined total of all frames in the MD2 file) (local frame count = the number of frames in a specific animation set... ie... Walk1, Walk2, Walk3 would have a local frame count of 3, while global frame count could be 60) but I have some questions as to what strategies would be best when it comes to autogenerating sprite names so far I just take the first 3 letters of the frame name and then add a number between 0 and 9 based on the local frame number.. ie run1 or run01 or run001 would become run0 A ... run9 or run09 or run 009 would become run0 I run10 would become run1 A ... run19 would become run1 I run20 would become run2 A ... run29 would become run2 I etc... supporting a total of 99 local frames sometimes I encounter an MD2 file with jumps in the frame names when I am developing and testing... like Walk101, Walk102, Walk103, Walk201, Walk202 etc.. ? is that normal? and if so, should I try a new strategy for naming the sprites? I need a way to automatically name the sprites such that the name makes sense and that any MD2 file is supported! Any suggestions? I will post more info once the tool is more developed... and I plan on making a MD3 version as well (since MD3 has no frame names but relies on predefined ranges, some stuff would need to be different) I might also try to make it create suggestions for DECORATE and make it able to handle large numbers of models in a single run (ie. if I could get it to read a directory of MD2 files and textures and then make appropiate MODELDEF and DECORATE files.. either seperate files or 2 big ones) Edited November 8, 2019 by CBM details 1 Quote Share this post Link to post
Gez Posted November 7, 2019 (edited) I think you'd probably get more feedback if you changed the thread title to make it more accurate. You want infos about GZDoom's MODELDEF code, C and ZDoom are not the actual topic. I don't actually know how to answer your questions as I've never used MODELDEF or models in general, before. Edited November 7, 2019 by Gez 1 Quote Share this post Link to post
andrewj Posted November 8, 2019 On 11/6/2019 at 6:26 PM, CBM said: sometimes I encounter an MD2 file with jumps in the frame names when I am developing and testing... like Walk101, Walk102, Walk103, Walk201, Walk202 etc.. ? is that normal? and if so, should I try a new strategy for naming the sprites? That particular case looks like two separate walk animations (Walk1xx and Walk2xx). But any tool like yours cannot really detect that, since quake MDL, MD2 and MD3 don't have explicit "animations", they are just a bunch of frames which rely on the game code to specify what frame to use at any particular time. I think the sprite names will need to be unique, e.g. you couldn't have two models with RUN1 as their sprite names. If that is true, you tool should probably allow the user tp specify the first two letters and then append two digits for particular animation. Really it is surprising that GZDoom still has such a piss-poor support for models, this nonsense requiring a model to pretend to be a sprite should be deprecated in favor of something decent. 0 Quote Share this post Link to post
CBM Posted November 8, 2019 (edited) 5 hours ago, andrewj said: That particular case looks like two separate walk animations (Walk1xx and Walk2xx). But any tool like yours cannot really detect that, since quake MDL, MD2 and MD3 don't have explicit "animations", they are just a bunch of frames which rely on the game code to specify what frame to use at any particular time. I think the sprite names will need to be unique, e.g. you couldn't have two models with RUN1 as their sprite names. If that is true, you tool should probably allow the user tp specify the first two letters and then append two digits for particular animation. Really it is surprising that GZDoom still has such a piss-poor support for models, this nonsense requiring a model to pretend to be a sprite should be deprecated in favor of something decent. I agree that GZDoom should have better model support... and I ought to use MD3 models when modding GZDoom.. but... I do have a lot of Quake 2 player models and my tool is now finally able to output a valid modeldef file for a given MD2 file texture is read from MD2 file path is read from MD2 file (path to texture, usually models\players) spritenames are generated from animation names (yes yes... non animated MD2 models will not work, but this is not a tool for models without animation) max number of animation sets is 10 in GZDoom apparently... so it skips some animation sets if there are more than 10, usually there are 16 resulting file is named texture name + .modeldef jumps are handled as a "seperate" animation set regarding spritenames spritenames are ... first 3 lettes of the animation set name plus a number (numbered in packs of 10, usually long animations such as stand will be up to 40 frames.. ie... walk0-3 A-J) If the numbering increases by more than 2 then I interpret that as a jump, so a jump from walk109 to walk201 would be detected if the input file is named tris.md2 then the tool assumes there is a weapon.md2 with a weapon.pcx texture as well example output could be wal0 A 0 "walk01" for tris.md2 and wal0 A 1 "walk01" for weapon.md2 ie. spritename spriteindex modelindex framename I will post more details later today Edited November 8, 2019 by CBM 0 Quote Share this post Link to post
CBM Posted November 8, 2019 first version ready for download precompiled exe for commandline (and/or send to folder) https://bitbucket.org/CBMFreak/md2modeldef/src/master/md2modeldef.exe header file https://bitbucket.org/CBMFreak/md2modeldef/src/master/anorms.h main file https://bitbucket.org/CBMFreak/md2modeldef/src/master/main.c 1 Quote Share this post Link to post
CBM Posted November 9, 2019 now updated with a new commit that fixes the following bugs - naming now correct (now modeldef.<name> instead of <name>.modeldef) - max assuming 9 sprites per animation, more can be used if the modeldef file is edited in slade (others are marked as comments) - renames sprites that would otherwise be duplicates - always uses first skin if present - uses directory name if no name found elsewhere when using a file named tris.md2 I am considering making it always do 2 files.. one with weapon and one without and still considering if it should do a decorate aswell code still needs work, optimizing and cleanup... atm its more throw sh** on the wall and see what sticks 0 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.