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
Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 9th Feb 2007 04:52 Edited at: 17th Apr 2007 05:53
Object Oriented DBP
(Last Updated: 16-4-07 (d-m-y))

** Next release will be the first beta **

In short, this is my small (doesn't seem so any more) yet ambitious project to write a precompiler for dbp that will allow for object oriented programming with the dbp language. This project will be open source. The project was started in dbp, but after the third alpha I began re-coding it in c++ for more efficiency. The first beta will be the first c++ coded release.



News
The beta is nearing completion and I will be needing beta testers by the end of this week to help me iron out any bugs. If you are interested in helping, please constact me through email. The next release, along with source code, will be within two weeks if everything goes well. All three major aspects of oop coding will be supported: encapsulation, inheritance, and polymorphism.

An up-to-date list of all oodbp commands/keywords:




The Current Release:

The current release is alpha 2. It includes precompiler functionality (for the default ide only), so you can compile classes directly in your ide (a keywords file is included). Several other features are present too. There are a few known bugs, which will be ironed out in the recode for the beta release.

OODBP alpha 2

Here is a list of current commands:





Progress Log:





Objectives:

( = completed / = in progress / = someday / = may drop support / = buggy )

full comment support
full command stacking support
multiple source file support
#constant support
#enum support
editor keywords file
automatic installer
compile time error reporting
compile time error logging
precompiler functionality
third-party ide support
'this' pointer implementation
static methods in classes
static variables in classes
static arrays in classes
smart memory fetching
methods in classes
exitmethod command
constructors/destructors in classes
variables in classes
arrays in classes
inheritance functionality
polymorphism functionality
multi-dimension arrays in classes



Known Bugs/Problems:

( = fixed / = in progress / = not started)

recoding, so no bugs yet



Conclusion:

I'd like to know what you think about my project, so constructive criticism, advice, or ideas are welcome. If you encounter a problem or a bug, please let me know. Special thanks goes to IanM, whose exellent dlls made this possible.

Who needs a signature?

Attachments

Login to view attachments
Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 9th Feb 2007 15:31
A precompiler that makes so you can write object oriented code in DBPro made in DBPro. Very interesting. I think I'll follow this project. Keep up the good work.
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 9th Feb 2007 19:22 Edited at: 9th Feb 2007 19:23
Sounds cool!

Could you show us what the above code looks like post-precompilation?

I'd be very interested to know how you'd turn it into DBP code

Edit:
If it can already do this much, how about a demo?

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 9th Feb 2007 22:28
I love you,but in the non-gay kind of way. This is truly amazing. Like,this would make my job in dbp so much more barable,and due to this,you could probably make plug-ins easier depending on how it is all set up. Or not. But its still amazing. Can't wait to use it,you must be a genious to get this to work though. As soon as you release it I'm going to use it like crazy dude,you have no clue how much in love I am with oop.

Hello
heartbone
22
Years of Service
User Offline
Joined: 9th Nov 2002
Location:
Posted: 10th Feb 2007 01:40
Crazy man.

I'm unique, just like everybody else.
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 10th Feb 2007 02:12
Yay!

Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 10th Feb 2007 03:50 Edited at: 10th Feb 2007 05:46
Quote: "Could you show us what the above code looks like post-precompilation?"


Sure, here's what my example code (minus the comments) looks like run through the first alpha precompiler (yes, there is much redundancy, I've still got optimization to do):



Now I'll go ahead and upload the alpha for everyone to test out

[edit] OODBP alpha 1 uploaded

Who needs a signature?
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 10th Feb 2007 05:54
so this is all in dbp code?

Hello
Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 10th Feb 2007 06:00 Edited at: 10th Feb 2007 06:29
yes, all dbp code and one external plugin: IanM's utility dll

Who needs a signature?
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 10th Feb 2007 09:44
What happens when you get a compiler or runtime error? won't the error lines be offset by quite alot?

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 10th Feb 2007 11:42
What about adding a precompile log which stores a list of line numbers, and a list of post-compilation line numbers, so that you can get the error numbers from the compiler, and look them up in the log to get the real line numbers.

Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 10th Feb 2007 18:08
Quote: "won't the error lines be offset by quite alot?"


Actually, the line numbers are preserved while passing through the precompiler, so no worries about that

Test out the alpha to see what I mean.

Who needs a signature?
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 10th Feb 2007 18:54
Quote: "you must manually destroy your objects after you are finished with them. "

so if someone alt+F4ed out of your program would there be some memory left used up? or does windows take care of that when you close your program

anyway, this looks really nice, if it doesn't create any significant performance hit i can see it being very useful.

One man, one lawnmower, plenty of angry groundhogs.
Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 10th Feb 2007 19:08
If the program is suddenly closed then windows will take care of all used memory. You would run into problems if you were constantly creating new objects (even if just within functions) and not deleting them in your code.

Glad you mentioned the performance hit. That's something that I've got to test, but I don't think it should be significant.

Who needs a signature?
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 10th Feb 2007 19:16
ok, that's not bad at all, because it's not too hard to remember to clean up after yourself (i mean, if you're already doing it with 3D objects should be hard to add code ones eh? )

One man, one lawnmower, plenty of angry groundhogs.
Baiame
18
Years of Service
User Offline
Joined: 8th May 2006
Location:
Posted: 10th Feb 2007 20:15
I know I haven't been around here for a while, but I just want to express my interest in this project. I've been getting more and more experience with C++ and Java as time goes on. I find that the language itself isn't too hard, but that the third-party libraries are tough to use.

I've also found that DBP's rendering engine is actually relatively fast, and I love the API. The main reason why I switched was the lack of OOP. Good luck with this project, Milkman.
Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 11th Feb 2007 01:54
OOP!

Finally. I'll be bookmarking this page.


Cheers,

-db


"There's no such thing as a stupid question, just stupid people."
Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 11th Feb 2007 15:21 Edited at: 11th Feb 2007 15:23
This is nice. I did a little game, to test it. And it works just fine. Code:

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 11th Feb 2007 21:45
wait...how are you using it already?

Hello
Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 11th Feb 2007 22:03
@Mr X: Glad to hear you got it working

@Benny53: I uploaded the first alpha so people could try it out, look at my first post. It doesn't work in between the ide and the compiler yet, but you can use it stand alone to convert code, paste into the editor, and then compile.

I'm making progress, and i hope to have the second alpha out by the end of today. It will support strings, static arrays, and dynamic arrays in classes Also, it will be fully functional as a precompiler! After i release the second alpha, I'll be posting a short tutorial on syntax and how to actually use this for those who don't know yet. Check back soon.

Who needs a signature?
Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 11th Feb 2007 22:17
Once again this is awsome!

Keep up the good work.

Cheers,

-db


"There's no such thing as a stupid question, just stupid people."
empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 11th Feb 2007 23:11
Don't get me wrong, you've done a good job on the parser, but I really don't see the usefulness of this. But apparently others do, so ignore my comment and keep on working!

Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 11th Feb 2007 23:43 Edited at: 11th Feb 2007 23:46
My OOP parser provides a few benefits:

1) It helps you organize, structure, and encapsulate your code, while providing some OOP functionality. I say 'some' because I know it doesn't completely support OOP, as it does not support inheritance or polymorphism (yet).

2) You don't need to mess around with global data structures, as you can have truly local variables and arrays for multiple objects within class methods. Also, the methods themselves can be considered local to their own class, as they can share names with methods from other classes.

3) You can have arrays in classes, which is comparable to having arrays within types in standard dbp. This can be very useful in a variety of situations.

4) You can return objects from functions. I've heard many people complain about not being able to return types from functions, but now you can.

These are the main benefits that OODBP provides right now, although you may or may not see them as necessary. Thanks for bringing that up though, as others might be thinking the same thing

Who needs a signature?
empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 12th Feb 2007 00:02
Yes, the encapsulation it provides is obvious and certainly a benefit, but also possible (and IMHO equally elegant) without OOP. But I see a "not _yet_" behind your inheritance and polymorphism statement. I personally see the latter as the only big advantage of OOP (in combination with the other two elements).

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 12th Feb 2007 00:23
wait...so you make the oop and it then converts it to standard code...so then,like,thats not truly oop,unless the final version will allow you to compile:
class

member bleh
endmember

endclass

or something like that. Or will you be able to in the final product? Or will it keep commenting the stuff out so it is never truly oop?

Hello
Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 12th Feb 2007 00:34
In the final version, you will be able to write classes directly in your ide and compile them, so in that sense, it's oop. True, once it goes through the precompiler it's no longer oop code, but if you look at it like that, then no language is actually oop. Every language eventually turns your code into sequential machine language instructions, whether it was oop to begin with or not...

Who needs a signature?
tiresius
22
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 12th Feb 2007 02:36
This sounds pretty neat, but wouldn't this make debugging your code a nightmare (unless you use trap file logging)? Also, all the error lines reported for runtime errors would also be way off... even more way off than they are right now.

I'm not a real programmer but I play one with DBPro!
Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 12th Feb 2007 02:49
Error reporting/logging is definitely something I need to work on and something that will be included in the beta/final releases. The error line number problem was brought up earlier in this thread. It won't actually be a problem at all since all line numbers are preserved during precompilation, thanks to command stacking

On a separate note, the second alpha is nearing completion. If it is not uploaded tonight, it will be tomorrow.

Who needs a signature?
Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 12th Feb 2007 09:46
Second alpha released any day? Nice. Looking forward for it.
Red Ocktober
20
Years of Service
User Offline
Joined: 6th Dec 2003
Location:
Posted: 12th Feb 2007 13:25 Edited at: 12th Feb 2007 19:40
great stuff M... this may be one of the most significant developements for DBPro...

as for anyone who hasn't discovered the joys of object oriented programming... well, think of it as a whole different approach to thinking about how you make your games... a different mindset...

think objects now... not functions...

it will require a lil more on the planning side... you'll have to first think of what objects your game will need before you rush and start wildly coding...

this will, in turn, lead to better organized and more managebale code... and easier to understand logic...

again... GREAT STUFF!!!


--Mike
Baiame
18
Years of Service
User Offline
Joined: 8th May 2006
Location:
Posted: 12th Feb 2007 20:33
I didn't notice when I first posted that it doesn't have inheritance and polymorphism (yet). IMO, encapsulation alone doesn't make OOP, but I can still see the benefit of this release. Keep up the good work!
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 12th Feb 2007 21:23
alright,if you'll be able to compile classes directly in your ide its good stuff. I was getting worried that you couldn't for a second.

Hello
Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 13th Feb 2007 03:38 Edited at: 13th Feb 2007 04:33
After much work (and wrestling with the DBP compiler ), OODBP alpha 2 is finished. It functions as a precompiler, so you can actually compile classes in your ide now I've included an automatic installer with it, so you don't have to worry about where to put what files. Just download the rar, unzip it, and read the readme. I need to know about any potential problems with the alpha 2, so please post here with your experiences if you've used it. Thanks.

Link is here.

On a separate note, I've decided to add support for inheritance and polymorphism! I've added these objectives to the list in my first thread. Don't expect these features to be completed any time soon, but they wil find their way into the beta and final releases, no doubt. Also, I'm considering dropping support for multidimension arrays, as I don't see a use for them and I don't want to code support for them for nothing. Let me know what you think about this. I'm open for any feature requests at this point, so speak up!

Who needs a signature?
Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 13th Feb 2007 04:15 Edited at: 28th Feb 2007 05:48
Double post on my own thread, heh

Anyways, this post is meant to be a small tutorial on the syntax of OODBP and how to use it. Eventually, this may evolve into the OODBP documentation.



Use

The first thing to realize about OODBP is that once installed, you do not have to use the oop functionality at all. Any standard DBP code will compile just fine with OODBP installed, so you don't have to worry about being forced to use oop. Also, you can use the oop functionality and standard dbp functionality jointly.


Concepts

With OODBP, instead of creating udts to hold your data, you create 'classes'. Similarly to udts, you can have many different classes of different names, each with their own unique set of variables. Classes, on the other hand, can also have their own unique set of functions, or 'methods'. These methods are only accessible through the classes in which they were created. Also, arrays can be defined within classes, a feature that udts do not support.

Like udts, you can declare a variable as a class type. When you do this, you create an 'object'. Objects can be passed into and returned from functions and methods, and can also be directly equated. When equated, however, two objects become one and the same; modifying one object modifies the other. This is because objects are passed by reference (a way to avoid this will be explained later). Arrays can also be declared as a class type, so you can create arrays of objects. One difference between udts and objects is that objects must be manually destroyed once you are completed with them, to free up memory.


Syntax

[edit] removed, because of syntax changes

Who needs a signature?
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 13th Feb 2007 12:04 Edited at: 13th Feb 2007 12:23
Why no support for multidimensional arrays?!!

Also, jagged arrays would be SO useful!

PS:
OODBP... Amazing


edit:
I get an error which says: Runtime error 8003 : Could not find path at line 200
This is whenever I compile something with codesurge after installing this

Red Ocktober
20
Years of Service
User Offline
Joined: 6th Dec 2003
Location:
Posted: 13th Feb 2007 12:42
i could live without inheritance and polymorphism... at least at the point of initial release... games could be made without these capabilities... the ability to create objects and methods alone would be a great improvement over the procedural BASIC we have now...

support for multidimensional arrays might be worth keeping... some people might find em essential...

getting a solid release with the essential base functionality would seem to be a direction to pursue first... then, step by step, add in what you think is best...

--Mike
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 13th Feb 2007 13:09
When are you thinking of releasing the source?
At the moment, there are a few bugs in it, such as when you define an array as a class, and I hate not being able to do anything about it, or even see what's going wrong

Also, it only works for the default editor

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 13th Feb 2007 16:09
ok,whenever I try to compile it opens like 20 DBPCompiler.exe things...like,that was terrible what it did to my pc...killed it for like 5 minutes...no fun

Hello
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 13th Feb 2007 21:32 Edited at: 13th Feb 2007 21:45
Do you think you'll ever have it to where you can have a class declared like so:


then you coudl go like:


Like,I wanna run my functions through my declared object,or is that just impossible?

EDIT
I think I found a slight bug. With the compiler,when I give it this code:
It gives me this code :


And so when I use alpha 2,its saying the type cannot be found(because it is writing DWORD2). So I thought I'd inform you of this. This is really great once you install it right though,hah

Hello
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 13th Feb 2007 23:16
It doesn't work properly for me
How usefull it would be

Where are you Milkman?

Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 14th Feb 2007 00:03 Edited at: 14th Feb 2007 05:16
I'll try to respond to all your posts individually.

@Diggsey: I don't really see why multidimension arrays would be necessary (within classes), as you can now have single dimension arrays within single dimension arrays. You can still have multidimensional arrays, just not in your classes. As for jagged arrays, you can make your own jagged array structures since you have the ability to make arrays within arrays now. I'm sorry that I neglected to tell you that the alpha 2 was only tested with the standarad dbp ide, and it is ide specific. I'll download codesurge and see if i can get it working with that.

@Red Oktober: Yes, like I said, I'm not supporting them now, but sometime down the road I will implement support for inheritance and polymorphism. As for multidimensional arrays, look above. A solid release with base functionality? Yes, definately.

@Diggsey: I will release the source now if you want it, but i had no inquiries for it, so I didn't release it before. Difining arrays as classes works fine I am sure, i just havn't posted the syntax for it yet And yes, I know it might only work with the default ide, like i said above, i'll have to test it with others.

@Benny53: That's a very strange thing to happen... Can i have more details? Like which ide you were using, your source code, ect.

@Benny53: Yes, you already can pass parameters into constructors That bug you posted is just that, a bad bug. Thanks for calling it to my attention, I'll fix that ASAP.

@Diggsey: What exactly won't work? Which ide are you using?

And to all: I'm working on some bug fixes and I'll release the third alpha sometime today [or tomorrow]. No new features will be included, and the standard ide will still be the only one currently supported. Also, I'll add more explaination of syntax to my post above.

Who needs a signature?
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 14th Feb 2007 00:11
I never had a problem with passing parameters to constructors. And with my other thing,I already posted the full source(that was the full source). But I have come across something else,when I have two files,and one with a class declared in it like :
class.dba


and core.dba


it will say it cannot find a certain file(which I have no clue what its talking about). So I'm only assuming it can't compile multiple files...is there any way around that(besides putting all the stuff in the same file)?

Hello
Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 14th Feb 2007 00:37 Edited at: 14th Feb 2007 00:43
With your source that you posted before DBPcompiler was opened 20 times? I see no reason why it would be called more than once, and it's the ide's job to call it, so that seems unlikely. Either way, i'll look into it.

How were you including your extra files? With the #include command or within the ide? I'll look at that too. Thanks for letting me know about what bugs you encounter.

[edit] Oh, i see what you mean about accessing your methods through the object now. I looked into that when designing the syntax, and i don't think it will ever happen, because it would require the parser to track declared objects. Sorry, this is just one of the differences that will exist between real oop and oodbp.

Who needs a signature?
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 14th Feb 2007 02:09
ah thats ok man,this thing is still pretty amazing. Yeah,I didn't quite install oodbp right the first time,so it kept opening the DBPCompiler over and over and over. I tried including the files in the ide and with the #include command,and it doesn't work with any of that. I can keep telling you about bugs if you want,but so far this seems like a great thing that will help me.

Hello
hyrichter
20
Years of Service
User Offline
Joined: 15th Feb 2004
Location: Arizona
Posted: 14th Feb 2007 04:12
@Milkman,
I haven't actually downloaded this to try it out yet, but feel free to contact me on getting this to work with CodeSurge. Enough people are now using CodeSurge instead of the default that you definitely need to support it. I'll be downloading this later tonight to play around with it and see what might need to be done to CS to make it work.

Good performance is better than a good excuse.
CodeSurge -- DBP Editor for serious programmers.
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 14th Feb 2007 11:47
Thanks

If you don't mind releasing the source, that would be great!
(It would save you a whole lot of questions about how stuff works too)

Steve J
18
Years of Service
User Offline
Joined: 22nd Apr 2006
Location: Vancouver, Washington
Posted: 14th Feb 2007 17:03
@Milkman: You...give...me....the...urge...to....program an rts......

Seriously great work, sounds like this is a PHP 4 styled OOP, but it still works for me imo=D. I really like its design. Perfect for rts games. Inheritance would help though..

Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 14th Feb 2007 19:28 Edited at: 15th Feb 2007 03:46
For Diggsey, and others, here is the current source (note that this is not the alpha 2 source, it has some bug fixes):



Major changes are coming in the way that class variables are loaded and stored, so this will be out of date soon.

[edit]
I won't be releasing the third alpha like i said i would, as I've decided to recode some of the file parsing and file loading/saving from scratch. I will release the alpha 4 in several days instead, and it will include many bug fixes as well as full comment support and support for codesurge. I will be adding more to the syntax explanation during this period.

Who needs a signature?
Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 15th Feb 2007 09:20
Milkman, this is very nice. I've tested the second alpha (not the source you posted), and it's developing. But it's quite unstable at the moment. Tested some things, and all I got was errors (but my first code works). Looking forward for the next version .

Quote: "I will release the alpha 4 in several days instead, and it will include many bug fixes as well as full comment support and support for codesurge."


YAY!!! Comment support .
Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 20th Feb 2007 19:30
Rather than just releasing another alpha, I've decided to just wait until i get a decent beta, and release that. I'm recoding this whole thing from scratch, so it may take a while.

Who needs a signature?

Login to post a reply

Server time is: 2024-11-24 03:50:24
Your offset time is: 2024-11-24 03:50:24