Types/Memory Usage
Blitz3D Forums/Blitz3D Beginners Area/Types/Memory Usage
| ||
Correct me if i'm wrong, but the first way to do this uses alot of memory, the second way doesn't eat memory until the new player is created, right?Dim p.player(1000000) and this way: type players field player.player[1000000] end type type player field stream field etc etc etc end type p.players=new Players p\player[1]=new player etc |
| ||
The second way won't eat memory until players is created, then it eats a load of memory even if you only want to store one player handle in it. |
| ||
ahhh, thanks |
| ||
Hi Folks, @Gauge: You'll also find that when exiting a program that uses the second style, it'll take forever to free up the memory. Later, Jes |
| ||
what if it holds about 10 elements only? would it still be not worth using? i just like how neater it seems using arrays in types. |
| ||
Well obviously holding 10 handles won't cost much memory, but I've never found it necessary to work like this. Only reason I can think of is if you want to look up the details of 1 player quickly without doing a search. |
| ||
Hi folks, As usual in these circumstances it's worth doing a little testing yourself, because it's fun to find these things out. Later, Jes |
| ||
Well I could always dim players by [1000] or so. I want/need a way to point to that player and have access to that players type. Each player will have up to 3 targets/other players they can fight. Without a pointer i might have to do half a dozen for next loops to find that player, then add that times 100 or 1,000 players if that ever became that option. Of course the dream would be: kill joe Select p\name$="joe" (return p, etc) voilla! |
| ||
well i was gonna do something liketype player field moves.PlayerMoves end type type PlayerMoves field MoveName[MovesAvailable] field MoveType[MovesAvailable] field MoveAnimation[MovesAvailable] field MoveSpeed[MovesAvailable] field MoveAnimation[MovesAvailable] field MoveMode[MovesAvailable] end type but should do it this way? type player field moves.PlayerMoves(MovesAvailable) end type type PlayerMoves field MoveName field MoveType field MoveAnimation field MoveSpeed field MoveAnimation field MoveMode end type thing is the number of moves maywell go into the hundreds so speed is important. |