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.

Work in Progress / Object Oriented DBP

Author
Message
Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 22nd Feb 2007 10:06
Ok. Take your time (an decent beta would be very cool ). Looking forward for it.
Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 28th Feb 2007 04:41
Just posting to keep everyone updated. No, this project is not dead, I'm still working on recoding it in c++ to make it more efficient and such. I'll release the beta, which will include nearly all the features listed in the first post, in due time. A function pointer dll that IanM may release in a few weeks is the lifeline for polymorphism in this project, so cross your fingers for that. I'll try to keep this thread updated.

Who needs a signature?
Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 28th Feb 2007 05:21
Hows the C++ portion going?

Would you like the source code to the WinGUI to help with the interface?


Cheers,

-db


Enter my forums here.
Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 28th Feb 2007 05:43
The C++ programming is going fine as of right now, thanks. The source to your plugin could actually be quite helpful if i decide to include a gui, so i don't have to mess with the win32 api stuff directly. I'll send an email to you.

On another note, I've changed the syntax slightly, and you will now be able to call objects' methods by simply using the dot operator
For example:


Who needs a signature?
Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 28th Feb 2007 06:37
Very nice.

Im glad to see that this much needed program is coming along nicely.


Cheers,

-db


Enter my forums here.
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 28th Feb 2007 23:33
ok,finally you are doing it the oop way. I'm thinking this may actually be true oop soon. Good choice to move to c++ It can do that type of stuff alot easier. Any chance you'll release the c++ source ever? Cuz you could probably learn alot from it

Hello
Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 2nd Mar 2007 12:35
Nice too hear progress. Can't wait until the beta is released. Keep up the good work.
Nabil
18
Years of Service
User Offline
Joined: 19th Dec 2005
Location: Germany
Posted: 5th Mar 2007 06:29
... just a request: please add to the installer, when you are at it, if the user wants to rename the compiler or just add your compiler exe to that dir. (DBPmC woud require it for example)

-Nabil/BananaAcid- The Banana has you...?!
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 5th Mar 2007 19:42
Milkman, I hope you dont mind some competition, because I thought of a way to do it without the hassle of pointers At the moment, its not ready for a wip post, but I just wanted to warn you

Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 6th Mar 2007 05:09
Nabil: ok

Diggsey: I'd be interested to see how exactly you happened to manage polymorphism in dbpro without function pointers (or massivly nested if statements)

Progress is happening, although slowly, as i'm not the most familiar with c++ and have to learn some things as i go.

Who needs a signature?
Nabil
18
Years of Service
User Offline
Joined: 19th Dec 2005
Location: Germany
Posted: 6th Mar 2007 15:57
can we agree on calling the original compiler renamed to compilerDBP.exe ?
that would easy my coding efforts yeah i know, i happen to be lazy sometimes

-Nabil/BananaAcid- The Banana has you...?!
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 6th Mar 2007 18:45 Edited at: 6th Mar 2007 18:47
I do it like this:

If somebody codes this:



it changes it to:



OOP_ID returns the index for the given subsection of another index.
This information is stored in an array altered be OOP_addvar

Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 6th Mar 2007 19:18
if either of you are including more OOP functionality (such as inheritance) it'd be nice to see uhhh... forgot what you call them... but those functions that you leave blank then only get defined in a inheritated (new word copyright 2007 by me) class.

*was going to give an example but got really confused himself... needs to brush up on OOP*

One man, one lawnmower, plenty of angry groundhogs.
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 6th Mar 2007 22:36 Edited at: 6th Mar 2007 22:37
@Peter H - hm...I also forget what those are called

Hello
Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 6th Mar 2007 22:46
Nabil: yes, that's fine

Diggsey: Yes, it's possible to set up your parser to call functions to set up oop things, but at some point you are going to have to store data. Directly allocating memory and storing object data to it using memory addresses is the most efficient method to do this. Arrays are slow in comparison. Also, the function calls themselves add overhead.

Peter: My precompiler will include support for inheritance as well as polymorphism. The function feature you are talking about is known as function overriding. I'm considering supporting this, as well as function overloading.

School is getting in the way of me working on this, but i'm still trying to do a little whenever i can.

Who needs a signature?
Red Ocktober
20
Years of Service
User Offline
Joined: 6th Dec 2003
Location:
Posted: 7th Mar 2007 13:42 Edited at: 7th Mar 2007 13:42
@ Milkman...
i think what he's talking about is pure virtual functions (methods)... not function overriding...

--Mike
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 7th Mar 2007 17:21 Edited at: 7th Mar 2007 17:22
yeah, that was the name, virtual functions. but it's similar to function overriding (it's just that you had a blank function to start).

One man, one lawnmower, plenty of angry groundhogs.
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 9th Mar 2007 06:44 Edited at: 9th Mar 2007 06:45
<wrong thread>

Tempest (DBP/DBCe)
Multisync V1 (DBP/DBCe)
Turoid
21
Years of Service
User Offline
Joined: 1st Nov 2003
Location: The Netherlands
Posted: 12th Mar 2007 10:00 Edited at: 12th Mar 2007 10:10
This is just awesome.. I just got into cpp with classes and OOP. If this is working as i think it is, thats just so cool!

One question though..

If you want to make a player, and also want to make a 3d object for him, do I have to manage the object numbers myself or are you going to support that too? like each object from a class has automatically it's own object number.

Thanks, downloading soon

[EDIT]
one more question, for example. Will I be able to do this?:



Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 12th Mar 2007 21:11 Edited at: 26th Mar 2007 07:30
Peter: No, virtual functions won't be supported or needed because of the way objects are handled. First of all, derived class methods always override base class methods if they exist. If you cast an object of a derived class to an object of a base class then try to access its methods, the methods you will be using will be strictly of the derived class (unless a method of the desired name does not exist in the derived class, in which case the base class method would be used). Basically, whatever class an object is instantiated from will be the class whose methods are used when the object's methods are called. For example, if you do this:



"ai_bob" would be printed out. There is no way to call the base class method getName() with an aiPlayer object.



Turoid: I was planning on wrapping all the object commands into a nice simple class and including that with the release so you could do something like this:



If i don't end up including the class, you could easily make it yourself.

And yes, you will be able to declare arrays of objects and access methods of those objects by using array syntax.



Who needs a signature?
Turoid
21
Years of Service
User Offline
Joined: 1st Nov 2003
Location: The Netherlands
Posted: 12th Mar 2007 22:41
Thanks for your reply. Very happy with your answer because it's just what I need . I got one problem though, I'm currently at work and just installed the DBP trial version. But it doesn't work with the trial, get something like incorrect compiler version / editor version ? anyway I'm going to try it out when I'm home too bad that it doesnt work already waaa!

Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 13th Mar 2007 00:59
Just keep in mind that the latest released version, alpha 2, is not very developed and doesn't support a lot of features.

Who needs a signature?
Turoid
21
Years of Service
User Offline
Joined: 1st Nov 2003
Location: The Netherlands
Posted: 13th Mar 2007 17:41
Yeah offcourse , I tested it at home and worked. It works slightly diferent than I expected but still very very handy and functional for a faster workflow. Great work!

Turoid
21
Years of Service
User Offline
Joined: 1st Nov 2003
Location: The Netherlands
Posted: 14th Mar 2007 23:27 Edited at: 14th Mar 2007 23:29
Sorry for the double post, but i've been playing around with it for a few hours now. And i've got to say, this really helps programming stuff!

Look here, I made two classes, one for any object I could use in my program. And another for level 'meshes' which automatically do have collision on it using sparky's collision dll. They check automatically between themselves and the other 'object' class.

Here is the code of it without the classes:



And here is a video of what I got with it:
http://forumfiles.thegamecreators.com/?i=1141638

THANKS again for your awesome pre-compiler

Attachments

Login to view attachments
Alfa x
18
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Colombia
Posted: 17th Mar 2007 03:51
I would like to work with you in this project.
Can we work together?.
Drac
20
Years of Service
User Offline
Joined: 10th May 2004
Location:
Posted: 17th Mar 2007 05:31
I must say, this is much easier to use than I first imagined. I still dread that I may one day have to learn C++ or C#, but everything you added thus far is very simple to grasp for a non object-oriented savvy programmer. And what's even better, my dbpro commands work without a hitch. What's not to like? I do hope you get a polished version of this as it could be a great help to the community. At the very least, it can be a stepping stone for those that do not understand OOP.

There seems to be some problems in the posted version when using a method that gets called with an object array if the array index contains data in another object.

ie...



All in all, considering the stage it's in, I'd say that it's not a showstopper, just annoying when you want to get an ID from an object.

Do, or do not. There is no try.
-Yoda
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 18th Mar 2007 22:50 Edited at: 19th Mar 2007 22:51
@Milkman,

Check your email. I've just shipped you the new and improved function pointer plug-in

Please don't distribute for now, at least until I have an official release - it will become a standard part of the utilities plug-in set.

[EDIT]
It did - the latest utils release now contains the function pointers plug-in : http://forum.thegamecreators.com/?m=forum_view&t=85209&b=18&p=0

Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 20th Mar 2007 04:36
Turoid: glad to see you like it so far, keep watch for the beta

Alfa x: contact me through email

Drac: Yes, there are some big problems in the alpha 2. I've rewritten from scratch, so they have been fixed; look for the beta soon.

IanM: I owe you my most sincere thanks. Your release of that plugin really makes oodbp possible and quite capable. Thank you!

Who needs a signature?
Drac
20
Years of Service
User Offline
Joined: 10th May 2004
Location:
Posted: 20th Mar 2007 09:42
I hope to try out the beta as soon as it's released This looks like it's in capable hands.

Do, or do not. There is no try.
-Yoda
Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 20th Mar 2007 10:55
A beta cooming soon? Must have!
Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 8th Apr 2007 07:44 Edited at: 8th Apr 2007 08:05
I'm just posting to let all who are interested know that i'm still working on this, and it's not a dead project. I'm making progress on the beta, albeit slowly.

The downside: it has taken (and will be taking) a while.
The upside: once i do finally get it finished, it will be solid and all the features will be implemented.

I lied about one particular feature, however. There will no longer be any support for polymorphism, due to technical problems. It turns out using function pointers for class methods just won't work, because of variable casting problems. I'm sorry to anyone who was waiting for this particular feature.

Who needs a signature?
Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 8th Apr 2007 16:47
Quote: "The downside: it has taken (and will be taking) a while.
The upside: once i do finally get it finished, it will be solid and all the features will be implemented."


Don't worry. The upside is enough for me to wait for a long time. Keep up the good work.

P.S. I might sound stupid, but what is polymorphism?
Alfa x
18
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Colombia
Posted: 9th Apr 2007 00:50 Edited at: 9th Apr 2007 20:06
deleted. ( @ Milkman: I have a question, when you override a method in a subclass it should adapt it's behavior,so when you call the same method of the superclass it takes the method(behavior) of the subclass so it can do a bark, isn't it? )
Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 9th Apr 2007 04:22
No, that's not polymorphism. Overriding inherited methods and members is supported. Polymorphism is when you call a method of an object, and it responds appropriately according to what type it is, regardless of whether you know what type it is or not. For example, imagine i had a dog class and a cat class that were both derived from an animal class. If i passed a dog object to a function that accepted an animal object and then called object.speak(), i could expect the object to bark. Likewise, i could do this with a cat object and expect it to meow. The function that accepts these objects never even has to know whether they are dogs or cats, and they still respond how they should.

Who needs a signature?
Drac
20
Years of Service
User Offline
Joined: 10th May 2004
Location:
Posted: 9th Apr 2007 13:55
That's a real bummer about the polymorphism, but even without it, it should be a good project. Ever since I looked at this project's alpha 2, I have been learning c++ and I have cooked up a few polymorphic classes. It's one of those things that you don't really need, but when they do help, there is no faster way to accomplish it. Prior to using polymorphic classes what I would have to do is run a select/switch statement for all possible object types, but if there are many types it starts to slow you down with checks.

I do understand about the technical difficulties though and understand why you are dropping support for it. It'll take some ingenuity to figure that one out.

p.s. I am awaiting a beta release eagerly.

Do, or do not. There is no try.
-Yoda
Red Ocktober
20
Years of Service
User Offline
Joined: 6th Dec 2003
Location:
Posted: 9th Apr 2007 13:59
no problem with the lack of polymorphism...

i've been playing around a bit with the last release, and just the ability to make classes and call methods from derived objects are a substantial plus...

this is a good one... BIG THANKS...

--Mike
Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 9th Apr 2007 19:04
Ok, thanks, now I know what polymorphism is. Too bad about it being so hard to do, it sounds very good to have. But, with or without polymorphism, this project is awsome.
Foe7
17
Years of Service
User Offline
Joined: 26th Mar 2007
Location:
Posted: 16th Apr 2007 08:36
Any chance of a delegate system? or is that too related to polymorphism?
Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 17th Apr 2007 04:55 Edited at: 17th Apr 2007 04:59
I'm afraid i don't know what you mean by a 'delegate system' (neither does google), but, as far as polymorphism goes, it's back on the table again. This is because of a method that i previously overlooked, which now turns out to be much more efficient than i once thought. So.. yes, there will be polymorphism.

Also, another syntax change. You no longer have to use 'declaration' code blocks in your classes for variables. You can simply declare your variables right in the class block, just like with types:


Something else about syntax that i don't think i've revealed before is how classes are inherited from. This is how it's done:


More news: I have decided to release wrapper classes for all of dbp's various entities (objects, vectors, images, ect). These classes will be part of the 'oodbp standard library', and will be installed along with oodbp.

One more thing: I will be in need of beta testers this upcoming week, so if anyone is interested, just contact me.

Who needs a signature?
Red Ocktober
20
Years of Service
User Offline
Joined: 6th Dec 2003
Location:
Posted: 17th Apr 2007 14:09
delegate : take a look at Visual BASIC... that may be what he's referring to...

sounds like you're making good progress here...

--Mike
Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 18th Apr 2007 14:41
Support for polymorphism? And classes for the different stuff that's in DBPro? Yay, this is just becoming better and better. Good work, Milkman.
Cave Man
18
Years of Service
User Offline
Joined: 22nd Aug 2006
Location: North Carolina, US
Posted: 18th Apr 2007 20:34 Edited at: 18th Apr 2007 20:37
I can't wait to try this out; my computer with dark basic's been broken since the start of my spring break (worst possible time to break) spring break is over now. Lol. I'll tell you what i think once i get my db comp working again.
Foe7
17
Years of Service
User Offline
Joined: 26th Mar 2007
Location:
Posted: 18th Apr 2007 21:33
Delegate System, A.K.A, a variable that is basically a pointer for a function, or rather, you are able to set up functions (maybe as a class or something) where you first pass it a function, and then when you want to call the passed function, you call another method in the delegate class.

C# uses them, and I think C++ does (at least, Vis. C#/++)
Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 20th Apr 2007 11:43
I would gladly be a beta tester for OODBP.
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 21st Apr 2007 00:30
could you be talking about something like this Foe7?



Something like that? Function pointers?

Hello
Foe7
17
Years of Service
User Offline
Joined: 26th Mar 2007
Location:
Posted: 21st Apr 2007 02:07
Good Explanation:

Quote: "Delegates, delegates are like variables that store functions, and you can add lots of functions to the variables. Then when you call the variable all the functions are run - good heh?"


Horrible Explanation (though it shows sample code):

Here's some code from an example tutorial (written in C#):


This code is a method of the TimeEvent class. The constructor of this class receives a function variable, in the terms of a parameter, and stores it in a delegate:
Quote: "public delegate void Call();public Call call;
...
public TimeEvent(int repeatNumber, float delayToCall, Call c){ call = new Call(c);"

Then when the ExecutEvents() method is called, the method "call" is called, which is a built-in method of the Delegate class (i believe) When this method is called, the function stored in the variable "call" is used.

Code of setting up something in the class:


That's probably not clear...in that case, here's the link:

http://einfall.blogspot.com/2005/02/time.html
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 29th Apr 2007 21:40
Any news on progress, or perhaps... even a demo?

Jack LOL
18
Years of Service
User Offline
Joined: 4th Aug 2006
Location: Near the CPU Close to the graphic card
Posted: 4th May 2007 00:33
Very nice project which will help me a lot in my development.
Also, can u make it to use object names as its identifier like this:



Thanks for a great project



Jack LOL
18
Years of Service
User Offline
Joined: 4th Aug 2006
Location: Near the CPU Close to the graphic card
Posted: 4th May 2007 13:10
Is it possible that functions from the class will use functions from within the class too?
Thanks in Advance



Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 5th May 2007 05:09
Sorry i haven't posted an update on this in a while. Because of school and other things, it's been hard to find time to work on this. When I get a chance, I'll try to finish this up. The project is not dead, it's just a matter of finding time to finish it.

To answer Jack LOL's questions:

Yes, the upcoming version will allow you to access methods directly from an object, like ' object.method() '.

You must always call methods using an object. So, if you want to call a method from another method in the same class, you must use the 'this' operator, which refers to the object that the method was called from. For example:


Hope that makes sense.

Who needs a signature?

Login to post a reply

Server time is: 2024-11-24 03:29:49
Your offset time is: 2024-11-24 03:29:49