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 / Is DBPro object oriented?

Author
Message
Chelco
21
Years of Service
User Offline
Joined: 16th Oct 2002
Location:
Posted: 16th Oct 2002 20:41
Hi, I am a prospective buyer. Before making myself $100 poorer I would like to know if this language is object oriented. I have been looking around in the website, saw some code but I couldn't find if this language is object oriented. I also saw a lot of "GoSub" kind of stuff, which says to me that probably the answer is no.
Another question is: can you call dlls writen in C++ or Visual Basic from DB programs?
Thanks for helping.
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 16th Oct 2002 20:57
No, DarkBASIC Pro is not object orientated, so you use XRotate Object instead of Object.XRotate for example. Objects, Images etc. are handled like files in most other programs, so commands are usually in the syntax COMMAND (OBJECT / IMAGE ETC. NUMBER), OTHER PARAMETERS

Heavy use of Gosubs is probably a bad idea in DBP anyway. Using functions is better really.

Yes, DarkBASIC Pro can call DLLs created in C++ & Delphi, I am not sure about Visual Basic though (I think the answer is yes)

what is a signature?
ChipOne
21
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Canada
Posted: 16th Oct 2002 21:18
1) Not OO, but you can emulate most of what you need. You have UDTs, functions and arrays, which allows you to come pretty close to OO (except you don't have polymorphism or inheritance). If you use arrays and functions effectively, you can essentially tie a UDT to a set of functions (even in their own file) and 'pretend' it's a class. With a couple of workarounds, you can make things 'look' very OO.

2) No, VB is only COM and you can't export (at least, not that I'm aware) standard function calls (like a pure C++/Delphi DLL can). The COM layer isn't supported by DB, so you have to use C++/Delphi. There are tons of examples out in community for both.

-= i only do what my rice krispies tell me to do =-
Chelco
21
Years of Service
User Offline
Joined: 16th Oct 2002
Location:
Posted: 17th Oct 2002 03:01
Thank you guys for the responses.

I am an avid computer gamer, an amateur programmer and also a scientist. I have been alwas interested in building very simple simulations (toy models) about some research problems. I always wondered why scientists do not take advantage of all the visual power unleashed in even the most simple computer games.

Recently I got into C++ and Java and realized that object orientation is very useful for simulation purposes. However, coding something to visualize these simulations in the last two languages is beyond my reach. When I saw DarkBasic in the shelves of CompUSA for the first time, I thought that this could be what I need.

Your two responses were very helpful. I will just browse a bit more of DarkBasic code to see how feasible are my ideas.

Thanks again.

indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 17th Oct 2002 06:48
You could use TYPED arrays to achieve a grouping of objects in some form of managable structure.

u could end up with something like this





Im building an RPG so i used that as a reference.

I need Multiples of things and to be able to manage them
easily without having to manage lots of arrays.
its a pain in the butt when u want to flush the game and restart it and you forgot an array or 2.
Using arrays for the above method can work but its a little
more to manage.

this method is great for managing the media numbers also,
Instead of having to remember that Monster 400 is using
3d object location 456, you can reference the number from
Monster(i).NUM
i being the monster u want to alter


This method uses one array and one type.
cleaning up a whole TYPED array group is simplistic.
You just destroy 1 array


I hope that made TYPED arrays clear as mud

http://www.lunarpixel.com/ is my new site
indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 17th Oct 2002 06:55
here is the same code but using arrays if that helps to compare for you and anyone else discovering TYPES from this post.

TYPES are a god send in my eyes for my game requirements.



http://www.lunarpixel.com/ is my new site
indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 17th Oct 2002 06:56
and dont forget the zero location even thho i didnt use it in that array sample.

http://www.lunarpixel.com/ is my new site
Chelco
21
Years of Service
User Offline
Joined: 16th Oct 2002
Location:
Posted: 17th Oct 2002 22:25
Thank you indi. It is clear from your code that object orientation is possible to some extent.
Are the details about the TYPE thing included in the DB manuals?

ChipOne
21
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Canada
Posted: 17th Oct 2002 22:33
you bet...there's a primer in the help and plus you always have access to us.

-= i only do what my rice krispies tell me to do =-
rapscaLLion
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Canada
Posted: 17th Oct 2002 23:49
Well, I won't say the DB reference manuel is the BEST it can be, but it will certainly tell you what you need to know about types.

And to the orginial question:
DBP isn't object oriented, and I wouldn't have it any other way. I just find it easier for games programming.

Alex Wanuch
aka rapscaLLion
Get the DB Weekly Newsletter at www.dbwn.cjb.net
ChipOne
21
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Canada
Posted: 18th Oct 2002 01:45
"I just find it easier for games programming"

Hmm...not a terribly strong argument in all its merit. If we had OO, writing controls for UI and menus and such would be a breeze.

-= i only do what my rice krispies tell me to do =-
swdave
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United States
Posted: 18th Oct 2002 01:49
Hi,

We should review these OOP concepts and realize that C++ and Java are just implementations of OOP.

http://java.sun.com/docs/books/tutorial/java/concepts/

I would say that DB/DBPro implements alot of OOP concepts.

This C++ syntax 'MyObject.XRotate(XValue)' will call MyObject's member function XRotate which in turn modifies MyObject's private X variable.

So what do you think this DB/DBPro syntax does?
'XROTATE OBJECT MyObject,XValue'

In C++ you code classes and create objects from them. In DB/DBPro you create objects in your 3D modeling program.

P.S.
C++ has a goto statement it's your choice to use it or not.

indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 18th Oct 2002 06:19
Chelco, yes mate there are references and documentation for TYPES in the manual, You still will have to explore them and write some mini examples to know what works and what doesnt.


I used them in conjunction with an array and that might not be documented but still possible nonetheless.

http://www.lunarpixel.com/ is my new site
Milamber
21
Years of Service
User Offline
Joined: 27th Sep 2002
Location: Australia
Posted: 19th Oct 2002 11:54
1) If a DLL has been compiled, there should be no reason why it isn't loadable

2) If you know how, you can write a DLL and put it in compiler\plugins-user and add your own command to the language anyway, so you can do anything you like if you know how.

System Specs: AMD Athlon 1700+ XP, GA-7VRX motherboard, 128MB DDR RAM, GeForce2 MX400 64MB VRAM

Login to post a reply

Server time is: 2024-04-20 07:45:41
Your offset time is: 2024-04-20 07:45:41