Jump to content

Components

10 files

  1. This is a collection of utility functions I have wrote and or accumulated over the past year or so.. 
    A great collection to get you started!
    How to use:
    ** Place the LUA file into the Source directory of your project.

    ** At the top of your main.lua entry file add this line of code:
    ** require("UltraUtilities") ** Then, any where in your code or components code - you can call any of the functions.
    ** Example usage:
    ** Local Sun = GetSunEntity() ** Sun:SetColor(255,0,255,255) Version 1.0 includes:
    function GetSunEntity()                                  -- Get the directional light ( sun ) from the map file
    function GetTerrainEntity()                             -- get the terrain handle from the map file
    function RandomFloat(lower, greater)            -- pseudo random float
    function CubicInterpolate(x0, x1, x2, x3, mu) -- cubic interpolation
    function Mysplit(inputstr, sep)                       -- split a string into chunks based off a separator - returns a table with the chunks in it
    function Note(str)                                           -- easier Notify() command, takes numbers and strings and is shorter to type
    function HasTag(ent, tag)                               -- checks if a tag is available for an actor
    function HasPartialTag(ent, ptag)                   --  returns everything AFTER ':' part of the tag
    function YnFileExists(filename)                       -- check if a file exists
    function IsMouseOverPosition(x1, x2, y1, y2) -- mouse over a position -- good for gui's
    function MyRandom(min, max, float)              -- Generate a random number with options ( float of int) 
    function Secure_Seed()                                    -- uses hardware ID's to generate a TRUELY random number in lua
    function CopyToClipboard(text)                      -- copy a string to the clipboard
    function LerpToZero(value, factor)                  -- slowly move a number to zero
    function DampToZero(value, smoothing, delta)  -- slowly move a number to zero based off millisecs()
    Stary tuned more to come !
    7
  2. By Josh, 
    This uses the Quake light animation presets to add some interesting color modulation to any entity.
    The following presets are available:
    Normal Flicker Slow Strong Pulse Candle 1 Fast Strobe Gentle Pulse 1 Flicker 2 Candle 2 Candle 3 Slow Strobe Flourescent Flicker Slow Pulse Todo:
    The candle presents don't look right to me, but I'm not sure what they are supposed to look like. I remember them as being a gentle flicker. There is no interpolation between the nearest two values, it just grabs one single value, so it's not very smooth. I guess this is appropriate for the strobe effects, but not for others.  
    0
  3. Little component that can be used for Particle Emitter that should be deleted in time
    Temporary - will component keep entity pointer to delete it once time is out Reducing Effect - decrease particles Velocity and Turbulence with time Duration - time before entity pointer will be deleted Case uses: explosions, blood hits, bleeding effect etc.
    8
  4. Component to move an entity to WayPoints:
    Move Speed - how much velocity entity will have while moving doDeleteAfterMovement - auto remove entity when it's reach final waypoint. Can be used for door, that goes into walls or floor Input "DoMove" - make entity move to next point Output "EndMove" - happens when entity stops after reaching final way point or if this way poiont has enabled doStayOnPoint 
    7
  5. Component-controller for top down camera Apply this component to Camera entity WASD and mouse near window border moves camera horizontally QE - to rotate camera Mouse scroll to lower/raise Put it in Components\Player folder
    4
  6. Component-controller for top down camera
    Apply this component to Camera entity
    WASD and mouse near window border moves camera horizontally
    QE - to rotate camera
    Mouse scroll to lower/raise
    5
  7. Simple component which can be used to naviage bots or objects
    nextPoint - null if it's a final onem otherwise add another entity with this component to make a chain doStayOnPoint - can be checked by object that uses WayPoints to find out if it should stay after reaching this point and wait a command before moving to next one Put in Components\Logic folder
    11
  8. Component to move an entity to WayPoints:
     
    Move Speed - how much velocity entity will have while moving doDeleteAfterMovement - auto remove entity when it's reach final waypoint. Can be used for door, that goes into walls or floor Input "DoMove" - make entity move to next point Output "EndMove" - happens when entity stops after reaching final way point or if this way poiont has enabled doStayOnPoint 
    4
  9. Simple component which can be used to naviage bots or objects
    nextPoint - null if it's a final onem otherwise add another entity with this component to make a chain doStayOnPoint - can be checked by object that uses WayPoints to find out if it should stay after reaching this point and wait a command before moving to next one
    3
  10. Particle effect for explosion or blood hit with another material (and higher turbulence like 10000 and end radius around 0.8).
    ParticleEffect component removes (technically temporally keeps) a particle emitter before second particle burst happens.
    Code example, included to archive:
    #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { RegisterComponents(); auto displays = GetDisplays(); auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); auto world = CreateWorld(); auto framebuffer = CreateFramebuffer(window); auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetPosition(0, 5, -4); camera->SetRotation(50, 0, 0); auto light = CreateBoxLight(world); light->SetRange(-10, 10); light->SetArea(15, 15); light->SetRotation(45, 35, 0); light->SetColor(2); auto ground = CreateBox(world, 10, 1, 10); ground->SetPosition(0, -0.5, 0); ground->SetColor(0, 1, 0); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->KeyHit(KEY_SPACE)) { auto particle = LoadPrefab(world, "Prefabs//Explosion.pfb"); particle->SetPosition(0, 2, -2); for (auto const& component : particle->components) { component->Start(); } } world->Update(); world->Render(framebuffer); } return 0; }  
    7

×
×
  • Create New...