From time to time we will inform the community of certain areas of Skyline Development. If we have decided to add a new features or new demos in development etc we will try to make a post in this topic.Feel free to leave your comments to help encourage out development team ; )

New Scripting Techniques & Lua Upgrade

New Scripting Techniques & Lua Upgrade

Postby SolarPortal » 21 Feb 2019, 13:49

Edit: These posts were moved from another topic as i went off track in the wrong topic.. lol... naughty dev!

API will need a major overhaul as we have upgraded lua 5.3.5 and vector2, vector3, vector4, quat libraries are now proper objects.
This means simple math like so is possible:

Code: Select all
   bounds = aabb.new( vector3.new(10.5,10.7,10.9), vector3.new(21,100,21));
   bounds2 = aabb.new( vector3.new(0.5,0.7,0.9), vector3.new(2,10,1));
   
   p1 = bounds:getCenter();      
   p2 = bounds2:getCenter();      
   
   _d = p2 - p1; -- calculate direction
   _d:normalise(); -- normalise the vector3 internally.. note the use of ":"(colon) to have self automatically passed through.
   
   _d = -_d;   -- unary minus to flip the vector. same as _d = _d * vector3.new(-1,-1,-1)
   lprint("direction: "..tostring(_d));
   _d = vector3.ZERO();
   _d.x()


oh and of course we have added some new libraries also like the aabb library and a query library.
Because of lua 5.3.5 it also means we now have access to the bitwise and debug libraries of lua too..

Lots and lots of changes.. there will be porting notes.
Conceive, Quantify & Do!
Skyline Game Engine - Lead Developer.
Please provide as much information as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 3770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3152
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Script not working

Postby epsilonion » 22 Feb 2019, 21:28

Oh my a lot has changed since last year lol..
You have been busy cramming all these changes in
:D
User avatar
epsilonion
Skyline Lead Moderator
Skyline Lead Moderator
 
Posts: 849
Joined: 26 Feb 2015, 11:51
Location: Hull, East Yorkshire, England
Skill: Business Manager
Skill: Great creative

Re: Script not working

Postby SolarPortal » 23 Feb 2019, 20:20

just playing around creating a sceneEntity object in lua and this is a simple script to get position, add to the position and print the position. Just playing around and may not make it into final build

Code: Select all
   sEntity = sceneEntity.get(4);
   pos = sEntity:getPosition() + vec3(1,1,1);
   sEntity:setPosition(pos);

   -- or if you want to multiply the position by a full transform of another using matrix4
   pos = sEntity2:getFullTransform():inverse()  * pos; -- full transform is a full matrix4 multiplied by a vector3 object.
   sEntity:setPosition(pos);


The sEntity object is the entity data itself so no need to hold or pass ids.
Conceive, Quantify & Do!
Skyline Game Engine - Lead Developer.
Please provide as much information as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 3770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3152
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Script not working

Postby SolarPortal » 26 Feb 2019, 16:40

Here is another cool example of the new system for volume querying with the entire scene's entities.

Code: Select all
function collectEntitiesWithinVolumes()
   --local volumeIDs = query.findEntities("desc", "navvolume");
   local volumeIDs = query.findEntities("action", "Navmesh Volume");

   for k, v in pairs(volumeIDs) do
      local volumeID = v;
      lprint("volumeID: "..volumeID);
      
      local volumeAabb = entity.getWorldAabb(volumeID);
      local sceneEntityIDs = query.findEntities("aabb_intersection", volumeAabb);
      --local sceneEntityIDs = query.findEntities("aabb_contains", volumeAabb);
   
      for idx, id in pairs(sceneEntityIDs) do
         lprint("seid: "..id);
      end
   end
end


This is used to get all intersecting entity bounding boxes within the volumes.

Prints something like:
Code: Select all
volumeID: 17
seid: 3
seid: 11
seid: 14
seid: 15

volumeID: 19
seid: 4


This code will not work on any version released yet, but it will on the next version. v2.0
Conceive, Quantify & Do!
Skyline Game Engine - Lead Developer.
Please provide as much information as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 3770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3152
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer


Return to Skyline Development

Who is online

Users browsing this forum: No registered users and 2 guests

cron