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.

Author
Message
Shadowfax
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 30th Jan 2003 13:13
There was a thread a while back about implimenting more c / c++ based commands in DB and / or making it object oriented. Additional support for pointers and the '&' command.

I have to report that it *is* possible to create such structures with MAKE MEMORY, using DWORD to cast passed integers back to pointers, and by instigating flags within the object header an approximation (and it is only an approximation) of object orientation can be made.

1000 lines of code later i have a simple matrix with camera control on the mouse. Yes, i realize this can be done in 20 lines of code but the system can identify the 'class' of each object and it can be handled appropriately with no framefrate issues at this time.

P4 2.0, 384MB ram and Geforce 2 MX 200
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 30th Jan 2003 13:23
seems like a weird way to use the memory pointers, using them within DarkBasic Pro i'd be very cautious about.

Unlike in C/C++ where the memory is automatically assigned for you, you have to assign it yourself in Pro.
you can accidentially assign or over-right an area which has already been assigned... this is kinda dangerous (which is why even in the help about it suggests not using them)

Without seeing what you've done it would be hard to see how it is object orientated, unless what you've done is written this memory and then just pointed it to a variable to be used anytime - which althought would make it and object, makes it a costly one and you still can't really assign them.

last time i checked you can't assign a variable (even pointed) within a type ... which would give you the ability for the objecting

i'll try to think up some code in a lil while to explain this better right now my mind is still firmly on MFC development

Anata aru kowagaru no watashi!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 30th Jan 2003 14:58
You can do 'OO' in DB in the same way you can do it in C - not very well, and you have to do everything yourself.

This includes (but is not limited to) :

Memory Allocation/Deallocation
Construction/Destruction
Copying
Assignment
Polymorhism
Calling member functions
Getting/Setting member variables
Type checking

It would be fairer to say you have implemented an Object-Based system, not Object-Orientated.
Shadowfax
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 30th Jan 2003 15:14
I am not using types at all - only simulating an implimentation of them ... example given is primarily of the CAMERA object but a section of the code for the BASE object is given for clarity (i hope )

Please note that this is code 'in progress' - i have tried to avoid ad hoc inprovisation where possible because that is just generally bad practice (yes, you will see *one* example of it!) - but the code works - I just need the flexability that this system provides for the type of game i am writing (no, sorry - no hints at this stage cos as far as i am aware no noone has used the idea in its entirity yet)

All objects are created from the BASE object which is comprised of differing subblocks depending on how flags
are set at the time of object creation

The CAMERA object only needs an ID to identify the correct Dark Basic camera but subtype determines the camera's behaviour within the enviroment. Additionally the camera has a Parent-Peer-Child Ptr block to link to other camera's that may or may not be created during run time

************************************************************
BASE OBJECT CODE : baseObj.dba
************************************************************


************************************************************
CAMERA OBJECT CODE : camera.dba
************************************************************


Shadowfax
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 30th Jan 2003 15:33
PS love the Gir gif

Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 30th Jan 2003 16:04
certainly interesting looking at it...
i mean no not really true OOP because really you're not programming with the Objects, as Ian said a system.

But a system is still better than none, and with a pre-compiler interface on the front of the code to convert it to DarkBasic Pro code like that - i think that it would be very useful.
I think perhaps if you could continue developing the system Shadowfax, i could see about making support for it within Ciyanna as i'm going to be rebuilding it soon from scratch this time specifically for DarkBasic Std/Ehd/Pro
probably could put a front on that which ressembles C++
would certainly give users alot more creating power

wonder if it would slow the system down though when you go into more complex structures - hmm just have to see eh

Anata aru kowagaru no watashi!
Kale
22
Years of Service
User Offline
Joined: 8th Sep 2002
Location: United Kingdom
Posted: 31st Jan 2003 02:57
real OOP is impossible with DPPro, there is no way to encapsulate data and member functions into 1 object also there is no re-use/inheritance possible with using just UDT's, so therefor no OOP! ...Which is OK by me i like basic, basic.

What the flame does not consume, consumes the flame.
------------------------------------------------------------------------
AMD XP2100+, Geforce4Ti 4400, 512Mb DDR, Abit KX7, WinXP Home
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 31st Jan 2003 18:39
what do you mean Inheritance/Reuse of Types?
and no the point we've outlined is that this isn't Real OOP however if given a language front, then it would give the illusion and functionality to the same extent

it's certainly possible, and no one would force you to use it... I'm quite happy to add this as a feature of the Ciya language which is pretty similar to C++ in structure

a small sample of what its like



and the original DarkBasic Professional Code



the layout of Ciya was to accomidate C/C++ because there are a few features that the types, structures, loops and subs allow which are not truely possible within Pro or Blitz.

So really this would be an upgrade not on the DarkBasic language but the recoding abilities of Ciya
your choice to use it. I mean in Ciyanna i hope to give the users the ability to code in one OR the other language.
And as this new version (gameEditor DBS) is going to ONLY be for using with the DarkBasic products, it means that it'll give the users the ability to code in a style which is preferable

you'll be able to not only use DarkBasic as the next step by use Ciya as a literal stepping stone to understand how you go from a basic language to a more complex one like C++

however it is keeping more true to the Basic routes - more of a simple evolution

Anata aru kowagaru no watashi!
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 31st Jan 2003 18:56
just out of interest ... notice this ->

// << DO NOT DELETE >>
enum return 255
{
float f_
int i_
char c_
}
// << DO NOT DELETE >>

the ENUM setups up an ever expandable memory pointer which allows you to export upto 255 variables through functions, as the language limits you to either f_ i_ or c_
float, interger or string exporting (which must preceed the variable) this saves declaring it within the function, and added with the | "pipeline" feature allows you to export as many resturns as you choose

to call it on externally you then use

return = f_return.get <- testfunction()

the f_ means its a float and you replace return with the name, which is used by the pointers

unfortunately any of the functions you process are done globally, so once you use the .get to grab it from the function - it is edited globally and becomes a fully fledged variable rather than a simple pointer.

the ENUM structures are different to the TypeDef structures, as they are setup more as constant values - but when you use the return feature which actually pointers the memory you can only return 1 of them based on the type of that ... really you could have as many dimension levels as you like basically an infinate ammount of types on types - but to keep it easier i set this to a single type, so after the enum type you can't actually type any futher it has to be a normal type.

there is another new type called a BitType which allows you to setup value and save as a single value ... you're allowed these as the Enum types too



so in other words you could effectively setup 3 types for something like



with that you can now determin a v3_ or a v2_ simply by typeing them ... i mean all it is really is an extension onto DarkBasic Pro's features - but with OOP Structures would make it alot better

Anata aru kowagaru no watashi!
SoulMan
22
Years of Service
User Offline
Joined: 22nd Nov 2002
Location: In a house somewhere on the planet earth
Posted: 31st Jan 2003 22:38
It would have been nice if they had OOP right from the start.
I love working with objects. It just makes more sense to use them.
Anyway, hopefully we will see some sort of OOP in the near future.
I would at least say functions for types and the allowing of passing types to functions.
That would be very nice.
SoulMan

I am my own and own my am I
Richard Davey
Retired Moderator
23
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 1st Feb 2003 02:43
"It would have been nice if they had OOP right from the start."

Then it wouldn't have been DarkBASIC. More like DarkPROLOG or something (*shudders*)

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
SoulMan
22
Years of Service
User Offline
Joined: 22nd Nov 2002
Location: In a house somewhere on the planet earth
Posted: 1st Feb 2003 03:40
What?
All I am saying at least let the types have functions.
That would give us some level of OOP.
SoulMan

I am my own and own my am I
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 1st Feb 2003 03:55
functions and arrays within the types would be cool

but types should be left as types (possibly with Arrays)
and leave the functions to structured types ... i don't think most people would understand what to do with structures around here though.

I think that is perhaps a move best left for when the language evolves again in around 2-3years time ... becomming its own language rather than a basic interface to something else

I always was partical to the name DarkBay or perhaps even just Bay ... would be a sweet name for a language
Sorry just one of those nights when your trawling through technical specifications and trying to understant them

If Shadowfax is willing then i'll be happy to incorporate this within Ciya, and as i said would give everyone just that extra level to program on

i'd love to see true open end Arrays rather than Stack and Ques - they are a little redundant not allowing the data to be accessed anything other than sequentially

Anata aru kowagaru no watashi!

Login to post a reply

Server time is: 2025-05-17 23:46:14
Your offset time is: 2025-05-17 23:46:14