To further explain:
Using a perlin noise plugin I can easily generate a starting area for my game. I then want to have this area expanded when a player gets close to where there are no sprites at all, then generate those areas using the same perlin seed. At the moment I only have two sprites: water and land.
I have tried everything I could think of including making bullets that shoot out and as they travel I have a statement when the bullet is not overlapping the family "terrain" (which holds both land and water) to have the terrain pick the overlapping bullet imagepoint (this stops it from thinking the camera or any non terrain entities count). ELSE: get the bullet's X and Y as it is truly not overlapping any terrain, then run a function which has an array and loop through it to determine which sprites should be created (this array is small and used as a chunk).
To be clear, this works...but unless I want to spawn 100s of bullets to cover every angle so that blank spots don't squeak through, it is unreliable. I additionally thought of maybe running a larger array (creating a larger chunk), but obviously spawning many sprites at a time has a performance impact.
Does anyone have any idea to be achieve this? In a nutshell, how do I reliable spawn a sprite in every spot that does not current have a sprite as I move about the level.
The last part I am concerned about is the quantity of sprites that are in the map. Should I develop this in a way as to destroy the sprites as I move and then re-create them as I move back to the original location? I thought about this but then realized I would just have a very large array holding the name and other specifics. Not sure how good performance will be with this method.
Anyway, hoping someone can toss me some ideas. I think once maybe I have solved the fog of war + creating new sprites, that may help with the last part of my question.
Develop games in your browser. Powerful, performant & highly capable.