PS3Hax Network - Playstation 3 Hacks and Mods

PS3Hax Network - Playstation 3 Hacks and Mods (http://www.ps3hax.net/forums.php)
-   PS3 | Member News (http://www.ps3hax.net/forumdisplay.php?f=142)
-   -   [Released] They Do Not Die v0.5 - ThatOtherDev (http://www.ps3hax.net/showthread.php?t=27572)

hackboiz29 09-19-2011 08:21 PM

[Released] They Do Not Die v0.5 - ThatOtherDev
 
ThatOtherDev, known for many entertaining homebrew games has just updated his popular game They Do ... [Read More]

Thelostdeathknight 09-19-2011 11:01 PM

moved to front page!

Rogerdodger91 09-20-2011 12:57 AM

Hmm well in psuedo code i would do the fade away thing like this.

Struct Blood
{
vector4 bloodColorTrans = 0.0f,0.0f,0.0f,0.0f
Int DespawnCounter = 5

//And any other information you might need ect, like coordinates, size, ect //and a sturct constructor.
}

Blood bloodSprite = new Blood("path/to/sprite") //plus other consturct args

List<Blood> bloodList = new list<Blood>()

GameTime counter = GameTime.getSecond()

If(Bullet.Collision)
bloodList.Add(bloodSprite)

Foreach(blood in bloodList)
{
Draw(blood)
}

If (counter % 2.0f == 0) //
{
If (!bloodList == null)
Foreach(blood in bloodList)
{
If(blood.Counter > 0)
{
blood.BloodColorTrans = BloodColorTrans - vector4(0f,0f,0f,.2f);
blood.DespawnCounter - 1;
}
Else
blood.delete();
}
}

This is just a roughdraft of how i would start. (in C# hehe. :p)
************* [ - Post Merged - ] *************
Perhaps people should add on to what i put?

ThatOtherPerson 09-20-2011 02:36 AM

I have no problem with deciding when and where to place blood or their alpha value. I already have that implemented and it is working pretty well in a build that I have running on Windows using OpenGL for rendering (before anyone asks yeah I'll be releasing Windows versions eventually).

http://img716.imageshack.us/img716/2...enshot11xo.png

My problem comes when I get to that "Draw(blood)" part you mentioned.

This is what I've got now. It is imperfect when fewer then the maximum number of decals are in existence but whatever I'm content with it, it doesn't take long for 500 blood or corpse sprites to be spawned and I can improve upon it later.

Code:

#ifdef WIN
glBindTexture(GL_TEXTURE_2D,persontexture);
#endif
#ifdef PS3
usetexture(persontexture_image);
#endif
for(int a=0;a<decalcount;a++){
        #ifdef WIN
        glColor4f(1.f,1.f,1.f,(float)a/(float)maxdecalcount);
        #endif
        draw2dquad(
                decallist[a].posx,
                decallist[a].posy,
                0.75f,0.75f,
                decaltexturecoords[decallist[a].type],
                1,decallist[a].angle);
}
#ifdef WIN
glColor4f(1.f,1.f,1.f,1.f);
#endif

With this being the PS3 version of that draw2dquad function

Code:

void draw2dquad(float posx,float posy,float sizex,float sizey,float *texturecoords,bool centerandrotate,float angle){
        #ifdef PS3
        if(centerandrotate==0){
                float verts[]={
                        posx,                posy+sizey,
                        posx+sizex,        posy+sizey,
                        posx+sizex,        posy,
                        posx,                posy,};
                realityVertexBegin(context,REALITY_QUADS);{
                        for(int b=0;b<4;b++){
                                realityTexCoord2f(context,texturecoords[b*2],texturecoords[b*2+1]);
                                realityVertex4f(context,verts[b*2],verts[b*2+1],0.0,1.0);
                        }
                }
                realityVertexEnd(context);
        }else if(angle==0){
                sizex*=0.5f;
                sizey*=0.5f;
                float verts[]={
                        posx-sizex,        posy+sizey,
                        posx+sizex,        posy+sizey,
                        posx+sizex,        posy-sizey,
                        posx-sizex,        posy-sizey,};
                realityVertexBegin(context,REALITY_QUADS);{
                        for(int b=0;b<4;b++){
                                realityTexCoord2f(context,texturecoords[b*2],texturecoords[b*2+1]);
                                realityVertex4f(context,verts[b*2],verts[b*2+1],0.0,1.0);
                        }
                }
                realityVertexEnd(context);
        }else{
                angle*=-1;
                sizex*=0.5f;
                sizey*=0.5f;
                float vertsunrotated[]={
                        0-sizex,        0+sizey,
                        0+sizex,        0+sizey,
                        0+sizex,        0-sizey,
                        0-sizex,        0-sizey,};
                float verts[]={
                        posx+vertsunrotated[1]*sin(angle)+vertsunrotated[0]*cos(angle),        posy+vertsunrotated[1]*cos(angle)-vertsunrotated[0]*sin(angle),
                        posx+vertsunrotated[3]*sin(angle)+vertsunrotated[2]*cos(angle),        posy+vertsunrotated[3]*cos(angle)-vertsunrotated[2]*sin(angle),
                        posx+vertsunrotated[5]*sin(angle)+vertsunrotated[4]*cos(angle),        posy+vertsunrotated[5]*cos(angle)-vertsunrotated[4]*sin(angle),
                        posx+vertsunrotated[7]*sin(angle)+vertsunrotated[6]*cos(angle),        posy+vertsunrotated[7]*cos(angle)-vertsunrotated[6]*sin(angle),};
                realityVertexBegin(context,REALITY_QUADS);{
                        for(int b=0;b<4;b++){
                                realityTexCoord2f(context,texturecoords[b*2],texturecoords[b*2+1]);
                                realityVertex4f(context,verts[b*2],verts[b*2+1],0.0,1.0);
                        }
                }
                realityVertexEnd(context);
        }
        #endif
}

Yeah I know there is undoubtedly a lot of room for optimization especially when it comes to dealing with rotated sprites but the relevant part is that I obviously can't use glColor4f without OpenGL so I need a PS3 specific alternative.

Rogerdodger91 09-20-2011 04:07 AM

void realityDrawVertexBuffer(gcmContextData *context, uint32_t type, uint32_t start, uint32_t count);
************* [ - Post Merged - ] *************
Let me see if i can find what your looking for regarding the glcolor4.

daveyp187 09-20-2011 05:02 AM

I love this game :)
thanks for the update.

jonnyjaeger 09-20-2011 12:47 PM

Gonna try this one out as soon as I get home from work tomorrow. Seems like an awesome game. Thanks and keep up the good work!!

cloneking666 09-20-2011 06:50 PM

this would be a cool game.
 
some one showed make like a postal game. but a lot cooler. and more blood-yer:evil:.

lukethomasx 09-22-2011 08:57 AM

Quote:

Originally Posted by cloneking666 (Post 252644)
some one showed make like a postal game. but a lot cooler. and more blood-yer:evil:.

hop to it clone king. But anyway this game is awesome and I can't wait to try co op with my gf later
************* [ - Post Merged - ] *************
I just wish it had some music/sound effects


All times are GMT -5. The time now is 05:49 AM.

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