Thank you for downloading the HTML5 GDK. This software makes it easy to make 3D games for the worldwide web. The command set is inspired by a programming language called DarkBASIC, and a software rendering library called Pre3D is used as a backend. This guide is designed to make it easy for you to quickly get started in the HTML5 GDK and understand the command set.
Contents:
Files
Getting started
Commands
Conclusion
Files. The HTML5 GDK includes the following files:
Getting started. The first thing you probably want to do is try out the demos (here, here and here). Then, the only thing to do is jump right into it and start making games. Make a copy of trees.htm which you can modify and ruin if you want to. When you open it up in your favorite text editor, the things you should pay attention to are the script tags and the canvas tag. The script tags in the <head> section of the document load the files pre3d-fixed_lighting.js, pre3d_shape_utils.js, retainedmode.js, sound.js, and tree.js. The first 4 script files you will need for almost every HTML5 GDK game that you make. The formatting of the document is essential for the screen scaling to work correctly, plus the embedded/inline script provides mouse/touch input functionality. Therefore, it is best for most users to just copy trees.htm and modify it as you see fit. Towards the end of it in the embedded script, there are comments indicating where you should type in your game code. In particular, there is the setup section and the main loop. If you don't understand these concepts, you need to read up on basic game programming. To do anything meaningful here, refer to the list of DarkBASIC-inspired commands below.
cameraPositionX cameraPositionY cameraPositionZ cameraAngleX cameraAngleY cameraAngleZ getObjectCollisionX getObjectCollisionY getObjectCollisionZ wrapvalue(angle) RGBA(red,green,blue,alpha) RGB(red,green,blue) loadImage(file,number) imageExist(number) loadMesh(file,number) meshExist(number) loadObject(file,number) makeObjectBox(number,width,height,depth) makeObjectCube(number,size) makeObjectPlane(number,width,height) makeObjectTriangle(number,x1,y1,z1,x2,y2,z2,x3,y3,z3) makeObjectSphere(number,size) makeObjectColorBox(number,width,height,depth,rightRGBColor,leftRGBColor,upRGBColor,downRGBColor,frontRGBColor,backRGBColor) makeObject(objectNumber,meshNumber[,imageNumber=0]) appendObjectMesh(objectNumber,meshNumber,RGBcolor) colorObject(number,RGBcolor) setObjectCull(number[,backfaceCulling=true]) textureObject(objectNumber,imageNumber) positionObject(number,X,Y,Z) rotateObject(number,X,Y,Z) scaleObject(number,Xpercent,Ypercent,Zpercent) moveObject(number,amount) showObject(number) hideObject(number) objectVisible(number) deleteObject(number) objectPositionX(number) objectPositionY(number) objectPositionZ(number) objectAngleX(number) objectAngleY(number) objectAngleZ(number) objectExist(number) makeObjectCollisionBox(objectNumber,x1,y1,z1,x2,y2,z2) deleteObjectCollisionBox(objectNumber) setObjectCollisionOn(objectNumber) setObjectCollisionOff(objectNumber) objectCollision(objectNumber1[,objectNumber2=0]) cloneObject(objectNumber2,objectNumber1) positionCamera(X,Y,Z) rotateCamera(X,Y,Z) moveCamera(amount) setCameraFOV(fov) sync(renderer)
loadSound(file,number) playSound(number) loopSound(number) stopSound(number) soundExist(number) loadMusic(file,number) playMusic(number) loopMusic(number) stopMusic(number) musicExist(number)