Jump to content

Dreikblack

Members
  • Posts

    516
  • Joined

  • Last visited

Everything posted by Dreikblack

  1. Yes. In theory you can make a new controller with another physics or just resize it for now and wait for @Josh to add parameters for setting the player size.
  2. Damn, i just realized your question was about player size and not camera fov
  3. Made updateFov() because Start() is called with adding a component automatically. Example use in main lua: -- Get display list local displays = GetDisplays() -- Create a window local window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[1], WINDOW_TITLEBAR | WINDOW_CENTER) -- Create framebuffer local framebuffer = CreateFramebuffer(window) -- Create world local world = CreateWorld() -- Create light local light = CreateDirectionalLight(world) light:SetColor(2) light:SetRotation(45, 35, 0) -- Create ground local ground = CreateBox(world, 10, 1, 10) ground:SetPosition(0, -0.5, 0) ground:SetColor(0,1,0) local box = CreateBox(world, 1, 1, 1) box:SetPosition(0, 0.5, 1) box:SetColor(1,1,0) -- Create model local model = CreateCylinder(world, 1, 1, 5) model:SetPosition(0, 3, 0) model:SetRenderLayers(0) local fpsController = model:AddComponent(FirstPersonControls) fpsController.fov = 100 fpsController:updateFov() while window:Closed() == false and window:KeyHit(KEY_ESCAPE) == false do world:Update() world:Render(framebuffer) end FirstPersonControls.zip
  4. I meant by pivot an Empty, in Misc because it is a name in code/engine After attaching a controller to it you can change a fov in line "self.camera:SetFov(70)" to needed value. Or add to FirstPersonControls.json a fov value like that: { "component": { "properties": [ { "name": "mousesmoothing", "label": "Mouse smoothing", "value": 0.0 }, { "name": "mouselookspeed", "label": "Look speed", "value": 1.0 }, { "name": "movespeed", "label": "Move speed", "value": 4.0 }, { "name": "fov", "label": "FOV", "value": 70 } ] } } And in FirstPersonControls.lua add "fov = 70" to other value at top and then change ""self.camera:SetFov(70)" to "self.camera:SetFov(self.fov)" With you will be able to change a fov as component variable in the Editor
  5. Actually it's even create a camera. FirstPersonControls should be attached to a model or pivot (empty). Model can be invisible with renderLayers 0 in appearance tab iirc
  6. FirstPersonControls seems to overwrite fov value. Try to comment "self.camera:SetFov(70)" line in FirstPersonControls.lua
  7. Released demo: https://dreikblack.itch.io/slipgate-tactics Changed a name to Slipgate Tactics, because Quake publisher does not like when its brands used in fan projects until its mods
  8. Same error when load in my project demo map (by new game btn) or Polygon map. In release mode issue not happens.
  9. With latest updates app crashes when i'm building a brush. Had no problem with exactly method from my example before, but this example from Learn still works tho https://www.ultraengine.com/learn/CreateBrush?lang=cpp #include "UltraEngine.h" using namespace UltraEngine; shared_ptr<Brush> createConeBrush(shared_ptr<World> world, float initWidth, float width, float length, float height, float minHeightArg) { auto brush = CreateBrush(world); float minHeight = minHeightArg != 0 ? minHeightArg * 0.5f : Max(2 * 0.4f, -height * 0.1f); brush->AddVertex(-initWidth * 0.5f, -minHeight, 0); //SW l brush->AddVertex(-width * 0.5, -height * 0.5, length);//NW brush->AddVertex(width * 0.5, -height * 0.5, length);//NE brush->AddVertex(-width * 0.5, height * 0.5, length);//NW h brush->AddVertex(width * 0.5, height * 0.5, length);//NE h brush->AddVertex(-initWidth * 0.5f, minHeight, 0); //SW h 5 brush->AddVertex(initWidth * 0.5f, minHeight, 0); //SE h 6 brush->AddVertex(initWidth * 0.5f, -minHeight, 0); //SE 7 //back auto face = brush->AddFace(); face->AddIndice(0);//SW face->AddIndice(5);//NW face->AddIndice(7);//NE face = brush->AddFace(); face->AddIndice(5);//SW face->AddIndice(6);//NW face->AddIndice(7);//NE //bottom face = brush->AddFace(); face->AddIndice(0);//SW face->AddIndice(1);//NW face->AddIndice(2);//NE face = brush->AddFace(); face->AddIndice(2);//SW face->AddIndice(7);//NW face->AddIndice(0);//NE //top face = brush->AddFace(); face->AddIndice(6);//SW h face->AddIndice(4);//NW h face->AddIndice(3);//NE h face->AddIndice(5);//SE h face = brush->AddFace();//left face->AddIndice(3); face->AddIndice(1); face->AddIndice(0); face->AddIndice(5); face = brush->AddFace();//"face" face->AddIndice(1); face->AddIndice(2); face->AddIndice(4); face->AddIndice(3); face = brush->AddFace();//right face->AddIndice(2); face->AddIndice(4); face->AddIndice(6); face->AddIndice(7); brush->Build(); brush->SetPickMode(PICK_NONE); brush->SetCollisionType(COLLISION_NONE); brush->SetRenderLayers(0); return brush; } int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CLIENTCOORDS | WINDOW_CENTER | WINDOW_TITLEBAR); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a world auto world = CreateWorld(); //Create a camera auto camera = CreateCamera(world); camera->SetPosition(0, 1, -2); camera->SetClearColor(0.125f); createConeBrush(world, 1, 2, 2, 1, 0.1 ); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  10. It still loading a default mat even though it uses another one
  11. Managed to fix it in the game in Pivot's component Start() method by: auto entity = GetEntity(); if (entity) { entity->SetRotation(entity->GetRotation(true), true); } But resetting rotation does not work for this example O_o
  12. If brush was SetParented to a pivot World::Pick() starts ignoring it. How it should be: How it is: #include "UltraEngine.h" using namespace UltraEngine; bool PickFilter(std::shared_ptr<Entity> entity, std::shared_ptr<Object> extra) { if (entity->GetCollider() == nullptr) { return false; } return true; } int main(int argc, const char* argv[]) { 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->SetFov(70); camera->SetPosition(0, 2, -3); camera->SetRotation(25, 0, 0); camera->SetDebugPhysicsMode(true); auto light = CreateDirectionalLight(world); light->SetRotation(35, 45, 0); light->SetColor(1); auto floor = CreatePlane(world, 100, 100); floor->Move(0, -1, 0); auto b1 = CreateBox(world, 2.0f); b1->SetPosition(-3.0f, 0.0f, 0.0f); b1->SetColor(1, 0, 0); auto pivotParent = CreatePivot(world);//added a parent here b1->SetParent(pivotParent); auto b2 = CreateBox(world, 2.0f); b2->SetColor(0.0f, 0.0f, 1.0f); b2->SetPosition(3.0f, 0.0f, 2.0f); b2->SetRotation(0.0f, 45.0f, 0.0f); auto pivot = CreatePivot(world); auto rod_scale = 5.0f; auto rod = CreateCylinder(world, 0.05f); rod->SetCollider(nullptr); rod->SetParent(pivot); rod->SetRotation(90.0f, 0.0f, 0.0f); rod->SetPosition(0.0f, 0.0f, rod_scale / 2.0f); rod->SetScale(1.0f, rod_scale, 1.0f); auto sphere = CreateSphere(world, 0.25f); sphere->SetCollider(nullptr); sphere->SetParent(pivot); sphere->SetColor(0, 1, 0); sphere->SetPosition(0.0f, 0.0f, rod_scale); auto spin_speed = 0.5f; while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { pivot->Turn(0.0f, spin_speed, 0.0f); auto target_pos = Vec3(0.0f, 0.0f, rod_scale); target_pos = TransformPoint(target_pos, Mat4(), pivot->GetMatrix(true).Inverse()); // Perform a ray cast auto pick_info = world->Pick(pivot->GetPosition(true), target_pos, 0.25f, true, PickFilter); if (pick_info.success) { sphere->SetPosition(pick_info.position, true); } else { sphere->SetPosition(target_pos, true); } world->Update(); world->Render(framebuffer); } return 0; }
  13. Still need getters for ParticleEmitter (GetParticleVelocity, GetParticleTurbulence etc.)
  14. If you do "box->SetParent(pivot);" before loop there will be no shadow at all. In this example there is a shadow, but with Space box became child of rotating pivot and shadow is stay still static. #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); auto framebuffer = CreateFramebuffer(window); auto world = CreateWorld(); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetFov(70); camera->Move(-1, 2, -6); //Create light auto light = CreatePointLight(world); light->SetPosition(0, 1, 0); light->SetColor(2); //Create ground auto ground = CreateBox(world, 20, 1, 20); ground->SetPosition(0, -0.5, 0); ground->SetColor(0, 0.4f, 0); auto pivot = CreatePivot(world); pivot->SetPosition(0, 0.5, -1); auto box = CreateBox(world, 1, 1, 1); box->SetPosition(0, 0.5, -1); while (window->Closed() == false and window->KeyHit(KEY_ESCAPE) == false) { if (window->KeyHit(KEY_SPACE)) { box->SetParent(pivot); } pivot->Turn(2); world->Update(); world->Render(framebuffer); } return 0; }
  15. It should not prevent it at all. Are you sure there are no other pointers exist to those weapons? Example how same reusing of var deletes prev entity without other references to it: local displays = GetDisplays() local window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[1], WINDOW_CENTER | WINDOW_TITLEBAR) local framebuffer = CreateFramebuffer(window) local world = CreateWorld() -- Create a camera local camera = CreateCamera(world) camera:SetClearColor(0.125) camera:SetFov(70) camera:Move(0, 2, -8) -- Create light local light = CreateBoxLight(world) light:SetRotation(45, 35, 0) light:SetRange(-10, 10) local box = CreateBox(world) box:SetPosition(1, 1, 1) -- Main loop while window:Closed() == false and window:KeyHit(KEY_ESCAPE) == false do collectgarbage() world:Update() world:Render(framebuffer) if (window:KeyHit(KEY_SPACE)) then box = CreateBox(world) end end
  16. But it does exist Docs does not have it tho You can add "hat:Detach()" to test https://www.ultraengine.com/learn/Entity_Attach?lang=lua
  17. Only closing console and stopping debug manually can close an app if fps limit was seted in World::Render() #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a world auto world = CreateWorld(); world->RecordStats(); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.125); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer, false, 120); } return 0; }
  18. In ParticleEmitter class Instantiate and Copy are private. If i do it via Entitiy's Instantiate i getting ParticleEmitter with default mat and params. Copy() seems to copy a mat, but not params. #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CLIENTCOORDS | WINDOW_CENTER | WINDOW_TITLEBAR); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a world auto world = CreateWorld(); //Create a camera auto camera = CreateCamera(world); camera->SetPosition(0, 1, -2); camera->SetClearColor(0.125f); //Create a particle emitter with 50 particles auto emitter = CreateParticleEmitter(world, 10); emitter->SetVelocity(0, 0, 0); emitter->SetParticleTurbulence(10000); emitter->SetMaterial(LoadMaterial("/Materials/default.mat")); auto emitter2 = emitter->As<Entity>()->Instantiate(world); emitter2->SetPosition(1, 0, 0); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  19. Since tech demo public release some effects were added such as: - fire muzzle effects, particles for shots - particles for explosions - blood particles on hits and gibbing - blood decals on units when they getting damage and on the floor, when they gibbed - few gibs beside a head, with a physics Beginning of demo level can be seen here. Want to release the demo in few weeks.
  20. Version 1.0.0

    4 downloads

    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; }
  21. Code from https://www.ultraengine.com/learn/Entity_Staticize?lang=cpp Added fps counter to title, disabled VSync, fixed mover include Release mode 2500-2580 fps, hit space to make light static - 1700-1800 fps #include "UltraEngine.h" #include "Components/Motion/Mover.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Plugin for texture loading auto plugin = LoadPlugin("Plugins/FITextureLoader"); //Get display auto displays = GetDisplays(); //Create window auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_TITLEBAR | WINDOW_CENTER); //Create framebuffer auto framebuffer = CreateFramebuffer(window); //Create world auto world = CreateWorld(); world->SetAmbientLight(0.1); world->RecordStats(true); //Create camera auto camera = CreateCamera(world); camera->SetClearColor(0.25); camera->SetPosition(0, 2, 0); camera->Move(0, 0, -5); //Build scene auto tunnel = LoadModel(world, "https://github.com/UltraEngine/Documentation/raw/master/Assets/Models/Underground/tunnel_t.glb"); tunnel->SetRotation(0, 180, 0); tunnel->Staticize(); auto cage = LoadModel(world, "https://github.com/UltraEngine/Documentation/raw/master/Assets/Models/Underground/fancage.glb"); cage->Staticize(); auto fan = LoadModel(world, "https://github.com/UltraEngine/Documentation/raw/master/Assets/Models/Underground/fanblades.glb"); fan->SetPosition(0, 2, 0); auto mover = fan->AddComponent<Mover>(); mover->rotationspeed.z = 300; auto light = CreatePointLight(world); light->SetColor(2, 2, 2); light->SetRange(10); light->SetPosition(0, 2, 2); light->SetColor(4.0); //Display text auto orthocam = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); orthocam->SetClearMode(CLEAR_DEPTH); orthocam->SetRenderLayers(128); orthocam->SetPosition(float(framebuffer->size.x) * 0.5, float(framebuffer->size.y) * 0.5f); auto font = LoadFont("Fonts/arial.ttf"); auto text = CreateSprite(world, font, "Shadow polygons: 0", 14.0 * displays[0]->scale); text->SetPosition(2, framebuffer->size.y - 16.0f * displays[0]->scale); text->SetRenderLayers(128); auto text2 = CreateSprite(world, font, "Press space to make the light static.", 14.0 * displays[0]->scale); text2->SetPosition(2, framebuffer->size.y - 16.0f * 2.0f * displays[0]->scale); text2->SetRenderLayers(128); //Main loop while (!window->KeyHit(KEY_ESCAPE) and !window->Closed()) { world->Update(); world->Render(framebuffer, false); window->SetText("FPS: " + String(world->renderstats.framerate)); if (window->KeyHit(KEY_SPACE)) { light->Staticize(); text2->SetHidden(true); } text->SetText("Shadow polygons: " + String(world->renderstats.shadowpolygons)); } return 0; }
  22. After one of latest update in beta fps dropped for me about 20%, noticeable on any map in my project except main menu.
  23. Yes, i'm using brushes for that (but would prefer collider in some cases). Should i mark it solved?
  24. Version 1.0.0

    3 downloads

    "Muzzle meshes" (https://skfb.ly/6WOLz) by DJMaesen is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/by/4.0/). I separated them into two model files and converted to Ultra's mdl, textures to .dds, made Unlit materials with alpha channel. 1k maps
×
×
  • Create New...