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 / Kinda New to DarkBasic have a few programming theory questions

Author
Message
Tyrothz
14
Years of Service
User Offline
Joined: 7th Aug 2011
Location:
Posted: 8th Aug 2011 03:07
Hello, I am a C#/Java/whatever else developer that has recently decided to look into Dark Basic. Now it should be noted that Dark Basic is the first non object oriented language I've ever written but I find it intuitive.

First question I have, I noticed that the objects are all labeled with a number. Does this mean that there would be a maximum number of objects in the game or is there a better way of doing this?

Really I cannot remember the other questions I had but if I remember them, I will post.

Please and Thank you..

Creator of Anonymously tXting and Super Sounds both for Palm/HP WebOS.
Kezzla
17
Years of Service
User Offline
Joined: 21st Aug 2008
Location: Where beer does flow and men chunder
Posted: 8th Aug 2011 07:49 Edited at: 8th Aug 2011 07:56
I think there may be an upper limit, however my system cops out long before the limit is reached,
with a clever object loading and deleting process you generally wont need to get anywhere near the limit.

edit: I just tested it out and the highest object number I can use is 22,000,000.
so really for all useful purposes that's a pretty excessive amount of objects.
\edit

Sometimes I like to use words out of contents
SH4773R
16
Years of Service
User Offline
Joined: 18th Jan 2010
Location: AMERICA!!!
Posted: 8th Aug 2011 08:13
It depends on your RAM

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 8th Aug 2011 08:59
Quote: "edit: I just tested it out and the highest object number I can use is 22,000,000"


Come again? I thought the limit was 2^16 (65536) ?

You will never reach the limit, so don't worry about it. To make DBP more object orientated, you can always use a function to search for a new object. For example, a cube:



Then all you do is call this to make a new cube with the size 10:



TheComet

Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 8th Aug 2011 11:05
^or use DarkGDK


Why does blue text appear every time you are near?
Kezzla
17
Years of Service
User Offline
Joined: 21st Aug 2008
Location: Where beer does flow and men chunder
Posted: 8th Aug 2011 11:25
Quote: "Come again? I thought the limit was 2^16 (65536) ?"


It probably is, I couldnt find the limit in my documentation and my machine isnt that flash so rather than try to max out the models, i just upped the model number till it would go no higher. I assumed that being the top number, that must be the limit.

Sometimes I like to use words out of contents
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 8th Aug 2011 18:35
I assume the limit would be 2,147,483,647 (the max positive number for an integer) but on IanMs FIND FREE OBJECT() command it's limited to 262,144.

http://www.matrix1.demon.co.uk/Matrix1Utils_Help/Matrix1Util_19/find_free_object.html

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Aug 2011 20:38
The limit is 22,000,000, and using high numbers won't make any difference to the DBPro runtime EXCEPT in the case of objects - all other resource types use a balanced binary tree to reference the ID's, but objects use an array instead, so if you allocate object 22,000,000, it will literally create an array with 22,000,000 entries in it swallowing up 88MB of memory just for that.

That's why my FIND FREE OBJECT function only returns 'low' numbers up to 262,144.

Tyrothz
14
Years of Service
User Offline
Joined: 7th Aug 2011
Location:
Posted: 15th Aug 2011 05:33
Thanks guys, this is extremely helpful. A long time ago I did a lot with Mark Overmars' GameMaker but I see some a lot of future for me with DarkBasic and my dark physics addon.

Creator of Anonymously tXting and Super Sounds both for Palm/HP WebOS.

Login to post a reply

Server time is: 2026-07-10 08:28:05
Your offset time is: 2026-07-10 08:28:05