Allow more models in MODELDEF

Moderator: GZDoom Developers

Post Reply
User avatar
SPZ1
Posts: 256
Joined: Wed Aug 02, 2017 3:01 pm
Location: Illinois
Contact:

Allow more models in MODELDEF

Post by SPZ1 »

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 all

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
Cherno
Posts: 1311
Joined: Tue Dec 06, 2016 11:25 am

Re: Allow more models in MODELDEF

Post by Cherno »

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
SPZ1
Posts: 256
Joined: Wed Aug 02, 2017 3:01 pm
Location: Illinois
Contact:

Re: Allow more models in MODELDEF

Post by SPZ1 »

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
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Allow more models in MODELDEF

Post by Enjay »

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 all

//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
SPZ1
Posts: 256
Joined: Wed Aug 02, 2017 3:01 pm
Location: Illinois
Contact:

Re: Allow more models in MODELDEF

Post by SPZ1 »

It looks like this:

Code: Select all

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
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Allow more models in MODELDEF

Post by Enjay »

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 all

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 all

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
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Allow more models in MODELDEF

Post by Enjay »

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
Cherno
Posts: 1311
Joined: Tue Dec 06, 2016 11:25 am

Re: Allow more models in MODELDEF

Post by Cherno »

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 all

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
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Allow more models in MODELDEF

Post by Nash »

Also, I think using a different model file for each frame will disable interpolation. The model would look extremely jittery during animation.
User avatar
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Allow more models in MODELDEF

Post by Enjay »

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
Cherno
Posts: 1311
Joined: Tue Dec 06, 2016 11:25 am

Re: Allow more models in MODELDEF

Post by Cherno »

Yes, obj models can't store animation data, so frame index would be 0 for all FrameInfo lines.
User avatar
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Allow more models in MODELDEF

Post by Enjay »

Perfect, thanks.
User avatar
SPZ1
Posts: 256
Joined: Wed Aug 02, 2017 3:01 pm
Location: Illinois
Contact:

Re: Allow more models in MODELDEF

Post by SPZ1 »

Thanks for sorting this out you guys!! :thumb:
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”