eWallRim::Bound

What do you want to see in Armagetron soon? Any new feature ideas? Let's ponder these ground breaking ideas...
User avatar
Z-Man
God & Project Admin
Posts: 11770
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

Two reasons it's not in CVS:
a) it's a CPU hog
b) the "lighting" effect is not even remotely correct
But if it's disabled by default and the config item enabling it is well hidden (so users don't activate it, thinking its a fully supported feature, and complain about a) or b) ), I have no objections.
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Post by Jonathan »

I took it to the next level! :D
Attachments
improved_lights.png
ˌɑrməˈɡɛˌtrɑn
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Post by Jonathan »

Another screenshot.
Attachments
17lights.png
ˌɑrməˈɡɛˌtrɑn
User avatar
Tank Program
Forum & Project Admin, PhD
Posts: 6715
Joined: Thu Dec 18, 2003 7:03 pm

Post by Tank Program »

Jonathan, the things in front (if they are lights) should continue to spread out at the end of the wall due to wave properties. More specific, the light should defract and continue to loose strength. (The lack of this is most visible in the upper left corner of the screen shot you posted, where whites light stops at the wall, and at the end of the wall does not diffract.)

Edit: Following up on this, the waves should also reflect some if the walls are a reflective surface...
Image
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Post by Jonathan »

I'm not sure what you mean with the things in front. Anyway, it can't be much more complicated than this. It already hogs both the CPU (if there are many cycles and/or walls) and GPU (as on the last screenshot).
ˌɑrməˈɡɛˌtrɑn
User avatar
Z-Man
God & Project Admin
Posts: 11770
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

Jonathan: 8) I read from the FPS count that you circumvent 1) by casting less rays. And the lighting effect looks a lot better, although it's still not proper (the light would need to get blended with the surface it shines on and the walls would need to get light, too).
Cool deathzone :)

Tank: No game handles light diffraction correctly, especially the kind you're talking about. Mainly because it only has visible effect when the lit structures are very small. Soft shadow edges as you get them from lightsources with finite extension would be cool, though.
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Post by Jonathan »

z-man wrote:Jonathan: 8) I read from the FPS count that you circumvent 1) by casting less rays.
Yep, only 33. Still slow with nemo though.
And the lighting effect looks a lot better, although it's still not proper (the light would need to get blended with the surface it shines on and the walls would need to get light, too).
Would be hard to fix... I'll think about it.
Edit: do you suspect anything is wrong with the way I calculate brightness? Keep in mind that the light is positioned only 1 unit above the floor.
Cool deathzone :)
And the winzone is green. :D
Last edited by Jonathan on Mon May 30, 2005 6:23 pm, edited 1 time in total.
ˌɑrməˈɡɛˌtrɑn
User avatar
LETE
Core Dumper
Posts: 128
Joined: Sat May 21, 2005 5:40 am
Location: Hey if i'm not here i'm most likely on the grid

Post by LETE »

lighting effects hardly have to be accurate, this is supposed to be taking place inside a computer anyway, so who says what the lighting dynamics are in a place nobody has been. Besides, I think it looks cool the way it is. :D
Image
User avatar
ROCK
Average Program
Posts: 76
Joined: Fri Feb 18, 2005 4:03 am

Post by ROCK »

with that many bots you could cause seizures. :o
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Post by Jonathan »

LETE: Of course! But trying to make it more accurate is fun. :)
ROCK: Never noticed that... so it should be OK.
ˌɑrməˈɡɛˌtrɑn
User avatar
Tank Program
Forum & Project Admin, PhD
Posts: 6715
Joined: Thu Dec 18, 2003 7:03 pm

Post by Tank Program »

ROCK wrote:with that many bots you could cause seizures. :o
There's already a warning in the documentation about siezures :P.
Image
User avatar
LETE
Core Dumper
Posts: 128
Joined: Sat May 21, 2005 5:40 am
Location: Hey if i'm not here i'm most likely on the grid

Post by LETE »

Jonathan wrote:LETE: Of course! But trying to make it more accurate is fun. :)
In that case, its impossible for each light to be white at its origin, that implies that about 6 feet down the line your filtering out all of the visual spectrum except for the color of the cycle/trail. it really should be the same color all the way to the origin for the light source. BTW, can you post the code changes you've made thus far? And maybe the code you use for the win zone while your at it :lol:
Image
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Post by Jonathan »

What you're seeing is just an overflow... and imo the bright spots at cycles are actually cool. :)

I can publish the source once it's cleaned up...
ˌɑrməˈɡɛˌtrɑn
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Post by Jonathan »

Not so clean, but here it is anyway:

Code: Select all

if(headlights) {
    if(!cycleprograminited) { // set to false on every sr_InitDisplay, without it I lost my program when I switched to windowed
        const char *program =
"!!ARBfp1.0\
\
PARAM normal = program.local[0];\
ATTRIB texcoord = fragment.texcoord;\
TEMP final, diffuse, distance;\
\
DP3 distance, texcoord, texcoord;\
RSQ diffuse, distance.w;\
RCP distance, distance.w;\
MUL diffuse, texcoord, diffuse;\
DP3 diffuse, diffuse, normal;\
MUL final, diffuse, distance;\
MOV result.color.w, fragment.color;\
MUL result.color.xyz, fragment.color, final;\
\
END";
        glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(program), program);
        cycleprograminited = true;
    }
    glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 0, 0, 0, speed * speed, 0);
    glPushAttrib(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // blend func and depth mask. Efficient or not, glPushAttrib/glPopAttrib is a quick way to manage state.
    glEnable(GL_FRAGMENT_PROGRAM_ARB); // doesn't check if it exists...
    
    const unsigned sensors = 32; // actually one more
    const double mul = 0.25 * M_PI / sensors;
    const double add = -0.125 * M_PI;
    
    double size = gArena::SizeMultiplier() * 500 * M_SQRT2; // is M_SQRT2 in your math.h?
    GLfloat array[sensors+2][5];
    
    array[0][0] = 0;
    array[0][1] = 0;
    array[0][2] = p.x;
    array[0][3] = p.y;
    array[0][4] = 0.125;
    
    for(unsigned i=0; i<=sensors; i++) {
        gSensor sensor(this, p, dir.Turn(cos(i * mul + add), sin(i * mul + add)));
        sensor.detect(size);
        array[i][5] = sensor.before_hit.x - p.x;
        array[i][6] = sensor.before_hit.y - p.y;
        array[i][7] = sensor.before_hit.x;
        array[i][8] = sensor.before_hit.y;
        array[i][9] = 0.125;
    }
    
    glPushMatrix();
    glLoadIdentity();
    
    glMatrixMode(GL_TEXTURE);
    glPushMatrix();
    glTranslatef(0, 0, 1);
    
    glBlendFunc(GL_ONE, GL_ONE);
    glDepthMask(GL_FALSE);
    
    glColor3fv(reinterpret_cast<GLfloat *>(&color_)); // 8-)
    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    
    glInterleavedArrays(GL_T2F_V3F, 0, array);
    glDrawArrays(GL_TRIANGLE_FAN, 0, sensors+2);
    
    glDisableClientState(GL_VERTEX_ARRAY);
    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
    
    glDisable(GL_FRAGMENT_PROGRAM_ARB);
    
    glPopMatrix();
    glMatrixMode(GL_MODELVIEW);
    
    glPopMatrix();
    glPopAttrib();
}
Edit: this fragment program is faster than the one on the screenshots, which did some stuff that is unnecessary in this case.
Last edited by Jonathan on Tue May 31, 2005 4:30 am, edited 1 time in total.
ˌɑrməˈɡɛˌtrɑn
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Post by Jonathan »

The zone (add any missing instance variables to the class):

Code: Select all

void gWinZone::Render(const eCamera *cam)
{
    lastTime = se_GameTime();
#ifndef DEDICATED
    glDisable(GL_LIGHTING);
    glDisable(GL_CULL_FACE);
    glDisable(GL_TEXTURE_2D);
    
    double r = Radius();
    
    GLfloat m[16] = {
        r,0,0,0,
        0,r,0,0,
        0,0,pow(fabs(r), 1/M_E),0, // e doesn't mean much here, but it works pretty well
        pos.x,pos.y,0,1
    };
    glMatrixMode(GL_MODELVIEW);
    glPushMatrix();
    glMultMatrixf(m);
    glCallList(dlbase + s_zoneDeath);
    glPopMatrix();
#endif
}
Call these in constructors and destructors:

Code: Select all

void gWinZone::GenerateLists() {
    const unsigned int detail = 1024;
    const double dinc = 2*M_PI/detail;
    unsigned int i;
    double d = 0;
    dlbase = glGenLists(2);
    
    float x[detail+1], y[detail+1];
    for(i=0; i<=detail; i++) {
        x[i] = cos(d);
        y[i] = sin(d);
        d += dinc;
    }
    
    glNewList(dlbase, GL_COMPILE);
    glBegin(GL_QUAD_STRIP);
    for(i=0; i<=detail; i++) {
        glColor3f(0.0, 1.0, 0.0);
        glVertex3f(x[i], y[i], 1.0);
        glColor3f(0.25, 1.0, 0.25);
        glVertex3f(x[i], y[i], 0.0);
    }
    glEnd();
    glEndList();
    
    glNewList(dlbase + 1, GL_COMPILE);
    glBegin(GL_QUAD_STRIP);
    for(i=0; i<=detail; i++) {
        glColor3f(1.0, 0.0, 0.0);
        glVertex3f(x[i], y[i], 1.0);
        glColor3f(1.0, 0.25, 0.25);
        glVertex3f(x[i], y[i], 0.0);
    }
    glEnd();
    glEndList();
}

void gWinZone::DeleteLists() {
    glDeleteLists(dlbase, 2);
}
That's how I left it a while ago...
Note that s_zoneDeath is int.
ˌɑrməˈɡɛˌtrɑn
Post Reply