Posted: 28th Oct 2003 15:34
I tried the Blitz3D demo and I liked how it handled entities. Here's my library imitating the system. Copy then save it into a file like "obj_library_v2.dba" and include it in your main proggy. Here's an example:

+ Code Snippet
sync on
sync rate 0
autocam off
#include "obj_library_v2.dba"

myPlayer=makecube(4.0)
myEnemy=makesphere(12.0)

move camera -16
yrotate camera 20

ghost object on myPlayer

do

rotation=wrapvalue(rotation+1)

position object myPlayer,0,0,0
position object myEnemy,64,0,64

xrotate object myPlayer,rotation
yrotate object myEnemy,rotation

sync
loop
Posted: 28th Oct 2003 15:45
Nice idea.

I think what would be a great addition though is error trapping. Say you load image function for example, how about making it so that if the file does not exist, it stores an error message in the clipboard - much nicer than DB's own error handling, esp in DBPro where your not always greeted with any error messages at all.


Van-B
Posted: 29th Oct 2003 2:22
wow, either I got an idea from someone, or you read my mind and made this, but I'm working on a library that imitates the BB3D commands and how they work. It returns a nuber to a variable (the specified name) and the last number in the string of numbers specifies what type of entity the specified entity is and handles it accordingly. I've got around 24 functions done, such as LoadMesh, PositionEntity, RotateEntity, TurnEntityLeft (not sure if its a bb3d command, just felt like putting it in there), etc. It has support for objects, lights, camera, and matrices (or, terrains by what BB3D calls them), and I'm making more functions (imitators of BB3D, or useful ones) minute by minute.
Posted: 29th Oct 2003 5:33
I stopped at object creation functions because the rest could be performed with standard DBC functions. I thought it up just last night and finished in half an hour because I just edited my old library.

Blitz3D looks good, but I don't think they sell it in stores. Oh, and Rich, have you tried B3D by the way?
Posted: 29th Oct 2003 13:29
Oh, and Rich, have you tried B3D by the way?


It's a Rival product that shouldnt even be mentioned here, shhh!!!
Posted: 29th Oct 2003 13:36
I'm sure he's tried it, how else are you meant to compete if you don't know what your competing with? Oh yeah, shhh !
Posted: 29th Oct 2003 17:44
I have to admit I like the style behind loading things in Blitz but is it really that hard to keep track of object numbers?
Posted: 29th Oct 2003 22:02
How bout you just buy Blitz, instead of trying to imitate it
Posted: 29th Oct 2003 22:11
Ummm, buy Blitz just cos you like one aspect of it? What if he likes all the other aspects of DBPro better?

Yeah, I'm using this kind of thing for my own code, except its for my own type of objects. It's handy as I don't need to separate them into groups (ie. I would refer to them as object(groupnum,objectnum)), I can store them in one long array (object(objectnum)) and return the object number to a variable when I create the object.
Posted: 30th Oct 2003 2:40
I'm DBC btw. Most of this stuff is personal preference only, so it just depends on what you're doing.

KNau, yes it is hard to keep track of numbers Blitz costs too much money, US$100.
Posted: 30th Oct 2003 10:03
Try this ld function. It's a real trouble to see message
"File not found" What's "not found" file name ?

Here instead of
+ Code Snippet
load object "model.x",1

you simply write
+ Code Snippet
` at the start of program
dim rootdir$(0):rootdir$(0)="mydata/"
` ....
ld("model.x",1,"x")
` ...for sound
ld("sound.wav",1,"s")
` and so on

If file not found, then function ld prints its name and
correctly ends program. This saves a lot of debugging time.
If you want to switch off this check for "build final" version,
you change code to
+ Code Snippet
ld("model.x",1,"X")

(substitute little "x" to big "X")

+ Code Snippet
function ld(fi$,n,m$)
f$=rootdir$(0)+fi$
check=(m$>"a")
t$=lower$(m$)
if check
if file exist(f$)=0 then print f$;" - no file":sync:wait key:end
endif
if t$="i" then load image f$,n
if t$="m" then load music f$,n
if t$="s" then load sound f$,n
if t$="b" then load bitmap f$,n
if t$="x" then load object f$,n
if t$="e" then load mesh f$,n:
endfunction
Posted: 30th Oct 2003 10:59
Deckard,
Hehe, what has that got to do with the original code, that does'nt use any sort of entity system, you have to specify the number when loading for godsake! - your quicker just specifying the correct command.


Van-B
Posted: 30th Oct 2003 12:38
To create "object oriented looking code" from
"classic looking code" is not enough. Code must
work better, not simply look "object oriented"
In case of original code we must define objects
such as MyPlayer,MyEnemy as global variables.
It can produce only more problems.

As to my code, you can use:

mysuperobject=RND(65535)
ld("model.x",mysuperobject,"X")
position mysuperobject,x#,y#,z#


(this is a joke)
Posted: 30th Oct 2003 12:56
Heh, when I use my entity commands, I generate a number string so the functions can determine if its an object, camera, light, or terrain and which one it is, like so:

+ Code Snippet
function LoadMesh(mesh$)
object=0
repeat
inc object
until object exist(object)=0
load object mesh$,object
misc$=str$(object)+"1"
object=val(misc$)
endfunction object


So there is no need to set global for any entity name. Gotta put a little more effort in determining if its an object, light, camera, or terrain though.

This is my PositionEntity function:

+ Code Snippet
function PositionEntity(entity,xpos,ypos,zpos)
misc$=str$(entity)
length=len(misc$)
entitytype=val(mid$(misc$,length))
entitynumber=length-1
if entitynumber=1 then entityfinal=val(mid$(misc$,1))
if entitynumber=2 then entityfinal=(val(mid$(misc$,1))*10)+val(mid$(misc$,2))
if entitynumber=3 then entityfinal=(val(mid$(misc$,1))*100)+(val(mid$(misc$,2))*10)+val(mid$(misc$,3))
if entitynumber=4 then entityfinal=(val(mid$(misc$,1))*1000)+(val(mid$(misc$,2))*100)+(val(mid$(misc$,3))*10)+val(mid$(misc$,4))
if entitytype=1 then position object entityfinal,xpos,ypos,zpos
if entitytype=2 then position light entityfinal,xpos,ypos,zpos
if entitytype=3 then position camera entityfinal,xpos,ypos,zpos
if entitytype=4 then position matrix entityfinal,xpos,ypos,zpos
endfunction


Basically, it only has support for 9999 objects, lights, cameras, or matrices, but who's going ot use em all? It determines the type of Entity it is first, then it edits the scene accordingly.
Posted: 31st Oct 2003 1:46
I like DB its simple and easy for me to use i liked the way some of the B3d grapics looked but i'd rather have quanity over quality ( i know my spelling sucks! but im good at programming!)
Posted: 31st Oct 2003 2:12
Entity system? wtf, how'd we get to that topic?

All I wanted to do was to make a function that didn't need numbers. I copied what I understood from the B3D demo, and that's it. btw, with some tweeking, most of those suggestions you said could actually be applied to the library. Except, I'm not doing that because I'm not the one in need of anything fancier

Underlord: Quantity? What do you mean? whose side are you on: DB or B3D?
Posted: 2nd Nov 2003 17:23
"i'd rather have quanity over quality"

that's a sad, sad thing. you'd rather have a million commands that don't work rather than 100 commands that do.

"is it really that hard to keep track of object numbers"

it's a bit of a pain to make sure you're not using up object slots. it's much easier to simply make an object and not worry about what slot you put it in.

"I'm sure he's tried it, how else are you meant to compete if you don't know what your competing with?"

wait.. if he has tried B3D then why isn't DBP so much better..?
Posted: 7th Nov 2003 20:02
Uh, you can't just think "I want to put this feature into DBPro" and it will pop in there, you actually have to plan it, code it, test it, fix it and test it again, then test any other features that would be affected by adding this new feature, edit them as well to fit in. It all takes time and effort, you can't just expect someone to do something and it will happen, if your so bloody ecstatic about blitz then don't post on there forums.