[Closed] Allow more models in MODELDEF

Moderator: GZDoom Developers

Allow more models in MODELDEF

Postby SPZ1 » Wed Mar 16, 2022 12:24 pm

I was typing my MODELDEF only to discover that this is a byte sized field:

Script error, "SPZ2.pk3:modeldef.lmp" line 14632:
Too many models in Swamp_Giant


Code: Select allExpand view
MODEL Swamp_Giant {
   Path "models/enemies/Swamp_Giant"
   Model 256 "GIant_Pain_000013.obj"
   Scale 64.0 64.0 64.0
   
   FrameIndex EM13 N 256 256
}   


Would it be too much to ask to increase the size of this field even if only to a Short/Int16
User avatar
SPZ1
 
Joined: 02 Aug 2017
Location: Illinois

Re: Allow more models in MODELDEF

Postby Cherno » Wed Mar 16, 2022 2:22 pm

Uhm... What exactly are you trying to do? An actor that consists of over 256 sub-models, AND has entries for each of those sub-models?!?
User avatar
Cherno
 
Joined: 06 Dec 2016

Re: Allow more models in MODELDEF

Postby SPZ1 » Wed Mar 16, 2022 4:00 pm

I'm only making a normal monster. It has a lot of frames. Since it has 2 textures it can only be imported into GZdoom in such a way.
User avatar
SPZ1
 
Joined: 02 Aug 2017
Location: Illinois

Re: Allow more models in MODELDEF

Postby Enjay » Wed Mar 16, 2022 4:21 pm

Any chance you could post more/all of your modeldef? I think you *might* be making the same incorrect assumption that I made when first using modeldefs a while back.

Model numbers are for associating more than one model to a single frame. If you need 256 models, it means that at least one of your frames has 256 models associated with it at one time.

If your frames and models are sequential, and each frame only needs one model/skin allocated to it, then you just write a new definition for each frame and each one can be model 0.

e.g. this is one that I was doing today:
Code: Select allExpand view
//Normal appearance and regular death
Model NJZPoisonShroom
{
   Path "Models"
   Model 0 "shroom2.md3"
   Skin 0 "shroompois.png"
   Scale 1.2 1.2 1.2
   
   FrameIndex SHRM A 0 0
   FrameIndex SHRM B 0 1
   FrameIndex SHRM C 0 2
   FrameIndex SHRM D 0 3
   FrameIndex SHRM E 0 4
   FrameIndex SHRM F 0 5
}

//Ice death
Model NJZPoisonShroom
{
   Path "Models"
   Model 0 "shroom2.md3"
   Skin 0 "shroompoisice.png"
   Scale 1.2 1.2 1.2
   
   FrameIndex SHRM G 0 0
}

//Burn death
Model NJZPoisonShroom
{
   Path "Models"
   Model 0 "shroom2extra.md3"
   Skin 0 "shroompoisburn.png"
   Scale 1.2 1.2 1.2
   
   FrameIndex SHRM H 0 0
   FrameIndex SHRM I 0 1
   FrameIndex SHRM J 0 2
   FrameIndex SHRM K 0 3
   FrameIndex SHRM L 0 4
   FrameIndex SHRM M 0 5
}

//Disintegrate death
Model NJZPoisonShroom
{
   Path "Models"
   Model 0 "shroom2extra.md3"
   Skin 0 "shroompoisdis.png"
   Scale 1.2 1.2 1.2
   
   FrameIndex SHRM N 0 0
   FrameIndex SHRM O 0 1
   FrameIndex SHRM P 0 2
}

Two different models, 4 different skins but no model index number higher than 0
(I think the above can actually be consolidated a bit more than that, but the above layout works for me.)
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: Allow more models in MODELDEF

Postby SPZ1 » Wed Mar 16, 2022 4:36 pm

It looks like this:

Code: Select allExpand view
MODEL Swamp_Giant {
   Path "models/enemies/Swamp_Giant"
   Model 0 "GIant_Idle_000000.obj"
   Scale 64.0 64.0 64.0
   
   FrameIndex EMPT A 0 0
}

MODEL Swamp_Giant {
   Path "models/enemies/Swamp_Giant"
   Model 1 "GIant_Idle_000001.obj"
   Scale 64.0 64.0 64.0
   
   FrameIndex EMPT B 1 1
}

MODEL Swamp_Giant {
   Path "models/enemies/Swamp_Giant"
   Model 2 "GIant_Idle_000002.obj"
   Scale 64.0 64.0 64.0
   
   FrameIndex EMPT C 2 2
}

MODEL Swamp_Giant {
   Path "models/enemies/Swamp_Giant"
   Model 3 "GIant_Idle_000003.obj"
   Scale 64.0 64.0 64.0
   
   FrameIndex EMPT D 3 3
}

MODEL Swamp_Giant {
   Path "models/enemies/Swamp_Giant"
   Model 4 "GIant_Idle_000004.obj"
   Scale 64.0 64.0 64.0
   
   FrameIndex EMPT E 4 4
}

MODEL Swamp_Giant {
   Path "models/enemies/Swamp_Giant"
   Model 5 "GIant_Idle_000005.obj"
   Scale 64.0 64.0 64.0
   
   FrameIndex EMPT F 5 5
}

MODEL Swamp_Giant {
   Path "models/enemies/Swamp_Giant"
   Model 6 "GIant_Idle_000006.obj"
   Scale 64.0 64.0 64.0
   
   FrameIndex EMPT G 6 6
}
User avatar
SPZ1
 
Joined: 02 Aug 2017
Location: Illinois

Re: Allow more models in MODELDEF

Postby Enjay » Wed Mar 16, 2022 6:04 pm

OK, yup, I think you have indeed made the incorrect assumption that I was talking about.

Let's just look at the first two entries:

Code: Select allExpand view
MODEL Swamp_Giant {
   Path "models/enemies/Swamp_Giant"
   Model 0 "GIant_Idle_000000.obj"
   Scale 64.0 64.0 64.0
   
   FrameIndex EMPT A 0 0
}

MODEL Swamp_Giant {
   Path "models/enemies/Swamp_Giant"
   Model 1 "GIant_Idle_000001.obj"
   Scale 64.0 64.0 64.0
   
   FrameIndex EMPT B 1 1
}


The first one allocates a model to EMPTA and the second one allocates a model to EMPTB. These are different frames/sprites and each one is only has one model allocated to it. So you don't need to increment the model index for each one. This would work just as well.

Code: Select allExpand view
MODEL Swamp_Giant {
   Path "models/enemies/Swamp_Giant"
   Model 0 "GIant_Idle_000000.obj"
   Scale 64.0 64.0 64.0
   
   FrameIndex EMPT A 0 0
}

MODEL Swamp_Giant {
   Path "models/enemies/Swamp_Giant"
   Model 0 "GIant_Idle_000001.obj"
   Scale 64.0 64.0 64.0
   
   FrameIndex EMPT B 0 1
}


i.e. you seem to be trying to allocate a new model index to every frame/sprite, and it's just not needed. You only need to have multiple model indices when you are allocating multiple models to the same frame/sprite.

If that mistake is repeated that right through your whole MODELDEF for the actor, you don't need 256+ model indices, you only need one.
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: Allow more models in MODELDEF

Postby Enjay » Wed Mar 16, 2022 7:13 pm

Oh, and while I think about it, I'm not sure because I don't usually use the obj format but I don't think it can store internal animations. If that is the case, the final 1 in the model definition should probably also be a 0. That entry is currently telling gzdoom to use the second frame of animation stored in the model - which, if what I assume about obj models is correct, will mot exist.

Also, just to mention it, I *think* using separate models for each frame like you are doing means that they cannot be interpolated. That might mean your animation looks a bit jerky.

Apologies for any typos, doing this on my phone.
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: Allow more models in MODELDEF

Postby Cherno » Wed Mar 16, 2022 9:53 pm

No actor needs more than one MODELDEF entry. So, the examples above can all be combined into one entry simply by changing the Model or (Surface)Skin between FrameInfo lines. Works for pretty much every property (Path, for example); all following FrameInfo lines will use the new property value, until changed again.

As Enjay said, Having models for each frame is a bit unusual; you would just use an animated MD3 model that has all the frames in one file.

Code: Select allExpand view
MODEL Swamp_Giant {
   Path "models/enemies/Swamp_Giant"
   Model 0 "GIant_Idle_000000.obj"
   Scale 64.0 64.0 64.0
   
   FrameIndex EMPT A 0 0
   Model 0 "GIant_Idle_000001.obj"
   FrameIndex EMPT B 0 1
}
User avatar
Cherno
 
Joined: 06 Dec 2016

Re: Allow more models in MODELDEF

Postby Nash » Thu Mar 17, 2022 12:38 am

Also, I think using a different model file for each frame will disable interpolation. The model would look extremely jittery during animation.
User avatar
Nash
AKA Nash Muhandes! Twitter/Facebook/Youtube: nashmuhandes
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Twitch ID: nashmuhandes
Github ID: nashmuhandes

Re: Allow more models in MODELDEF

Postby Enjay » Thu Mar 17, 2022 1:23 am

Thanks for the example Cherno. I knew things could be consolidated more than my examples, but I wasn't sure exactly how they should look.

I noticed that you left sprite B still using frame 1 of the model rather than frame 0. Do you know if I am correct or not about obj models not being able to have multiple frames?

@Nash, thanks also for confirming about the lack of interpolation when setting up a model like this. I thought that would be the case.
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: Allow more models in MODELDEF

Postby Cherno » Thu Mar 17, 2022 5:29 am

Yes, obj models can't store animation data, so frame index would be 0 for all FrameInfo lines.
User avatar
Cherno
 
Joined: 06 Dec 2016

Re: Allow more models in MODELDEF

Postby Enjay » Thu Mar 17, 2022 5:39 am

Perfect, thanks.
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: Allow more models in MODELDEF

Postby SPZ1 » Thu Mar 17, 2022 10:40 am

Thanks for sorting this out you guys!! :thumb:
User avatar
SPZ1
 
Joined: 02 Aug 2017
Location: Illinois


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: Caligari87 and 1 guest