Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / any way for objects to not be tied to numbers at all?

Author
Message
PAGAN_old
20
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 29th Apr 2011 07:38
i was thinking. I know objects have to be somehow tied to numbers even if object cube= deathcube the deathcube needs to be tied to a number to be worth anything. the whole numbering of objects / variables that equal to object numbers gets very confusing when you have a lot. it would be better if objects were defined as independent variables to which you can assighn numbers if you want.

so you like have
and have another group of objects at the same time also have variable numbered 1,2,3 etc. it really sucks, when hypothetically i have object 1-100 for terrain, objects 200-350 for stuff decorating terrain, objects 365-382 for 3rd person camera control nad the player. you see where i am getting at?

Is there like a plugin that eliminates objects tie to a number? and lets me define them as variables instead? like i said above?

dont hate people who rip you off,cheat and get away with it, learn from them
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 29th Apr 2011 09:28
I don't do a lot of 3D stuff but wouldn't it be easier to make a UDT to store the object data so you could mix the different object types (terrain = 1, decoration = 2, camera control = 3). So you won't have to worry about the object numbers they actually use. Like if you wanted to hide all decorations you could go through the entire array and hide only objects with a type 2 setting.

Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 29th Apr 2011 09:29
Clonning them or instancing i don't remember i guess does this. But that makes an object inaccessible for the future.

Also, i do the exact same thing if you meant what i understood. I have a bunch of variables at the beginning declaring the objects in the game, and if i increase any of these, all the objects above that are increased too, so i don't have to worry about the stupid numbering.

Yes, it can become a big pain for decent sized projects.

-In.Dev.X: A unique heavy story based shoot'em ~12%
-CoreFleet: An underground commander unit based RTS ~15%
-TailsVSEggman: An Sonic themed RTS under development for idea presentation to Sega ~15%
PAGAN_old
20
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 29th Apr 2011 09:54
yeah all this stuff makes it more complicated than needed.

Quote: "I have a bunch of variables at the beginning declaring the objects in the game"


yes but those variables do need top be traced back to an object numbers that defines those variables. Makes my options pretty limited. If only the object variables didnt depend on the numbering system in theory, i will have the possiblity to create unlimited objects and it would make my life a lot easier and better ogonised.

for example lets say i made a terrain editor which makes huge terrains, splits them into smaller pieces and procedually loads the right piecesaround your charecter based on the charecters position. Well it would be much easier to load them in the game based on their variables (and less limiting) rather than having to convert them to work with the numbering system.

dont hate people who rip you off,cheat and get away with it, learn from them
Jimmy
22
Years of Service
User Offline
Joined: 20th Aug 2003
Location: Back in the USA
Posted: 29th Apr 2011 13:08 Edited at: 29th Apr 2011 13:09
I don't know if I'm understanding you completely, but what I, and a lot of others, do to avoid managing object numbers is use a function to scan for the next available object number and assign that to a variable for an object.

Like-a so:



Something tells me, though, that you're already aware of this, and it is not the solution you have in mind...


May 10th / Geek Culture / Jerico2day-OBese87 / VOTE
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th Apr 2011 19:32
I'm pretty sure that I don't understand what they are getting at - you have to have some way to refer to an object, and whether you use numbers or handles for this, you have to 'remember' these, and the way to remember them is to store them within variables.

Perhaps someone can post a 'for example...' here. If I see code and an explanation of that code, then I can usually understand

Daniel wright 2311
User Banned
Posted: 29th Apr 2011 19:39
Not to be rude here god forbid but I look at it like this, If you dont like to code all the numbers in to define all the objects you dont like to code at all. If this is the case then why even do it?? Did you know that writing most all programs you have to define images or any objects to a number so the pc can know what is what.

I say, if you dont like defining everything, most of everything will be a mees in the end.And this is a part of coding we all have to do in the end.

my signature keeps being erased by a mod So this is my new signature.
PAGAN_old
20
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 29th Apr 2011 22:42
Quote: "Something tells me, though, that you're already aware of this, and it is not the solution you have in mind...
"


yeah. so far this might be the best soution but i am afraid it will cause problems in the long run like i will have to make this check every time a new object is spawned into existance and running trought all the object numbers to find a free one will just make the code slower.

yes i know you have to define the objects somehow but defining them as just variables is so much easier than numbers. Right now you can do that but the object variables have to be defined with numbers anyway so in the end i am right back where i started and the code became even more unnecesearly complicated.

just to make it clear again this is what i am getting at



usually the variable var_cube1 is defined by a number like var_cube1=32 or something. If i am working with a lot of objects. a lot of numbers that define the objects and variables will just get very messy. Even if objects are all defined by variables and its all neat and orgonised and easy to remember. it will be a complete mess with all the numbers that define these variables.

if getting rid of object numbers is impossible, i was hoping there is some plugin, .dll or function that manages and recycles the object numbers so i just dont even have to worry about them at all and let me work just with variables instead.

dont hate people who rip you off,cheat and get away with it, learn from them
janbo
17
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 29th Apr 2011 22:43
If I understand what you mean, you could do something like that:
Daniel wright 2311
User Banned
Posted: 29th Apr 2011 23:10
you could inc the object numbers with inc object# and put it into an array some how.this is what I am about to ask myself, not for object numbers but kind of similar.

my signature keeps being erased by a mod So this is my new signature.
PAGAN_old
20
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 29th Apr 2011 23:23
i tried that that at one point i think it worked but as far as i remember with all the inc object# i had it was a pain to get it to work with all the 256 objects i had i had little room for further expansion and flexibility.

dont hate people who rip you off,cheat and get away with it, learn from them
Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 29th Apr 2011 23:57
I'm not entirely following you either. Perhaps you should post what you've got, as hiding the 'object number' is straight forward.

Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 30th Apr 2011 00:07
i think he wants something like this:

hBox1=makeObjectBox(1,1,1)
positionObject hBox1,100,10,0
scaleObject hBox1,120,100,100

hImage1=loadImage("image.bmp")
textureObject hBox1,hImage1

Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 30th Apr 2011 00:39
Handles?




buuuut generally what I do is have a start and end range for each object type. So, if I have 250 good guys, 250 bad guys, and 500 scene objects, I have a variable, say:

sceneobj.size=500
goodguy.size=250
badguy.size=250

aaaand then you can calculate what new object number to make, or whatever.


Tell me if there's a broken link to images in a thread I post, and I'll fix 'em.
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 30th Apr 2011 01:37 Edited at: 30th Apr 2011 01:38
It sounds like a reference similar to a c class object and a blitz basic type of object.

The easy way to do this is:



The bit that is different is this:


DBP uses numbers...

Warning! May contain Nuts!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 30th Apr 2011 02:06
... or you could use my FIND FREE OBJECT function that keeps track of what object id's are not in use, and so does not search at all, and because of that it is lightning fast.

Jimmy
22
Years of Service
User Offline
Joined: 20th Aug 2003
Location: Back in the USA
Posted: 30th Apr 2011 05:16
SOLVED[img][/img]


May 10th / Geek Culture / Jerico2day-OBese87 / VOTE
PAGAN_old
20
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 30th Apr 2011 08:00 Edited at: 30th Apr 2011 08:07


so this Find_Free_Object() is a dbp command?
Well i guess in terms of simplified code this is the best solution

dont hate people who rip you off,cheat and get away with it, learn from them
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 30th Apr 2011 09:54
find free object() is an IanM matrixutil command.


Tell me if there's a broken link to images in a thread I post, and I'll fix 'em.
PAGAN_old
20
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 30th Apr 2011 23:22
Quote: "IanM matrixutil command"


is that like a plugin?

dont hate people who rip you off,cheat and get away with it, learn from them
Goz3rr
16
Years of Service
User Offline
Joined: 27th Mar 2010
Location:
Posted: 30th Apr 2011 23:37 Edited at: 30th Apr 2011 23:43
I didn't read the whole thread, but you can tie variabled to objects.

All you gotta do is this:


etc.

...
PAGAN_old
20
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 30th Apr 2011 23:44
I i guess thats also a good way. Its actually sortof expands on what other people reccomended here, but yeah thanks its great help!

Question about the IanM matrixutil. where can i download it?

dont hate people who rip you off,cheat and get away with it, learn from them
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 1st May 2011 00:08
Follow the link in my signature - the download is about 2 thirds of the way down the first post and highlighted in bold.

The help files are included, and are also available online.

If you need any example of how to use any of the commands, just ask.

PAGAN_old
20
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 1st May 2011 05:17 Edited at: 1st May 2011 09:04
nice. Well i guess this is the best solution out there. Its n ot quitle like what i wanted but it will have to do. thanks guys!
and thanks IanM

dont hate people who rip you off,cheat and get away with it, learn from them

Login to post a reply

Server time is: 2026-07-11 12:20:34
Your offset time is: 2026-07-11 12:20:34