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 Discussion / Time for us to take over where the developers left off...

Author
Message
BN2 Productions
22
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 25th Feb 2008 03:01 Edited at: 6th May 2008 08:24
I have had this idea for a while now. It appears that The Game Creators have all but dropped DBC, coming out with cool additions to DBP like physics and ai. My thought is, we, the users of DBC should pool our knowledge and come out with functions that would imitate common features in games including controls, physics, ai, weather, etc. That way there is a free version of these fancy dbp upgrades available for all DBC users as well.

Before you flame me for just trying to steal others' work, I would just like to add that I would be submitting my own work as well. I may not be an awesome coder, but I think I could contribute. And thats what this thread is all about, pitching in your two cents and helping everyone out.

Anyway thats my thought. Tell me what you think or post some of your commonly used functions.

[Edit]
Wow guys thanks for the support. Instead of a messy thread, email your functions to [email protected]

Please put it in a .zip file with the .dba file and a .txt file explaining what it does and how to use it.

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 25th Feb 2008 03:19
Good idea
We could build a pretty awesome community function library!

Here is the first function: a very simple and useful function.
It rounds real numbers to the nearest integer (which DB doesn't do).

I don't care if others use my code, I actually quite like it, as long as they give me credit for my work.
Practising what I preach: I have to give some credit to Latch for speeding this function up by suggesting I dump the Int() commands that were in place before.

BN2 Productions
22
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 25th Feb 2008 03:40
Here is my basic library of functions. I made most of these cause I was tired of copying and pasting the same code, or typing object position x(), object position y()+1, object position z() just to move the object up 1.

The list is:
1. xposobject(OBJECT NUMBER, COORDINATE VALUE#)-Positions an object on a specific x value, keeping the other coordinates the same
2. yposobject(SAME)-same but only moves on the y axis
3. zposobject(SAME)-guess
4. campos(OBJECT NUMBER)-positions the camera at an object position
5. point_camera_at_object(OBJECT NUMBER,Y AXIS DIFFERENCE VALUE#)-rather self explanatory
6. control_object_with_keys(OBJECT NUMBER, STEP SIZE, ANGLE OF TURNING)-basic controls for an object
7. cam_move_with_keys(STEP SIZE, ANGLE OF TURNING)-allows the camera to be controlled with the keys
8. point_object_at_camera(OBJECT NUMBER,Y AXIS DIFFERENCE#, SINGLE AXIS ROTATION FLAG)
9,10, and 11. xposcam, yposcam, and zposcam(POSITION#)-just like the posobject commands.


Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 25th Feb 2008 08:09 Edited at: 25th Feb 2008 08:15
Before getting nuts with posting a series of functions, BN2, since this is your "baby" so to speak, why not comb through the huge list of code snippets and the code base and put together a huge comprehensive library or libraries of functions that have already been done and offered to the public domain. You may even ask some of the community to help and hunt for specific types of functions or code snippets so that the same thing isn't reiterated over and over.

There's already a HUGE assortment of really great functions and methods for DBC, but they aren't organized and put in one place. There must be 100s of height map and terrain editors, paint programs, texture makers, physics demos, win api stuff. But it's all scattered throughout the forums.

And to keep a thread like this organized, instead of posting a series of individual functions per post, manage an off forum database of all the functions divided into libraries and provide a single link or download to the libraries. If individuals want to submit their functions, they can send them to you via email or by posting to a dedicated ftp or something. At some regular time interval, you provide an update to the link or a download of all the libraries - organized and labeled and ready to go.

Just a thought.

Enjoy your day.
Link102
21
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 25th Feb 2008 14:31
agreed

I was thinking the same thing, when I read OBese's post

Dark Dragon
19
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 25th Feb 2008 18:12 Edited at: 26th Feb 2008 02:12
Hey! I Try to do some thing Simular With DarkAIFORDBC a While Back, But Its still in it's early stages...

I Think this libary idea is Great!!(Man! Theres no Tony The Tiger!)

Maybe everyone can create a function for this,contribute it, and in time I bet this will be a sticky or it might even get it's own forum page (DARKBASIC CLASSIC FUNCTION LIBARY).



A clickible button Function:


(EDIT)
@TDK
Heheheh....

TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 25th Feb 2008 19:51
Dark Dragon

Edit your post right this minute and indent that code snippet!

It looks terrible.

TDK_Man

Dark Dragon
19
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 25th Feb 2008 19:57
I'm Gonna Get Some more Functions together.
I'll Post When I find some..
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 26th Feb 2008 00:55 Edited at: 26th Feb 2008 00:56
The distance between two objects



Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 26th Feb 2008 01:16 Edited at: 26th Feb 2008 01:17
I think Latch is right, and I forgot about the snippets board
It would be wise to post your functions there and put "[DBC] Function: Title" as the title or something that shows it is a function. remember to put [DBC] at the start of your title

BN2 could even post a call-out post on the snippets board asking for people to search for useful functions, or are we the only ones still using DBC?

If this takes off we will need to form some sort of committee that decides on what should be added and in some cases what should be taken out (if a new function out-performs an older function at the same task). I am willing to chair that committee as I thought of it , JK
How do you guys think we should go about deciding which functions will make up the library?

TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 26th Feb 2008 02:13
Quote: "(EDIT)
@TDK
Heheheh....

+ Code Snippet

NEVER!"


OK, have it your way...

TDK_Man

Dark Dragon
19
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 26th Feb 2008 02:22
Quote: "How do you guys think we should go about deciding which functions will make up the library?"

Maybe the "Chairmen" can keep a List or something. Then every so often He(Or She) can release the libaray as a .txt or .dba.
BN2 Productions
22
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 26th Feb 2008 03:55
Quote: "Then every so often He(Or She) can release the libaray as a .txt or .dba."


My original plan was to compile like functions into libraries and have them listed and available for download on this thread, I do like OBese's idea of a committee to keep it organized, so that it doesn't become cluttered, outdated, etc. Personally, I don't really want to be chairman, I wouldn't have the time to do it justice really. If a committee is formed though, I will take part.

Just an idea, perhaps we could edit the DBC help files (they are only html's) to include info about the new functions we add as we release the libraries.
Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 26th Feb 2008 18:30
Quote: "Just an idea, perhaps we could edit the DBC help files (they are only html's) to include info about the new functions we add as we release the libraries."

That's a good idea but I think we should keep them separate from the actual commands. In their own sub-menu.

Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 26th Feb 2008 20:10
Quote: "OK, have it your way... "


Ooooh, that was EVIL TDK.

Lee Bamber - Blame Beer
gearce
19
Years of Service
User Offline
Joined: 18th Dec 2006
Location: ex SCOTLAND, now MELBOURNE, Australia
Posted: 26th Feb 2008 23:26
Would this be just for functions?

gearce
(GRC)

LANG MEY YER LUM REEK

The future depends on what we do in the present.
Link102
21
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 26th Feb 2008 23:47
here's the latest version of my button:



Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 11th Apr 2008 20:00
Hows this working out?

Enjoy your day.
Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 12th Apr 2008 17:56
I'm gonna keep working on some useful functions

BN2 Productions
22
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 1st May 2008 05:08
Here is a function I made that will store the locations of all the vertices of an object into 3 arrays(for each axis). Tried to comment as much as possible so that people can see what it does and how to use it, probably overdid it though


Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 1st May 2008 15:35
This function will return the distance between two objects:



How to use:
dis#=get distance(player x, player y, player z, enemy x, enemy y, enemy z)

With this you can calculate where the nearest enemy is

Oooooops!!! I accidentally formated drive c.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 3rd May 2008 22:17
Here are my new objects!

Pyramid, Prism, Diamond, Capsule, Tree, Disk(No, I didn`t scale a cylinder 100,0,100)

How to use:

First, you have to include the functions into your program:

#include "objects.dba"

Note that the file "objects.dba" has to be in the same directory as your program!

Create object Pyramid(object,size,sides,flag)

Object=object number
Size=size
sides=3 to 4 sides
flag= if 0, your object will have limbs, if 1, your object will have no limbs

Create object Prism(object,size,flag)

Object=object number
Size=size
flag= if 0, your object will have limbs, if 1, your object will have no limbs

Create object Diamond(object,size,stretch,flag)

Object=object number
Size=size
stretch= if 0, your object will have 8 identical sides, if 1, your object will be stretched
flag= if 0, your object will have limbs, if 1, your object will have no limbs

Create object Capsule(object,size,type,flag)

Object=object number
Size=size
Type= if 1, your capsule will have rounded ends, if 2, your capsule will have pointed ends
flag= if 0, your object will have limbs, if 1, your object will have no limbs

Create object tree(object,size,cones,flag)

Object=object number
Size=size
cones=The number of cones on top of the trunk
flag= if 0, your object will have limbs, if 1, your object will have no limbs

Create object Disk(object,size,polygons,flag)

Object=object number
Size=size
polygons=The number of triangles shaped into a circle
flag= if 0, your object will have limbs, if 1, your object will have no limbs

Have fun!

(File attached)

TheComet

Oooooops!!! I accidentally formated drive c.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 3rd May 2008 23:34
This function will return the object colliding with the mouse as an integer. This function is great for selecting objects in your model maker, or selecting actually anything in 3 dimensions!

It`s pretty simple to use: All you have to be aware of, is to put a rotating collision box around that object. Thats all!

make object collision box (object),0-(sizex/2),0-(sizey/2),0-(sizez/2),sizex/2,sizey/2,sizez/2,1

File attached

TheComet

Oooooops!!! I accidentally formated drive c.
Jeff032
18
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 5th May 2008 08:15 Edited at: 5th May 2008 08:15
Quote: "The distance between two objects

+ Code Snippet
function GetDistance(object1,object2)
a#=abs(object position x(object1)-object position x(object2))
b#=abs(object position y(object1)-object position y(object2))
c#=abs(object position z(object1)-object position z(object2))
distance#=sqrt((a#*a#)+(b#*b#)+(c#*c#))
endfunction distance#"


The abs() is unnescessary because you are squaring the value afterwards.



TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 5th May 2008 17:23
Quote: "The abs() is unnescessary because you are squaring the value afterwards."


I don`t recall using the abs() function in my function... Could you please point that out?

TheComet

Oooooops!!! I accidentally formated drive c.
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 5th May 2008 22:54
It's not yours TheComet, it's in another distance function by Ortu earlier on in the thread.

And to reiterate a point:
Quote: "And to keep a thread like this organized, instead of posting a series of individual functions per post, manage an off forum database of all the functions divided into libraries and provide a single link or download to the libraries. "


Enjoy your day.
Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 6th May 2008 01:24
don't post functions here guys.
I'm gonna buy a laptop soon, I can't take it anymore!
Wish I could be more involved.

It is far better to complete a 10 line program than to start a 10,000 line program.
BN2 Productions
22
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 6th May 2008 08:23
Quote: "And to keep a thread like this organized, instead of posting a series of individual functions per post, manage an off forum database of all the functions divided into libraries and provide a single link or download to the libraries."


Yeah, I have been working on that, sorting all the functions posted. I have also set up an email address for you guys to email the functions to. Since I don't really have time to really run an off forum website, I will periodically post the latest versions of the libraries on the forums so that everyone, not just those who read this thread will be able to get them.

So from now on EMAIL ALL FUNCTIONS TO: [email protected]

BTW, if you have already posted one, don't email it to me, I already have it archived.

Please send the functions in a .zip format. Inside the zip, include the .dba file and a text file explaining what the function does and how to use it. You can also explain how it works if you want. The plan is that the function libraries will come bundled with html help files that can be integrated into the standard dbc help system (still need to try this out, but it should work).

Again, email is: [email protected]

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?

Login to post a reply

Server time is: 2026-07-07 09:50:59
Your offset time is: 2026-07-07 09:50:59