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.

Newcomers DBPro Corner / Advice on Object Creation

Author
Message
Bulleyes
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 17th Dec 2002 06:53
Hi,

I came from a C++ background. Usually in C++, I manipulate the "dynamic" objects creation/destruction using NEW and DELETE operator. I just need to specifiy an object type (class), and it will return an instance reference to it.

I am wondering how DBpro programmer create object in their game dynamically. Unlike C++, DBpro create each object by specifiying a numerical reference; C++ return an object reference.

In C++, if there are number of objects of different type, I will just store it in several array with different type (class). The array is not restricted to a fixed size, it can "grow".

What I am currently do in DBpro initially is, whenever I want to create an object dynamically, I just create a FOR loop from 1 to 65535 and look for an empty slot using OBJECT EXIST command. Then I realize by using this, I have no way to identify the object type later, i.e. how do I know Object 1 is Enemy Ship A, Object 4 is Capital Ship #2, and so on.

Then I try a different approach. I allocate a range of numbers of each object type, i.e. 1 to 100 for Enemy type A, 110 to 200 to Ship Type B, and so on. Whenever I want to create a new ship in the game dynamically, I just go through the appropriate range depends on the type, and look for a empty slot by using OBJECT EXIST command.

How about you guys? How do you manage and manipulate your objects in your game via DBpro?

Thanks!
Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
QuothTheRaven
22
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 17th Dec 2002 14:32
I make an array for my objects, the first row the object number, the next row the object width, then height, etc etc. In my collision code, it returns the value of the object you collide with, and based on its properties in the array it will do stuff.
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 18th Dec 2002 03:22
i make a type with an array and declare one of the typed array variables to manage the object numbers and the rest to define the objects attributes.

Bulleyes
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 18th Dec 2002 05:35
Indi: Interesting, that's what I am thinking to do too. But, when you create new object, you still need to scan for an empty slot right? How do you do that?

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 18th Dec 2002 15:33
there are dynamic arrays u might want to explore.
I havent fully as yet to explain it back without a hiccup of info.

Login to post a reply

Server time is: 2024-11-23 17:44:33
Your offset time is: 2024-11-23 17:44:33