I am working on a basic engine to draw sprites on screen and I wanted to implement a frame - rate method that works as such:
- I have a background image stored in a 2D array (that never changes, if I need a different background I need to load a new image) that gets copied every time a new frame has to be made;
- all sprites are contained in a list contained in a list ordered in ascending z order. I am yet unsure wether to tap into multithreading or not as far as blitting is concerned. This list is mutable, so if a sprite is inserted , it's locked and sorted after insertion;
- the sprites are blitted on the 2D array mentioned in point 1 and after that it's displayed on screen.
The question I have is , if I want to bump the framerate up , will this cause an out of memory exception/error of some sort? Basically , will this eat all my memory before the language has enough time to free any? I know this is the case for some applications in Java that have to deal with many small instances being created, where the program can just crash (at least , it happened to me on a few instances). Is there a better way or is this good enough?
For clarification, my console / raster will never be wider or longer than a few hundred units, so say abot 100 * 80 is probably as big as it gets. Finally , my pixel class takes up 24 bytes (1 character , 1 background color , 1 foreground color).