My apologies if any of this is redundant. I DID run a search for some of my questions regarding structs and arrays and I'm still not entirely certain of the best way to do what I'm trying to do. If I've made any mistake in posting this, I hope you'll all chalk it up to newbie inexperience.
I am in a bit of confusion about the best way to do what I'm trying to do given the way array sizes work. What I want in my game is this: there is a specific type of game entity (we'll call it a Beef, since I like beef). Now, each Beef has a set of variables that are essentially randomized when a Beef is created. At the beginning of the game, there's only one Beef. However, more Beefs will be created through the player's actions. That is to say, the player has the power to tell the game to generate a new Beef from time to time. In addition, from time to time Beefs may be destroyed, either by the player or by the game. This means (a) I as the programmer don't know beforehand how many Beefs will be in any given game, and (b) the number of Beefs will change very often in any given game. After browsing through the AGS help file, it seemed to me that an array of structs was the best way to go. However, as far as I can tell, a normal array in AGS code has a set size declared upon creation. I read the bit about "dynamic arrays", but according to the help file these cannot include structs, and the data within them gets erased any time you change the array size anyway.
So, what is the best way to handle this situation? One thought that occurred to me was just to make the array size massive right from the start--i.e. "Beef beefs[10000000];", and then leave all unused Beef variables empty until new Beefs are generated by the player. What would be the effects on memory if I did this? Would this create a huge unwieldy bit of data that would slow down game speed, for example? Also, this method still has a flaw--although the max is very very high, a max still exists. Ideally I'd like it to be possible for the game to go on forever if desired, so that a player could (in theory) create Beef after Beef after Beef in a very Beef-filled universe (ok, now I'm hungry...) Is there anyway I can do what I'm trying to do and have there NOT be a limit (beyond the player's machine's computing ability, anyway)?
Again, my apologies if this post is redundant or if the information I need could have been obtained some other way. I appreciate any help the more experienced folks here could give me--thanks in advance!