Simple Questions Topic

Blitz3D Forums/Blitz3D Beginners Area/Simple Questions Topic

Apollonius(Posted 2004) [#1]
Here I'll post simple questions about building a game,
I'll just add questions to this topic~


Ok, can big TYPE affect the performance of the game in anyway? (big type I eman when you have alot of field like 60 for example)


jhocking(Posted 2004) [#2]
Depends on how many instances you have. Obviously a lot will eventually fill up the computer's memory. Until then types aren't much different from regular variables.


Apollonius(Posted 2004) [#3]
Well example,

Type Monster
field name
field hp
field mp
field min_damage
field max_damage
field spell
End Type

and theres 60 instances


jhocking(Posted 2004) [#4]
Note my comment that types aren't much different from regular variables. I'll assume the "name" field is a string, so your Monster type is one string variable and 5 integer variables. Since you have 60 instances, that's 60 strings and 300 integers. Then there are a few additional bits of data used to maintain the linked list of types. Unless you are running the game on a pocket calculator, that amount of memory consumption is not something you need to worry about.


WolRon(Posted 2004) [#5]
60 (say) 256 character strings + 1200 bytes for integers is only 16560 bytes or 16Kilobytes.

Considering that your computers memory is typically hundreds of Megabytes (at least 10,000 times what you need) and that your hard-drive (virtual memory) is several Gigabytes (at least 1,000,000,000 (1 billion) times what you need), you should have NO worries.


_PJ_(Posted 2004) [#6]
A lot of things I have done run into hundreds of instances of TYPES with about 30 fields too...

No problems with the iteration speed or memory.