Leadwerks3D SDK beta

Community Forums/Showcase/Leadwerks3D SDK beta

JoshK(Posted 2006) [#1]
http://www.leadwerks.com/files/LW3D_0.1.4.exe
http://www.leadwerks.com/files/LW3D_SDK_0.0.1.exe

This is an SDK for developing with Leadwerks 3D engine, and the Leadwerks3D "core", which is required to run any program utilizing the engine. The actual engine dll is going to be a freely distributable file. I made a custom installer which installs it in the Windows system32 directory. Think of it as like a driver. When I post an update, users of any program that use my engine will get to update the core of the engine. I plan to set it up so your application can call a specific engine version, or can just default to the latest available version. So if I add a new feature or improve performance, all applications using my engine will get automatically updated (without forcing the developer to).



At it's simplest, the Leadwerks 3D engine is distributed as a dll. However, I put together an SDK which will allow you to choose from project templates for different programming languages and create a new project. To create a new project, click the "Create a New Project" shortcut. This will launch CreateProject.exe, a simple program that helps you set up a new project. Select a project template (there is only one for BlitzMax right now), select a directory to use (or create one), and press "OK". A new project will be created in the directory you have chosen, and the directory will be opened.



Project templates are located in the "Templates" folder. When a project is created, the contents of the template folder are copied to the new project directory. The "default" folder contents also gets copied, no matter project type is selected. New project templates can be added just by creating a new subfolder in the "Templates" folder.


By default, the createproject tool leaves all the media in the Leadwerks3D SDK "Media" folder. The example project sets the media directories to point to both it's own relative path and the Leadwerks3D media path. For example, the primary models folder is "Models\" and a secondary models folder is indicated, which loads models from "Leadwerks3D SDK\Media\Models\". Of course, you can set the media paths to any folder you want, and do away with the secondary folder, if you like. By leaving a secondary path pointing to the Leadwerks3D SDK media folder, you can store all your media in one place. If you want to package up a demo and let other developers try it, you don't have to include all the Leadwerks3D SDK media, because it will just get loaded from their computer. You can just post a demo and include your own media assets, without packaging up a huge amount of files. It's like a mod. If you release a Half-Life mod, you don't have to include all the Half-Life media files, just the unique assets you made yourself.


Naughty Alien(Posted 2006) [#2]
..when you planing to release version of SDK for Blitz3D and PureBasic? I am interested in to that version..


Gabriel(Posted 2006) [#3]
So if I add a new feature or improve performance, all applications using my engine will get automatically updated (without forcing the developer to).

This is optional or mandatory?


bytecode77(Posted 2006) [#4]
hi!

impressive stuff!
one question left: where do you get all these great models?


JoshK(Posted 2006) [#5]
I made them, or had my people make them.

Gabriel, it would be optional. You'd probably want to make your application stick to one version when you release it.


jfk EO-11110(Posted 2006) [#6]
Do I get this right, this is a plain 3D engine, not a game engine? So people would have to write game specific things (eg NPCs) by their own?


JoshK(Posted 2006) [#7]
I'm adding a player class, because there are so many issues that I think it's better to have an official solution, especially for player movement and physics. I think that AI is something that should be written by the developer, since it's going to be so different in every project.


ShadowTurtle(Posted 2006) [#8]
Make a simple AI (walk,rotate,shoot) for shooters :)


stayne(Posted 2006) [#9]
Why don't you make it yourself if it's so simple?


ShadowTurtle(Posted 2006) [#10]
1. mode: walk forward - 2 secounds
2. mode: pointentity for rotate the enemy on player - 2 secounds
3. mode: shot (pick...)
4. mode: go back on 1. mode


cyberyoyo(Posted 2006) [#11]
I have 3 questions for you:
1- Is that a new 3D engine you are promoting? If you are distributing a dll it must be a full engine.But when I go to your website allI see is 3D game studio, which doesn't look like an engine but just a world editor. Do you have another link to the engine and its features, price,etc...?

2-Are you supporting Blitz3D or only BlitzMax? Because you should really support B3D. I'm sure you'll find plenty of potential users in the B3D crowd.

3-I am not very enthusiast about the distribution method where you want the dll registered with window and you want end users to use the sdk installed on their machine. This sort of distribution is what hurt and almost killed Java!(they recently switch to an open source solution for their sdk!)
Is it possible to just distribute the dll in the game's folder? that would be way simpler.


JoshK(Posted 2006) [#12]
Here is a BlitzMax game template that does not require MaxGUI:
Framework BRL.GLGraphics
Import Pub.Win32
Import BRL.System

'===================================================================
'Initialize Engine
'===================================================================

Local HLIB_ENGINE:Int

HLIB_ENGINE=LoadLibraryA("LW3D.dll")
If Not HLIB_ENGINE
	Notify "Leadwerks3D is not installed."
	End
EndIf

Global CreateViewport:Int(Hwnd:Int,colordepth:Int,multisample:Int) "win32"
Global Sync() "win32"
Global Cls() "win32"
Global SetPluginPath(path:Byte Ptr) "win32"
Global SetMaterialPath(path:Byte Ptr) "win32"
Global SetModelPath(path:Byte Ptr) "win32"
Global SetSoundPath(path:Byte Ptr) "win32"
Global SetMapPath(path:Byte Ptr) "win32"
Global CreateCamera:Int(parent:Int) "win32"
Global LoadWorld:Int(file:Byte Ptr) "win32"
Global RenderWorld() "win32"
Global StopEngine() "win32"
Global BuildWorld() "win32"
Global ViewportRedrawn:Int(Viewporta:Int) "win32"
Global GetVersion:Int() "win32"
Global Graphics:Int(width:Int,height:Int,depth:Int,mode:Int) "win32"
Global RotateEntity(entity:Int,x#,y#,z#) "win32"
Global AntiAlias:Int(mode:Int) "win32"
Global UpdateWorld() "win32"
Global DrawText(text:Byte Ptr,x:Int,y:Int,flags:Int) "win32"
Global FPS:Float() "win32"
Global VSync(mode:Int) "win32"
Global LoadFont(name:Byte Ptr,size:Int,flags:Int) "win32"
Global EntityPitch#(entity:Int,flags:Int) "win32"
Global EntityYaw#(entity:Int,flags:Int) "win32"
Global CurveValue:Float(target:Float,current:Float,increment:Float) "win32"
Global MoveEntity(entity:Int,x:Float,y:Float,z:Float) "win32"
Global AppEnded:Int() "win32"
Global MoveMouse(x:Int,y:Int) "win32"
Global MouseX:Int() "win32"
Global MouseY:Int() "win32"
Global KeyDown:Int(keycode:Int) "win32"

CreateViewport=getprocaddress(HLIB_ENGINE,"CreateViewport")
CreateCamera=getprocaddress(HLIB_ENGINE,"CreateCamera")
Sync=getprocaddress(HLIB_ENGINE,"Sync")
Cls=getprocaddress(HLIB_ENGINE,"Cls")
LoadWorld=getprocaddress(HLIB_ENGINE,"LoadWorld")
SetPluginPath=getprocaddress(HLIB_ENGINE,"SetPluginPath")
SetMaterialPath=getprocaddress(HLIB_ENGINE,"SetMaterialPath")
SetModelPath=getprocaddress(HLIB_ENGINE,"SetModelPath")
SetSoundPath=getprocaddress(HLIB_ENGINE,"SetSoundPath")
SetMapPath=getprocaddress(HLIB_ENGINE,"SetMapPath")
RenderWorld=getprocaddress(HLIB_ENGINE,"RenderWorld")
StopEngine=getprocaddress(HLIB_ENGINE,"StopEngine")
BuildWorld=getprocaddress(HLIB_ENGINE,"BuildWorld")
ViewportRedrawn=getprocaddress(HLIB_ENGINE,"ViewportRedrawn")
GetVersion=getprocaddress(HLIB_ENGINE,"GetVersion")
Graphics=getprocaddress(HLIB_ENGINE,"Graphics")
RotateEntity=getprocaddress(HLIB_ENGINE,"RotateEntity")
AntiAlias=getprocaddress(HLIB_ENGINE,"AntiAlias")
UpdateWorld=getprocaddress(HLIB_ENGINE,"UpdateWorld")
DrawText=getprocaddress(HLIB_ENGINE,"DrawText")
FPS=getprocaddress(HLIB_ENGINE,"FPS")
VSync=getprocaddress(HLIB_ENGINE,"VSync")
LoadFont=getprocaddress(HLIB_ENGINE,"LoadFont")
EntityPitch=getprocaddress(HLIB_ENGINE,"EntityPitch")
EntityYaw=getprocaddress(HLIB_ENGINE,"EntityYaw")
CurveValue=getprocaddress(HLIB_ENGINE,"CurveValue")
MoveEntity=getprocaddress(HLIB_ENGINE,"MoveEntity")
AppEnded=getprocaddress(HLIB_ENGINE,"AppEnded")
MoveMouse=getprocaddress(HLIB_ENGINE,"MoveMouse")
MouseX=getprocaddress(HLIB_ENGINE,"MouseX")
MouseY=getprocaddress(HLIB_ENGINE,"MouseY")
KeyDown=getprocaddress(HLIB_ENGINE,"KeyDown")

'===================================================================
'
'===================================================================


'Set up media paths and alternate paths
materialpath$=AppDir$+"\Materials\" + "|" + "C:\Program Files\Leadwerks3D SDK\Media\Materials\"
modelpath$=AppDir$+"\Models\" + "|" + "C:\Program Files\Leadwerks3D SDK\Media\Models\"
soundpath$=AppDir$+"\Sound\" + "|" + "C:\Program Files\Leadwerks3D SDK\Media\Sound\"
pluginpath$="C:\Program Files\Leadwerks3D SDK\Plugins\"
SetPluginPath pluginpath.ToCString()
SetMaterialPath materialpath.ToCString()
SetModelPath modelpath.ToCString()
SetSoundPath soundpath.ToCString()

'Create window and viewport
w=800
h=600
Graphics 800,600,32,1

Global camera:Int=CreateCamera(0)
loadfont "Arial".ToCString(),10,0

VSync True

LoadFont("Arial".ToCString(),10,0)
LoadWorld("C:\Program Files\Leadwerks3D SDK\Media\Maps\example.3dw".ToCString())
BuildWorld()

EnablePolledInput()

MoveMouse 400,300

'Main Loop
Repeat

	dx#=CurveValue(MouseX()-400,dx,4.0)
	dy#=CurveValue(MouseY()-300,dy,4.0)
	RotateEntity camera,EntityPitch(camera,0)+dy*0.1,EntityYaw(camera,0)-dx*0.1,0.0
	MoveMouse 400,300

	tx#=CurveValue(KeyDown(KEY_RIGHT)-KeyDown(KEY_LEFT),tx,10)
	tz#=CurveValue(KeyDown(KEY_UP)-KeyDown(KEY_DOWN),tz,10)
	MoveEntity camera,tx*10.0,0,tz*10.0

	UpdateWorld()
	RenderWorld()
	Sync()
	If AppEnded() End
	
Forever



jfk EO-11110(Posted 2006) [#13]
Is
"C:\Program Files\Leadwerks3D SDK\Media\Maps\example.3dw".ToCString()
the same as
"C:\Program Files\Leadwerks3D SDK\Media\Maps\example.3dw" + chr$(0)
?

And I agree, feels kind of not so friendly to have the dll in the windows directory.

Then again the reason why Java failed is more the fight between M$ and Sun that ended in M$ removing it from the preinstalled apps in windows and "replace" it by .NET. </offtopic>


Azathoth(Posted 2006) [#14]
No, the first one returns a CString, the second is a String in BMax with a null char on the end.
CStrings also needs to be freed with MemFree.


JoshK(Posted 2006) [#15]
I'm still deciding on the dll placement. I have it set up so the dll quickly detects updates on my server, and it can download and install a new version in about 5 seconds. I am interested in systems like Steam, where the software always stays current.

I can compile this into a module later, to simplify the startup.