View Single Post
Old 22 January 2019, 23:10   #21
Chrille
Registered User
 
Join Date: Sep 2018
Location: Germany
Posts: 35
Quote:
Originally Posted by zero View Post
Do you need a linked list? Why not just build a linear list every frame as you go through rendering objects?

Actually it might be faster to avoid the list entirely. If your collision map is only 40x32 (8x8 tiles on a 320x256 screen) just allocate 1.2k of RAM to it and have one byte per block. Write a 1 to any block with an object in it, and then you can test for collisions with all objects with a single check of one byte. No need to clear it, just write a 2 into it next frame and check for that.
This was a very dynamic bomberman clone. You could play it with up to 10 players at once. In theory there was no maximum of objects per 16x16 Pixel tile or the maximum number of objects would be very high, i.e. more than 10 objects (players) per 16x16 pixel tile. And most of the objects do not move, for example bombs are not moving unless there was an impulse from somewhere (e.g. from a assembly line).

Another reason was the main platform was for 68020+ (A1200 AGA) and AFAIK there it does not matter if you access a byte or longword (both are single memory accesses).

But your suggestion could be very good for a shoot'em up like inviyya, especially the part, write a value for one frame and increase the value the next frame. May be you have to go through the array and clear a part of the array to avoid wrong collisions after 255 frames ...

Last edited by Chrille; 22 January 2019 at 23:46.
Chrille is offline  
 
Page generated in 0.04315 seconds with 11 queries