Jump to content

Leadwerks Community GameLib


Canardia
 Share

Recommended Posts

--------------------------------------------------------------------------------

Idea Pool (post your own ideas to this thread):

- function to move the weapon from carrying position to scope position (and back)

- video player written by Niosop

- web browser written by Tyler

- mirrors

- IK

--------------------------------------------------------------------------------

GameLib 0.1.0.0 is not ready:

(no link)

 

New features:

- added Rect function override for Vec3->Vec3 (3D Rect)

- added Line function override for Vec3->Vec3 (3D Line)

- added error handling when trying to load a sbx file which does not exist

- added Masterxilo's OpenGL 3D mode enabler/disabler functions

- adjusted pivots for picking up items to be more accurate

- added shadow resolution entity key handling to Scene::LoadMap()

--------------------------------------------------------------------------------

GameLib 0.0.19.0 is ready:

http://www.leadwerks.com/wiki/index.php?title=GameLib#Source_Code

 

New features:

- Added function CreatePlayerMesh(), which is useful when using gamelib without sbx scenes (it was made with seperate commands inside the ProcessScene() function earlier)

- Adjusted the programmatically created player placeholder mesh to align correctly with the new Controller pivot

- Fixed a bug in StringToVec2, 3 and 4 which made gamelib crash when reading strings with more values than the Vec was supposed to have (I noticed the bug because Josh made ambientlight in sbx a Vec4 for some reason)

- Added option to create window in fullscreen resolution which is different from current Desktop resolution (auto resolution still works, which uses Desktop resolution for fullscreen mode)

- Added Z resolution to window class (color depth)

- Moved engine window creation to Window class

- Fixed the bug which made gamelib crash when accessing a NULL pointer of Game class in TScene::Initialize()

 

Changed files:

gamelib.h

gamelib.cpp

window.h

window.cpp

--------------------------------------------------------------------------------

GameLib 0.0.18.0 is ready:

http://www.leadwerks.com/wiki/index.php?title=GameLib#Source_Code

 

Known bugs:

  • Pointer to Game class in TScene::Initialize() is not initialized and crashes gamelib.
    To fix this bug, copy line 542 (scene.game=this;) in gamelib.cpp as new line before line 541.

New features:

- Renamed TGame class to Game class

- Added LEO's Engine class to Game class

- Moved AddMinimizeButton() to Window class

- Added Window class which has a method to load a custom app icon

- Added throwing of lifted objects

- The strength entity key of a classname="player" or classname"info_playerstart" is now read into player.strength

 

New files:

gamelib.h

gamelib.cpp // add this to the project

gamelib.rc // add this to the project

gamelib.ico

window.h

window.cpp

resource.h // install only when you don't use Project Wizard

--------------------------------------------------------------------------------

GameLib 0.0.17.0 is ready:

http://www.leadwerks.com/wiki/index.php?title=GameLib#Source_Code

 

New features:

- Moved from C99 syntax to C++ syntax, so struct is now class. This allows inheriting of classes and expanding them with your own needs.

- Added picking up, carrying and dropping of Models to the Player class: TPlayer::PickupModel(int mode).

- Changed default 3rd person camera to be a half meter right of the player model, to get more freedom for sight (all modern 3rd person games do this). The camera position can be adjusted with the TPlayer::eyeoffset vector.

- Fixed the bullets to be fired from the player's camera pivot instead of the scene's camera

--------------------------------------------------------------------------------

GameLib 0.0.16.0 is ready:

http://www.leadwerks.com/wiki/index.php?title=GameLib#Source_Code

 

New features:

- Fully supports Lua now

- Using LEO now, so you don't have to add LEO to your project anymore when using GameLib

- Using integrated framework with C++ interface from LEO

- The "Null framewerk." popup message has been fixed (by using the integrated framework)

- LuaTools class is included in GameLib also (game.luat), for easier handling of Lua commands

- Lua fw variable is automatically set in Lua by GameLib

- Editor's sound entity supports now pitch changes (the pitch slider needs to be added to the sound entity lua script, or do it manually in the sbx file with Notepad++)

 

--------------------------------------------------------------------------------

GameLib 0.0.15.0 is ready:

http://www.leadwerks.com/wiki/index.php?title=GameLib#Source_Code

 

New features:

- Fully supports Editor sbx files (supports also Sandbox sbx files)

- New control variable: TScene::uselua (0=don't use lua, 1=use optimally, 2=use always. Default 1)

- New control variable: TScene::usenewsbx (0=use Sandbox sbx, 1=use Editor sbx. Default 1)

- Supports also new Framewerk features which are set in Editor's Atmosphere entity: brightness, contrast, saturation

- StringToVecN() functions have a new option value: noconv=2 (0=autoconvert byte to float (when no decimal point is found), 1=never convert values, 2=always convert values)

 

NOTE:

1) The "Null framewerk." message can not be fixed by gamelib, it has to be removed from the environment_athmosphere.lua script manually. You could also make your own improved athmosphere entity, where this message is commented out, then sync doesn't overwrite your fixes.

2) The red terrain in power tutorial comes from the terrain color setting in the sbx file. You need to change the terrain color manually in the sbx file using Notepad++ since Editor uses terrain color, but doesn't have an option to change it.

--------------------------------------------------------------------------------

  • Upvote 1

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Thanks Lumooja I will update my Gamelib files later.

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

  • 2 weeks later...

I just got the Gamelib demo working in a map I made myself, but the only thing I'm not sure of is the lighting. It doesn't seem to load lights into the scene. Is there something I need to do to make that work?

Win 7 Pro 64 bit

AMD Phenom II X3 720 2.8GHz

GeForce 9800 GTX/9800 GTX+

4 GB RAM

Link to comment
Share on other sites

That Null Framewerk error occurs because you forgot to call SetGlobalObject("fw",m_framework); or whatever your variable name happens to be.

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

That Null Framewerk error occurs because you forgot to call SetGlobalObject("fw",m_framework); or whatever your variable name happens to be.

 

I'm not getting that NULL message this time. Is that SetGlobalObject command something to do with LUA? Because I am using nothing but C++ atm.

Win 7 Pro 64 bit

AMD Phenom II X3 720 2.8GHz

GeForce 9800 GTX/9800 GTX+

4 GB RAM

Link to comment
Share on other sites

Why this unusual thing. Including source files in source files.

Personally I would prefer standard behaviour, thats

do it as usual and include the source files in the project.

 

First when compiling I was really confused. Why on earth

do I get the error LNK2005: .... already defined in engine.obj

But then I found those lines in gamelib.cpp.

 

Problem solved by just comment them out

#include "gamelib.h"
//#include "engine.cpp"
//#include "framewerk.cpp"
//#include "renderer.cpp"
//#include "layer.cpp"

 

 

 

Roland Strålberg
Website: https://rstralberg.com

Link to comment
Share on other sites

I just discovered the problem:

 

void TScene::ProcessScene()
{
...
while(!done)
{
	done=1;
	childs = CountChildren(scene);
	for(i=1;i<=childs;i++)
	{
		loops++;
		e=GetChild(scene,i);
		cn=GetEntityKey(e,"classname");
		cl=GetEntityKey(e,"class");
		en=GetEntityKey(e,"name");




 

In my map:

cn = ""

cl = "Model"

en = "light_directional"

 

Later on this needs to be true to create a light:

 

if(uselua!=2)if(cn=="light_directional")

 

So I assume my map is corrupt? It odd because the light is the first loaded and everything else loads just fine.

 

 

EDIT:

I just tried it in a new map with the latest update and cn (classname) for the directional lights and I assume other lights is blank. So this sounds like it is one for Josh to fix.

Win 7 Pro 64 bit

AMD Phenom II X3 720 2.8GHz

GeForce 9800 GTX/9800 GTX+

4 GB RAM

Link to comment
Share on other sites

If you are using Gamelib then that would be one for Lumooja, and in 2.3 there is no classname key. And why make a call to void TScene::ProcessScene() if you are using 2.3? is that not just for 2.2x? as LoadScene()handles it all in C++ and 2.3

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

The missing classname key is a bit problematic in 2.3, since you have to take some random other key to identify the class. You could also set some custom entity key with Notepad++ in the sbx file, for example class_name="light_directional", but of course it would be nicer to have that functionality in Editor.

 

It could be also fixed with a complete new LUA script set for all default entities of LE, so that each LUA script provides a classname field where the user can enter the class name. Maybe I will do that for gamelib, and include modified versions of all lights and other default entities with gamelib.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

why is this needed if LoadScene handles lights already?

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

There's many other things which gamelib loads from the scene, and which can't be done in LUA. For example the loading of weapons into a C++ STL map. Or waypoints, ambient light triggers, playerstarts, etc...

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

well that may be so, but Davaris's query was "light" specific. But wouldn't you just add a classname to an entity? just add:

 

group:AddProperty("classname",PROPERTY_STRING,"")

 

to the lua script which then gets written to the .sbx?

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

Yes, that's exactly why I need to do for the gamelib versions of the LUA scripts. In additition I also need to add some missing light settings, like shadowsoftness, additional lightmap sizes, and a bigger lightrange slider. Those things should be in my opinion in the default engine, but they are not.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Well, Xtra light features aside, are you saying at the moment gamelib does not parse the lights? is this the root cause of Davaris's light problem?

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

It worked fine the last time I tried it (2009-12-30), but from what I understood there was some update over new year which apparently broke something. I need to check if I get the same problem, now that I'm back from the new year trip.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Well if it is broke, is it a "classname" issue? as we have not had that entity key in 2.3

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

The missing classname for directional light is indeed the reason:

Model {
path="light_directional.gmf"
position=-20.9827633,131.497437,2.42692709
rotation=55.0000496,0.000000000,0.000000000
scale=0.999997675,0.999998093,0.999998093
id=76090920
"class"="Model"
"intensity"="0.5"
"name"="directional_4"
}

But I can fix that in gamelib, to make it look if the "name" key begins with "directional", as I've done for ambient light in 2.3 also.

 

Line 1491 in gamelib.cpp would then look instead of:

if(uselua!=2)if(cn=="light_directional")

somehow like this (I need to test it first):

if(uselua!=2)if((cn=="light_directional")||((en.compare(0,11,"directional")==0))

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

But classname has been missing all the time hasn't it? I mean for all the entities?

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

I'm not sure, at least it was still there when I didn't delete the old entity created with Sandbox. I guess there are still many people who have old entities in their Editor maps, since they didn't recreate all entities with Editor, so I have to make sure that gamelib supports both Sandbox and Editor sbx, even if they are mixed in the same sbx file (which is obviously quite common).

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Thanks for the tips MG. I'll try your version. I'm still scrabbling around in the dark atm. :)

 

 

No problems Davaris I'm sure Lumooja will have gamelib all up and working soon.

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

MG: I just tried your version and the ground doesn't look as good as the Gamelib version I am using. There seems to be less layers and the bump maps aren't working? The firepit is working though. So I have gone back to Gamelib, because more of it seems to be working than not.

 

EDIT:

I noticed the firepit particles do not work in GameLib and I can't see where Lua is activated in it.

 

So I thought I'd put this in:

 

        
//Set Lua variable
       BP L=GetLuaState();
       lua_pushobject(L,framework);
       lua_setglobal(L,"fw");
       lua_pop(L,1);

 

However I can't get it to accept this:

 

game.scene.GetFrameWerk()

 

Can someone help me with it?

Win 7 Pro 64 bit

AMD Phenom II X3 720 2.8GHz

GeForce 9800 GTX/9800 GTX+

4 GB RAM

Link to comment
Share on other sites

You can't do that, since it needs the integrated framework. But I'm looking today how to get the integrated framework to work with gamelib 0.0.16.0.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

You can't do that, since it needs the integrated framework. But I'm looking today how to get the integrated framework to work with gamelib 0.0.16.0.

 

 

Excellent. Thanks for letting me know.

Win 7 Pro 64 bit

AMD Phenom II X3 720 2.8GHz

GeForce 9800 GTX/9800 GTX+

4 GB RAM

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...