Jump to content

reepblue

Developers
  • Posts

    2,500
  • Joined

  • Last visited

Everything posted by reepblue

  1. I recall suggesting things like Vec3().Forward()/Up() after I was trying to apply a concept done in Unity to Leadwerks.
  2. The map seems to be saving the real path of the material instead of a relative path. "material": { "path": "D:/Projects/UltraGame/Materials/Developer/measuregrid.mat" }, I caught this because I thought this was due to a line ending issue with my git but it seems to be this.
  3. This might be related. I just set up a machine today for testing and I can confirm that when Ultra Engine on release will crash when creating the framebuffer. In debug mode, the project works fine but we have artificing. The Vulkan SDK isn't really helpful. No popups or anything (Ignore the material loading messages, this is an issue I've discovered with my git server. 🤪) Loading plugin "Plugins/Basis.dll" Loading plugin "Plugins/FITextureLoader.dll" Loading plugin "Plugins/ISPCTexComp.dll" Loading plugin "Plugins/KTX2TextureLoader.dll" Warning: Failed to load controller bindings. Target Display: 2560, 1080 at scale 1 Loading shader family "Shaders/PBR.fam" Loading pixmap "UI/Splash/abstractblue.dds" Loading pixmap "UI/Splash/logos.dds" Loading font "Fonts/arial.ttf" Loading icon "UI/Icons/ultraengine.svg" Loading pixmap "UI/Loading Screens/loadingscreen_default.dds" Loading pixmap "UI/Loading Screens/loadingicon_default.dds" Running script "Scripts/System/ComponentSystem.lua" Loading shader family "Shaders/Sky.fam" Loading shader family "Shaders/unlit.fam" Loading shader family "Shaders/WidgetBlock.fam" Loading posteffect "Shaders/Refraction.fx" Loading shader module "Shaders/BlurX.frag.spv" Loading shader module "Shaders/BlurY.frag.spv" UNASSIGNED-CreateInstance-status-message(INFO / SPEC): msgNum: -2016116905 - Validation Information: [ UNASSIGNED-CreateInstance-status-message ] Object 0: handle = 0x19ea012f5b0, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0x87d47f57 | Khronos Validation Layer Active: Settings File: Found at C:\Users\reepb\AppData\Local\LunarG\vkconfig\override\vk_layer_settings.txt specified by VkConfig application override. Current Enables: None. Current Disables: None. Objects: 1 [0] 0x19ea012f5b0, type: 1, name: NULL UNASSIGNED-cache-file-error(INFO / SPEC): msgNum: -256165483 - Validation Information: [ UNASSIGNED-cache-file-error ] | MessageID = 0xf0bb3995 | Cannot open shader validation cache at C:\Users\reepb\AppData\Local\Temp/shader_validation_cache.bin for reading (it may not exist yet) Objects: 0 Loading scene "Maps/box.ultra" Loading material "D:/Projects/UltraGame/Materials/Developer/measuregrid.mat" Error: Failed to load material "D:/Projects/UltraGame/Materials/Developer/measuregrid.mat". Error: Failed to load material "D:/Projects/UltraGame/Materials/Developer/measuregrid.mat". Loading material "D:/Projects/UltraGame/Materials/Developer/defaultmeshface.mat" Error: Failed to load material "D:/Projects/UltraGame/Materials/Developer/defaultmeshface.mat". Error: Failed to load material "D:/Projects/UltraGame/Materials/Developer/defaultmeshface.mat". Loading material "D:/Projects/UltraGame/Materials/Developer/defaultmeshface.mat" Error: Failed to load material "D:/Projects/UltraGame/Materials/Developer/defaultmeshface.mat". Error: Failed to load material "D:/Projects/UltraGame/Materials/Developer/defaultmeshface.mat". Loading material "D:/Projects/UltraGame/Materials/Developer/defaultmeshface.mat" Error: Failed to load material "D:/Projects/UltraGame/Materials/Developer/defaultmeshface.mat". Error: Failed to load material "D:/Projects/UltraGame/Materials/Developer/defaultmeshface.mat". Loading material "D:/Projects/UltraGame/Materials/Developer/defaultmeshface.mat" Error: Failed to load material "D:/Projects/UltraGame/Materials/Developer/defaultmeshface.mat". Error: Failed to load material "D:/Projects/UltraGame/Materials/Developer/defaultmeshface.mat". Loading material "D:/Projects/UltraGame/Materials/Developer/defaultmeshface.mat" Error: Failed to load material "D:/Projects/UltraGame/Materials/Developer/defaultmeshface.mat". Error: Failed to load material "D:/Projects/UltraGame/Materials/Developer/defaultmeshface.mat". Debug: Scene successfully loaded. Debug: Flushed controller. Debug: Game Paused Debug: Flushed controller. Hope this helps.
  4. reepblue

    Fun with brushes

    Some WIP development textures with an FPS player in Ultra Engine,
  5. I re-arranged the source code so it's isolated from everything else in your project. It's less of a template and more of a system you drop in and call from your main.cpp file. I think I'll be shipping just this folder and the config.json file. As for the main.cpp, I think I'm just going to post an example of one in the readme. But it's not that complicated. The idea is you register your components and input controls here. You can also install a custom loading screen if you don't like the default one. #include "UltraEngine.h" #include "Game/Game.h" using namespace UltraEngine; using namespace UltraEngine::Game; // Components #include "Components/Motion/Mover.hpp" #include "Components/Player/CameraControls.hpp" static void RegisterComponents() { RegisterComponent<Mover>(); RegisterComponent<CameraControls>(); } // Define default controls. static void InstallControls(shared_ptr<GameController> controller) { if (controller == NULL) return; // Program actions controller->SetAction("Pause", BUTTON_KEY_ESCAPE); controller->SetAction("Terminate", BUTTON_KEY_END); controller->SetAction("ConsoleApp", BUTTON_KEY_F1); controller->SetAction("Fullscreen", BUTTON_KEY_F11); controller->SetAction("Screenshot", BUTTON_KEY_F2); // Camera ButtonAxis moveaxis = { BUTTON_KEY_W, BUTTON_KEY_S, BUTTON_KEY_A, BUTTON_KEY_D }; controller->SetAction("Movement", moveaxis, "InGameControls"); controller->SetAction("Sprint", BUTTON_KEY_SHIFT, "InGameControls"); controller->SetAction("Crouch", BUTTON_KEY_CONTROL, "InGameControls"); controller->SetAction("Climb", BUTTON_KEY_Q, "InGameControls"); controller->SetAction("Desent", BUTTON_KEY_E, "InGameControls"); controller->SetAction("Camera", AXIS_MOUSE, "InGameControls"); controller->SetAction("Jump", BUTTON_KEY_SPACE, "InGameControls"); // Settings controller->SetSetting("Raw Mouse", false); controller->SetSetting("Inverse Mouse", false); controller->SetSetting("Mouse Smoothing", 0.0f); controller->SetSetting("Mouse Look Speed", 1.0f); } int main(int argc, const char* argv[]) { // Register Components. RegisterComponents(); // Init the program! auto app = GetProgram(); app->commandline = ParseCommandLine(argc, argv); if (!app->Initialize()) return 1; // Load all plugins. if (!app->LoadPlugins()) { Print("Warning: Failed to successfully load all plugins!"); } // Load packages if (!app->LoadPackages()) { Print("Warning: Failed to load one or more packages."); } // Load Settings if (!app->LoadSettings()) { Print("Warning: Failed to load program settings."); } // Set the correct program app type based on the commandline. ProgramApp programtype = PROGRAMAPP_GAME; if (app->commandline[CFLAG_SETTINGSAPP] == true) { programtype = PROGRAMAPP_SETTINGS; } else if (app->commandline[CFLAG_LUASCRIPT] == true) { programtype = PROGRAMAPP_LUASCRIPT; } // Init the game controller. app->gamecontroller = CreateGameController(); InstallControls(app->gamecontroller); if (!app->LoadControllerBindings()) { Print("Warning: Failed to load controller bindings."); } // Launch the app. if (app->LaunchApp(programtype) == false) return 1; // Install the loading screen. app->stage->SetLoadingScreen<LoadingScreen>(); // Main Loop bool running = true; while (running) { while (PeekEvent()) { const auto e = WaitEvent(); if (!app->ProcessEvent(e)) { EmitEvent(EVENT_QUIT); } if (e.id == EVENT_QUIT) { if (app->Shutdown()) { if (!app->SaveSettings()) { Print("Error: Failed to save program settings."); } running = false; break; } } } app->Update(); } // Write this line before we terminate! Print("Application terminated successfully!"); return 0; }
  6. The light properties also don't seem to apply to the lights and reset upon deselecting them.
  7. While this example works, it's not working in the way needed for game saves. The reload function throws an exception when trying to read a file and you get a bufferstream overflow with the example below. Also, since Reload doesn't create anything, would I need to load the map file before the save file? If so, what's the best way to know way to know what save file goes to which map? #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(); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a scene auto scene = LoadMap(world, "Maps/savetest.ultra"); //Save the starting scene to memory shared_ptr<BufferStream> stream = NULL; shared_ptr<BufferStream> binstream = NULL; //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->KeyHit(KEY_F5)) { Print("SAVE"); if (stream) stream = NULL; if (binstream) binstream = NULL; stream = CreateBufferStream(); binstream = CreateBufferStream(); scene->Save(stream, binstream); } //Reload the starting scene when space key is pressed if (window->KeyHit(KEY_F6)) { if (stream and binstream) { stream->Seek(0); binstream->Seek(0); scene->Reload(stream, binstream); } } world->Update(); world->Render(framebuffer); } return 0; }
  8. I now see the updated example. I'll implement this tonight, thank you!
  9. The example needs to be updated but I think I know how it works.
  10. Ok, I'll probably wait until the update before returning to this.
  11. How would I use World::GetFrameCaptures() to have my app take a screenshot of the game? I know Steam can do this, but I'd like the application to be able to do this alone. void Program::TakeScreenshot() { if (mainapp != NULL) { auto f = stage->gameworld->GetFrameCaptures(); //auto game = mainapp->As<GraphicsWindow>(); //if (game) game->framebuffer->Capture(); } }
  12. Regarding components. they don't seem to get updated upon a reload and I have no idea why. This save file has the Mover and a CameraControls component defined in the map file but upon a reload, it's like the components aren't actually being attached for some reason. Does the editor do something different? quicksave.zip
  13. Noticed the following: Entity's Static checkbox doesn't get saved, Spinner widget for the the entity's mass cannot return back to 0 if ever given mass. Collision Type dropdown can't revert back to "None" when changed. Friction Spinners swap x and y values. upon deselection and reselection. Spinner widget for the entity's Elasticity value just doesn't get to be saved. I tested this by making a brush and then edit each widget, changed one setting, unselected it, then reselected it to see if the value was the same. I didn't test all component type widgets since I only have the default two at the moment. Also, the window title leaves a * at the end of the map name,
  14. Ok, so can just for loop all the entities within the world, and then add it to the scene? I'll give it a try and play around with it. My goal is to have Half Life 2 like save/load states almost transparent to the end user. Might want to do this for every save call since things like bullets or instanced objects can spawn at any time.
  15. I hope this will be demonstrated in the documentation. I was under the impression we would have "snapshot" saves by default with the world/scene::Save() function. It probably only worked with Lua components, but I'm looking forward to an example.
  16. The properties panel is very broken in the latest build. Changes don't get applied or saved anymore. I tried adding another component to an entity in a map and although the panel says it's there, reloading the map and rechecking it shows that the changes were not saved. Also manually changing properties such as the entity's position in the panel doesn't apply the changes. The editor is kind of unusable outside of making brushes at this point.
  17. Note: Scene::Save() works fine but doesn't copy over component data. The current map doesn't load any components in this test, but it should be worth testing. #include "UltraEngine.h" using namespace UltraEngine; void main(const char* args, const int argc) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_TITLEBAR | WINDOW_CENTER); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a world auto world = CreateWorld(); //Load a scene auto scene = LoadMap(world, "Maps/savetest.ultra"); //Main loop while (!window->Closed() and !window->KeyHit(KEY_ESCAPE)) { // Save if (window->KeyHit(KEY_F5)) { world->Save("save.ultra", SAVE_DEFAULT); } //Load if (window->KeyHit(KEY_F6)) { scene = NULL; scene = LoadMap(world, "save.ultra"); } //Update world world->Update(); //Render world world->Render(framebuffer, true); } } savetest.zip
  18. This example no longer works. The EVENT_FRAMECAPTURE doesn't seem like it gets emitted anymore. #include "UltraEngine.h" using namespace UltraEngine; void main(const char* args, const int argc) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_TITLEBAR | WINDOW_CENTER); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a world auto world = CreateWorld(); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.125f); camera->SetPosition(0, 0, -2); //Create a light auto light = CreateBoxLight(world); light->SetRotation(45, 35, 0); light->SetRange(-10, 10); light->SetColor(2); //Create a model auto box = CreateBox(world); box->SetColor(0, 0, 1); //Load the FreeImage plugin auto plugin = LoadPlugin("Plugins/FITextureLoader"); //Main loop while (!window->Closed() and !window->KeyHit(KEY_ESCAPE)) { //Rotate the model box->Turn(0, 1, 0); //Press the space key to queue a screenshot if (window->KeyHit(KEY_SPACE)) framebuffer->Capture(); //Look for captured frames while (PeekEvent()) { const auto e = WaitEvent(); if (e.id == EVENT_FRAMECAPTURE) { //Get the pixmap containing the captured frame, save and open it auto pixmap = e.extra->As<Pixmap>(); WString path = GetPath(PATH_DESKTOP) + "/screenshot" + String(e.data + 1) + ".jpg"; pixmap->Save(path); RunFile(path); } } //Update world world->Update(); //Render world world->Render(framebuffer, true); } }
  19. Back in July, I talked about the idea of building a compartmentalized base application for Ultra Engine. I now want to share what I've been working on and my future plans going forward. This foundation in which I'm dubbing "The Ultra Game Template" is base code and assets to help developers start their next project right. The goal was to have a base layer that did all the "not so fun" but critical elements when building a game such as scene management, input handling, window resizing, etc. The scene/map space is left alone and attaching components works the same if you started your project from scratch and a lot of the back-end stuff can be customized via the config.json file. Here's a list of some of the features. Splash Screen A splash screen is sometimes required for displaying legal notices and is useful for showing the end user that the application is loading in the background. The splash screen can be customized via the config file or disabled entirely. It should also look very familiar. :^) Built-In Settings All engine settings are exposed file the built-in settings window. You no longer need to tell testers to edit any config files ever again! They can now freely change their target display, resolution, graphic settings, and key bindings! Dynamic, Configurable and Easy-To-Use Input System. Coming from the input system from Cyclone, the template has support for key bindings. This is modeled after Steam Input where everything is defined as an action and can be contained in action sets. You can bind the same key to different actions in separated sets. Defining a base scheme is simple as making a function in the main.cpp file and passing the game controller pointer through it. // Define default controls. static void InstallControls(shared_ptr<GameController> controller) { if (controller == NULL) return; // Program actions controller->SetAction("Pause", BUTTON_KEY_ESCAPE); controller->SetAction("Terminate", BUTTON_KEY_END); controller->SetAction("ConsoleApp", BUTTON_KEY_F1); controller->SetAction("Fullscreen", BUTTON_KEY_F11); controller->SetAction("Screenshot", BUTTON_KEY_F2); controller->SetAction("Quick Save", BUTTON_KEY_F5); controller->SetAction("Quick Load", BUTTON_KEY_F6); // Camera ButtonAxis moveaxis = { BUTTON_KEY_W, BUTTON_KEY_S, BUTTON_KEY_A, BUTTON_KEY_D }; controller->SetAction("Movement", moveaxis, "InGameControls"); controller->SetAction("Sprint", BUTTON_KEY_SHIFT, "InGameControls"); controller->SetAction("Crouch", BUTTON_KEY_CONTROL, "InGameControls"); controller->SetAction("Climb", BUTTON_KEY_Q, "InGameControls"); controller->SetAction("Desent", BUTTON_KEY_E, "InGameControls"); controller->SetAction("Camera", AXIS_MOUSE, "InGameControls"); // Settings controller->SetSetting("Raw Mouse", false); controller->SetSetting("Inverse Mouse", false); controller->SetSetting("Mouse Smoothing", 0.0f); controller->SetSetting("Mouse Look Speed", 1.0f); } Then in the settings application will build the binding list for you separating the sets and settings into their own tabs. All of this is built using the engine's API so it's cross platform compatible! Event Based Console A developer console is something you can't live without when developing a game. When called (Default F1), a console window will pop up and will await your input. The commands are event based and there's no registering of commands required. Just put something like this in your component's ProcessEvent function. if (e.id == EVENT_CONSOLEEXECUTE) { auto line = e.text.Split(" "); auto cmd = line[0].ToString(); if (line.size() > 1 && !line[1].empty()) { if (cmd == "mycommand") { Print("Applied command " + QuoteString(cmd) + " to: " + line[1]); } } } Existing commands are: map - loading maps (Example: map box) restart - Restart the existing map. clear - Clears the current map. quit - Terminates the application. You can download it here.
  20. @Josh This is why: shared_ptr<T> AddComponent(const bool start = true) { auto o = GetComponent<T>(); if (o) return o; o = std::make_shared<T>(); std::shared_ptr<Component> c = std::dynamic_pointer_cast<Component>(o); if (c == NULL) RuntimeError("Type must be a Component."); //c->entity = As<Entity>().get(); if (start) c->Start(); m_components.push_back(c); //c->entity = this; c->entityptr = As<Entity>(); auto world = GetWorld(); if (world) { world->entitieswithnewcomponents.insert(As<Entity>()); InternalRecordCollisions(true); } return o; } Assign the entity pointer before calling start! Actually make the start function call the LAST thing it does before returning!
  21. By code. Stage::Stage() { // Menu world and camera. auto sz = GetProgram()->GetFramebufferSize(); menuworld = CreateWorld(); menucamera = CreateCamera(menuworld, PROJECTION_ORTHOGRAPHIC); menucamera->SetPosition(float(sz.x) * 0.5f, float(sz.y) * 0.5f); menucamera->AddComponent<LoadingScreen>(); menucamera->SetHidden(false); // Create the game world. gameworld = CreateWorld(); gameworld->SetLightQuality(GetProgram()->GetSetting(SETTING_LIGHTQUALITY, 1)); // Scene gamescene = NULL; pausestate = false; // Set the menu world as the active world. activeworld = menuworld; } If you call a function after it that uses GetEntity(), it'll be fine. A lot of engine changes broke things on my end. My camera component loaded by the map file works fine with this, virtual void Start() { // Enable sound. GetEntity()->Listen(); Listen(EVENT_PAUSESTATE, GetProgram()); Listen(EVENT_GRAPHICSWINDOW, GetProgram()); GetInput()->CenterCursor(); GetInput()->SetCursorHidden(true); GetInput()->SetActiveSet("InGameControls"); }
  22. GetEntity() isn't valid within the component Start function when the old raw pointer was. Place this Start function in any Component. virtual void Start() { auto self = GetEntity(); Assert(self != NULL, "entity is null!"); }
  23. This would be a good editor plug in much like the image generator. This way if people post an example in one language, they can just use GPT to convert the example in the language they are using.
  24. Hopefully I'll see the measurement display soon. 💙
×
×
  • Create New...