SRB2 Message Board  

Go Back   SRB2 Message Board > Archived > SRB2 Forum Archives > Bug Reports (2.1.X)

 
 
Thread Tools Search this Thread
Old 10-31-2016   #1
Yacker
Metallic
 
Yacker's Avatar
Default [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

Last edited by Monster Iestyn; 11-05-2016 at 07:21 PM.
Yacker is offline  
Old 10-31-2016   #2
Sapheros
That guy that ports
 
Sapheros's Avatar
Default

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.
__________________
Hiyo all! Underground Website
Sapheros is offline  
Old 10-31-2016   #3
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

...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)
Monster Iestyn is offline  
Old 11-01-2016   #4
Jeck Jims
Oh, THAT guy...
 
Jeck Jims's Avatar
Default

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)
Jeck Jims is offline  
Old 11-02-2016   #5
Yacker
Metallic
 
Yacker's Avatar
Default

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.
Yacker is offline  
Old 11-02-2016   #6
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

Quote:
Originally Posted by Jeck Jims View Post
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.
Monster Iestyn is offline  
Old 11-02-2016   #7
TheDoctor
 
TheDoctor's Avatar
Default

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.
__________________
Portal Disco Anyone?:
https://www.youtube.com/watch?v=sCVs...ature=youtu.be
TheDoctor is offline  
Old 11-02-2016   #8
Jeck Jims
Oh, THAT guy...
 
Jeck Jims's Avatar
Default

Quote:
Originally Posted by Monster Iestyn View Post
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.
Jeck Jims is offline  
Old 11-02-2016   #9
XleederTH
íReremy
 
XleederTH's Avatar
Default

Better to let the models -1500. as well stable performance remains.
Is poorly positioned the model, "lying down".
__________________
Nothing for nothing, is the key :v
Visit my youtube channel!

Last edited by XleederTH; 11-04-2016 at 01:55 AM.
XleederTH is offline  
Old 11-03-2016   #10
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

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 is offline  
Old 11-05-2016   #11
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

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.
Monster Iestyn is offline  
Old 11-06-2016   #12
_d_
Default

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;
_d_ is offline  
Old 11-06-2016   #13
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

Whoops, well spotted, will fix right away.

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

Last edited by Monster Iestyn; 11-06-2016 at 05:58 PM.
Monster Iestyn is offline  
Old 11-12-2016   #14
XleederTH
íReremy
 
XleederTH's Avatar
Default

Then, I guess the texture's coordinates limits no matter much.
__________________
Nothing for nothing, is the key :v
Visit my youtube channel!

Last edited by XleederTH; 11-12-2016 at 01:43 PM. Reason: correcting grammar (I think xD)
XleederTH is offline  
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:37 AM.


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