Entity number? clarification

Blitz3D Forums/Blitz3D Programming/Entity number? clarification

puki(Posted 2004) [#1]
I accept in advance that this question may have come up before.

With regard to CameraPick, etc whereby an entity is referenced by a number which appears to be 25 million plus.

Is it possible to over-ride the numbers assigned by Blitz3D to your own?

The reason why I say this is I note the numbers don't seem to be calculated from anything relational (apart from 25 million and something). I created an entity and then made 3 copies the copies where 25833504 - 25844352 - 25883572. Looking at the values they appear unrelated, ie they don't seem to be specifically calculated.

** Can the numbers be made (or changed) to be sequential?

Also, can I perform collisions based on the numbers?

Instead of faffing around with entity indexes and collision types can I not just do a collision between 2 entities (regardless of type/index)? Considering you can manipulate the entities via the 25 million index numbers (such as HideEntity 25883572 as opposed to HideEntity Player), it would be handy to be able to do EntityCollided(whatever,25883572) or EntityCollided(a 25M number, another 25M number) - or by CollisionEntity, etc..

I hope that makes sense.


puki(Posted 2004) [#2]
In addition, does anyone know what the '25 million' numbers are based on? If I write a program now and manipulate a particular entity (25833504) - will that entity have the same number if the program is run on a completey different machine? Are these '25 million' numbers safe to reference?


Klaas(Posted 2004) [#3]
- no, these are handles and cant be over-ride or changed
- the handles arent stand in relation to each other
- you can make as many entityTypes and collisions you wish ... just give thoses two entitys there own collision ... then you can test with entityCollided(entity1,entityTypeOfEntity2)

- the '25millions' are just a 32bit unsigned integer
- the entitys will always have different handles not only on other machines .. they are not safe for reference

try to manage your entitys in types ... you have to keep track over them by yourself


sswift(Posted 2004) [#4]
That number is an entity handle. That is the number you get when you create an entity. You need to store that number somewhere when you create the entity, so you can later delete the entity or even so you can move it.

As you need to store the number, you can store it in a list, and loop through all entities in that list when you get a collision pointer back, and compare their numbers to the number you got back.

No the numbers will not be the same on different PC's. They won't even be the same on your own PC. That is a memory location where the data for the entity is stored, and that memory location changes depending on what apps you have running in windows at the same time and how much memeory each has taken up.


Tom(Posted 2004) [#5]
Hi,

The number is a pointer to a memory block/structure that is allocated by Blitz when the entity is created.

Because these addresses are dynamic, you've no way of knowing what the number will be before they're created, thus no way of hard coding them :)

Tom


puki(Posted 2004) [#6]
Thanks "Klaas", "sswifty" and "Tom"- I kind of thought it wouldn't be that easy - sniff - it would have been bloody good if it where though.