phoboslab / wipeout-rewrite

2.64k stars 212 forks source link

Limit enemy ships drawing distance #125

Open arczi84 opened 4 months ago

arczi84 commented 4 months ago

Hello, I've made an Amiga port and I'd like to squeeze a bit more fps. I have limited track render distance matching N64 which gave me a lot more fps but ships are being drawn on the whole track and I can't find code for that. Any help regarding this topic and tips for more optimizations would be very appreciated.

phoboslab commented 4 months ago

Cool!

Ships and their shadows are drawn in ships_draw() looping over all ships and calling ship_draw() (singular) which just draws the object.

Things to optimize here:

arczi84 commented 4 months ago

Thanks! I'll definitely try that :) Here is profiling graph that was made on Amiga: prof-w1

render_push_tris as can be seen, takes almost half of the CPU time. I wonder if there could be some improvement.

arczi84 commented 4 months ago

Alright, using low poly models gave huge 15fps! :) Now I need to figure out how to hide them when they're far.

arczi84 commented 4 months ago

OK , I have done it and fps is almost twice more! :)

ship_t *draw_other_ships(ship_t *self) {
    int reference_index = 0;
    ship_t *reference_ship = &g.ships[reference_index];
    int shortest_distance = 10;
    int distance = -1;

    distance = abs(self->section->num - reference_ship->section->num);

    if (distance > 0 && distance < shortest_distance) {
        return self;
    }
    else {
        return NULL;
    }
}
cotodevel commented 1 month ago

Sorry for chiming in.

What are the Amiga specs you've ported this wipeout codebase?

Mind sharing the source code? I'm planning to port it into a device where the source code is more or less optimized so it renders up to 2048~ triangles per second.

Regards from Chile!

arczi84 commented 1 month ago

No problem, my old repo is here , it's missing my latest optimizations. I still need to clean up the code before upload.

cotodevel commented 1 month ago

Sure, i'll wait.

What are the Amiga specs you've ported this wipeout codebase? Just to get an idea about how it'll perform.

arczi84 commented 1 month ago

Honestly game is unplayable on Amiga even with voodoo3 due to very slow memory bus. It's only playable on with PPC equipped Amigas (video) and 68k Amigas with Pistorm accelerators but only in software though (video). I think performace would be better with native software mode.

cotodevel commented 1 month ago

thanks. These specs are much more than the original 2MB on the PSX version. But I guess if the source code is optimized enough, could fit into 4MB of RAM (on the device I plan to port wipEout)