Jump to content

Yue

Members
  • Posts

    2,449
  • Joined

  • Last visited

Everything posted by Yue

  1. https://www.ultraengine.com/community/applications/core/interface/file/attachment.php?id=19023&key=ed9d8c7437710a1384bbc3b62955f7fd AstrocucoX.rarI don't know what I'm doing wrong, see this is the example, when I press the escape key, everything goes up in ram memory usage in an uncontrolled way.
  2. --Create a window window = Window:Create() context = Context:Create(window) world = World:Create() local camera = Camera:Create() camera:Move(0,0,-3) local light = DirectionalLight:Create() light:SetRotation(35,35,0) model = Model:Box() model:SetColor(0.0,0.0,1.0) local gui = GUI:Create(context) local base = gui:GetBase() base:SetScript("Scripts/GUI/Panel.lua") base:SetObject("backgroundcolor",Vec4(0,0,0,0.1)) pnl = Widget:Panel(300,100,200,200,base) cam = Camera:Create() while true do if window:Closed() or window:KeyHit(Key.Escape) then return false end --Time:Pause() pnl:Hide() model:Turn(0,Time:GetSpeed(),0); Time:Update() world:Update() world:Render() context:DrawStats(10, 10) context:Sync(false) collectgarbage() end
  3. --Create a window window = Window:Create() context = Context:Create(window) world = World:Create() local camera = Camera:Create() camera:Move(0,0,-3) local light = DirectionalLight:Create() light:SetRotation(35,35,0) model = Model:Box() model:SetColor(0.0,0.0,1.0) local gui = GUI:Create(context) local base = gui:GetBase() base:SetScript("Scripts/GUI/Panel.lua") base:SetObject("backgroundcolor",Vec4(0,0,0,0.1)) pnl = Widget:Panel(300,100,200,200,base) cam = Camera:Create() while true do if window:Closed() or window:KeyHit(Key.Escape) then return false end Time:Pause() pnl:Hide() model:Turn(0,Time:GetSpeed(),0); Time:Update() world:Update() world:Render() context:DrawStats(10, 10) context:Sync(false) collectgarbage() end This is a simple example, where the memory goes up. Lua Script.
  4. I guess if it comes out on steam I'll have to wait for the summer sales in about two years to buy it. ;)
  5. I don't think Josh has time for this now, nor does he think he might be interested in it, the result is video I have in this thread, the memory goes up unchecked. The solution from my side is to create a GUI for each particular panel, menu, options etc.
  6. void CGUI::Update() { pnlMenu->Show(); // Memory usage goes up uncontrollably. if (input.GetKeyHit(Key::Escape)) { show = 1 - show; } if (show) { pnlMenu->Show(); Time::Pause(); } if(!show) { pnlMenu->Hide(); Time::Resume(); } } Nothing happens, the memory keeps going up. I have identified the one that causes the problem, it is when I try to display the panel that contains my three start menu buttons. Every time I show it the memory usage goes up, if I put inside the method it starts to go up uncontrolled. So how do I confirm that if it is a bug, by hiding the whole Gui I don't have that problem. Gui->Hide(); No problem.
  7. At this point I don't know what to do, because it happens when I show the menu and pause the application.
  8. I don't understand the visual studio c++ compiler tells me that there is no such garbage collection function.
  9. o.O?? 1>------ Operación Compilar iniciada: proyecto: AstrocucoX, configuración: Release Win32 ------ 1>cl : Línea de comandos warning D9035: La opción 'Gm' está desusada y se quitará en próximas versiones 1>cl : Línea de comandos warning D9030: '/Gm' es incompatible con el multiprocesamiento; se omitirá el modificador /MP 1>CGUI.cpp 1>f:\leadwerks\projects\astrocucox\source\cgui.cpp(51): error C3861: 'collectgarbage': no se encontró el identificador 1>Generando código... 1>Compilando... 1>CInput.cpp 1>Generando código... 1>Omitiendo... (no se detectaron cambios relevantes) 1>main.cpp 1>CWorld.cpp 1>CWindow.cpp 1>CRover.cpp 1>CPlayer.cpp 1>Compilación del proyecto "AstrocucoX.vcxproj" terminada -- ERROR. ========== Compilar: 0 correctos, 1 incorrectos, 0 actualizados, 0 omitidos ==========
  10. void CGUI::Update() { //HideMenuStart(); << Solved temporal. if (show) { ShowMenuStart(); Time::Pause(); } else { HideMenuStart(); Time::Resume(); } if (input.GetKeyHit(Key::Escape)) { show = 1 - show; } } This partially solves the problem. When I uncomment that line of code it no longer uploads the memory when the game is paused. What happens now is that it goes up a little, for each time I make visible the start menu of the three buttons, the memory usage in C++ and in Script goes up. If someone has any idea why this happens I would appreciate it, or if it is something normal.
  11. I only have a terrain, a directional light, the character and the vehicle. The code is structured in the Input object, Player object, Rover object, Windows object. But the strange thing is that it only happens when I pause the game and show the menu. Time::Pause(). //Code Main. #include "App.h" using namespace Leadwerks; int main() { CWindow window("App Title", 1280, 720); CWorld menu; menu.LoadMap("Menu.map"); CInput input; CRover rover(input); CGUI gui(input); CPlayer player(input,rover,gui); // Bucle principal. while (!window.GetClosed()) { if (input.GetKeyDown(Key::H)) { return 0; } Time::Update(); gui.Update(); menu.Update(); menu.Render(); player.Update(); rover.Update(); window.ShowDebugInfo(); player.DrawHand(window.GetContext()); window.Update(false); } return 0; } GUI Show HIde Menu. #include "CGUI.h" using namespace Leadwerks; // Constructor. CGUI::CGUI(CInput& input) :input(input) { window = Window::GetCurrent(); context = Context::GetCurrent(); gui = GUI::Create(context); base = gui->GetBase(); StartHUD(); StartMenu(); show = 0; } void CGUI::StartHUD() { Widget* pnlHud = Widget::Panel(window->GetWidth() - 230, 10, 200, 100, base); } void CGUI::StartMenu() { pnlMenu = Widget::Panel(window->GetWidth()/2-250, window->GetHeight()-150, 500, 75, base); // Butons. btnStart = Widget::Button("START", 10, 15, 150, 50, pnlMenu); btnOptions = Widget::Button("OPTIONS", pnlMenu->GetSize(true).x/2-75,15,150,50,pnlMenu); btnExit = Widget::Button("EXIT", pnlMenu->GetSize(true).x -160, 15, 150, 50, pnlMenu); } void CGUI::HideMenuStart() { pnlMenu->Hide(); } void CGUI::ShowMenuStart() { pnlMenu->Show(); } void CGUI::Update() { HideMenuStart(); if (show) { ShowMenuStart(); Time::Pause(); } else { HideMenuStart(); Time::Resume(); } if (input.GetKeyHit(Key::Escape)) { show = 1 - show; } } bool CGUI::GetShow() { return(show); }
  12. Someone help me, is this a memory leak?
  13. I think something happened, and I'm sure I responded to this. Well the thing is, is this a memory leak?
  14. Memory remains where it was last time. For example, if the game is paused, it goes up in value, but when you continue the game, it stays at the last value. If it was for example in 100, it goes up continuously until I continue the game, and it remains in for example in 500, if I pause it again it continues going up.
  15. When I set Time::Pause(); it starts to increase the memory usage drastically, both in script and in c++, is that a normal memory leak?
  16. Why does the C++ script memory go up?
  17. GetKeyValue("name");
  18. What is the origin of the lightning?, a mesh? Edit: pickInfo.entity:Hide() --<<< Test.
  19. Yue

    Terrain Painting

    Customized brushes for ground sculpting?
  20. It's amazing that when I see things like this, I am reminded that the Leadwerks engine is very complete and that I am the bad programmer. I'm still learning.
  21. Yue

    pfx_pow.png

    Awwwww, the third image, my obsetion with mars, is great.
  22. Well, dabbling in C++, the results delight me in terms of performance, and focused on optimizing my code, I have to say I thought I would never do things in c++, and in relation to Lua, I feel like I'm a real programmer. xD Sure, the process is slower, the compile times a bit longer, it's just habit, but the performance is encouraging. Besides learning new concepts of classes, constructors, destructors, pointers, all this in coordination with ChatGPT is going slowly but with good results.
  23. It is my coding, lua script is not oriented to the object programming paradigm (Poo), however it can be used without any problem to organize the code. Ç In other words win is a custom object, and instead of using KeyDown, the identifier encapsulates this with a GetKeyDown. But internally it is KeyHit, the most readable would be to call it Input.
×
×
  • Create New...