SRB2 Message Board

SRB2 Message Board (https://mb.srb2.org/index.php)
-   Bug Reports (2.1.X) (https://mb.srb2.org/forumdisplay.php?f=104)
-   -   Fixed [2.1.17] MD2 destroys the game (https://mb.srb2.org/showthread.php?t=42099)

Yacker 10-31-2016 04:12 AM

[2.1.17] MD2 destroys the game
 
Loading this model over Sonic, playing in OpenGL with md2s on, playing as Sonic, and switching maps several times will cause the game to slowly break apart.
It usually starts with other character md2's vanishing or missing textures, and progresses to cause all md2s in the game to lose textures, and it can even make it impossible to add files to the game.
It might cause further mayhem with enough map loads, netplay, and other variables, but I haven't tested much.
Link to the model: https://www.dropbox.com/s/pz7wv1b2dg3k4gr/md2.zip?dl=0

Sapheros 10-31-2016 04:28 AM

OpenGL in a nutshell is horribly broken and un-optimized. You'd be better off waiting for RedEnchilada, Wofly or another Furyhunter to start working on that renderer before you start using MD2s again.

Monster Iestyn 10-31-2016 01:18 PM

...make it impossible to add files to the game? What on earth, is there some memory issue or something going on here I wonder?

Also tbh we'd be better off fixing the bug now rather than waiting for an OpenGL remake that may not happen for years yet. This sounds quite a serious one indeed. (Seriously guys stop dismissing OpenGL bugs due to the state of the renderer itself, they're not necessarily impossible to fix contrary to popular opinion =V)

Jeck Jims 11-01-2016 11:32 PM

Well, the model itself isn't setup proper for SRB2. SRB2 has a poly limit of 4048 vertices per model. (this has 6391) This alone is probably the cause of game breaking. I'm also unsure whats going on with the animations? You have 198 blank frame animations, separated out, but all are just the modeled T-posed. Your limited to the same number of frames as the sprites. (1 idle frame, 2 boredom frames, 8 walking frames, 4 spinning frames, 1 springup frame, 4 running frames, 6 ability(super) frames, 1 airbubble frame, 1 taking damaged frame, 1 death frame, 2 falling frames, 1 tailsgrab frame, 1 frame for lifeupbox and 1 for goalsign, in that order for a default character)

Yacker 11-02-2016 01:05 AM

I wasn't aware of the vertex limit, only the triangle limit. The animations...I, uh, don't know. I didn't actually make any animations for the model and simply loaded it to see if it would...and, well, the results are as posted. Still, though, the game should probably...not load the model or error or something if a model doesn't meet that obscure specification instead of just, well, breaking apart.

Monster Iestyn 11-02-2016 03:23 AM

Quote:

Originally Posted by Jeck Jims (Post 786340)
SRB2 has a poly limit of 4048 vertices per model.

Actually it's 4096, quickly checking the source code. Most of the MD2 limits are powers of 2, conveniently enough.

But yeah, it is strange the game doesn't check the vertex etc limits against the model's specs at all. Probably should spit out console error messages too or something.

TheDoctor 11-02-2016 05:35 AM

I once had this problem before and I can confirm 100% it's the vertices limit. I experienced the same problems and what not, textures acting up, md2s not appearing (and funny enough, my one sonic md2 had his body all normal, but his head, hands, and shoes were missing!) Etc.

Once I quit the game, and fixed to model to be under 5,000 verts (as MI stated 4096), it worked perfectly. I didn't report it back then since I knew it was a mistake on my end because of the vert count.

Jeck Jims 11-02-2016 01:05 PM

Quote:

Originally Posted by Monster Iestyn (Post 786353)
Actually it's 4096, quickly checking the source code. Most of the MD2 limits are powers of 2, conveniently enough.

But yeah, it is strange the game doesn't check the vertex etc limits against the model's specs at all. Probably should spit out console error messages too or something.

My bad, was thinking the old limit. (2048) I never stray too far over 3000 just to be safe, and in case I redo something later on. Perhaps make a clearer warning on the wiki page about it? I assume most people looking up how to make models for the game are looking there. But honestly, the model not appearing at all or incorrectly should be enough to tell you somethings wrong with it, I don't understand why you'd proceed to change the map multiple times.

XleederTH 11-02-2016 09:13 PM

Better to let the models -1500. as well stable performance remains.
Is poorly positioned the model, "lying down".

Monster Iestyn 11-03-2016 09:49 PM

While making a fix for this (that's a link btw) , I've found other MD2s such as Jeck's Sonic (I think it was his?) break other limits such as the one for texture coordinatess with no issue (the Sonic model I was using had something like 12945 texture coords when the max was 4096). Makes me wonder whether the limits need to be upped, or whether the MD2s shouldn't use as much stuff as they do? *shrugs*

Anyway, so you guys know, the "limits" as of 2.1.16 are supposed to be:

Code:

#define MD2_MAX_TRIANGLES              8192
#define MD2_MAX_VERTICES                4096
#define MD2_MAX_TEXCOORDS              4096
#define MD2_MAX_FRAMES                  512
#define MD2_MAX_SKINS                  32

The "skins" one seems to not matter at all really since all MD2s are forced to have only one anyway. Only the max vertices limit was ever referenced in the source code for anything up till now as it turns out, which is odd really.

But there we go, it's SRB2's source code. =P

Monster Iestyn 11-05-2016 07:22 PM

My fix is in now, having too many vertices should now simply make the console spit out an error saying you have too many (and how many maximum are accepted). The number of frames and triangles are also checked btw.

_d_ 11-06-2016 05:38 PM

You've possibly introduced a new bug, as line 794 is
Code:

md2_models[s].error = false;
instead of
Code:

md2_models[i].error = false;

Monster Iestyn 11-06-2016 05:47 PM

Whoops, well spotted, will fix right away.

EDIT: and the fix has been merged in too now, thanks for spotting that x_x

XleederTH 11-12-2016 01:42 PM

Then, I guess the texture's coordinates limits no matter much.


All times are GMT. The time now is 10:46 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.