Jump to content

StOneDOes

Members
  • Posts

    86
  • Joined

  • Last visited

Posts posted by StOneDOes

  1. Since this was moved to bug reports, does this mean that you are aware of some issues already? Just wondering, because the reason I didn't create the thread here is because I'm not sure if there have just been changes and I'm now doing it all completely wrong. Thanks.

  2. Some 6-8 months ago I had successful navigation on terrain, but it seems that something has changed and has broken what I had working. I was originally working off what I had here in this thread: 

    The first sign that something had changed was that Model::SetNavigationMode() no longer exists and had to remove it to make the program compile.

    So the issues I've found so far are:

    • CreateNavMesh() has been changed and now seems to always create the same size mesh no matter the size parameter that I enter
    • I have had to change around the order of positioning the model, nav agent, and attaching the nav agent to the model  to make them not appear at pos (0,0,0)
    • I have to position the objects above the terrain, and they appear to just hover, not actually sit on it like they used to
    • Whether NavAgent::Navigate() returns true or false, the object does not appear to move at all

    Does anyone have a working sample of terrain navigation with the current release? Any help appreciated thanks.

     

    • Thanks 1
  3. Hi guys, I haven't been around too much for a while, and having trouble building my project.

    Apparently I'm missing preprocessor.exe, so I try removing that from pre build step because apparently it is not used anymore. After that the next issue is:

    F:\Ultra Engine Projects\SG23\Source\UltraEngine.cpp(1,10): fatal  error C1083: Cannot open include file: 'UltraEngine.h': No such file or directory

    Rather than me trying to work all these issues out individually, is there a simple way to upgrade that does not involve creating a new project? And honestly I'm not I even sure that know how to create a new project anymore; when pressing new project all I get is a folder with just Ultra.json in it ... I'm real bad at remembering things.

  4. On 1/26/2023 at 6:39 PM, Josh said:

    Please hold tight and trust me that this will get fixed before your game is finished.

    I have no doubt about that. Its just a nuisance for when I'm trying to see what certain effects look like, like my placement grid here:

     

    • Upvote 1
  5. Perfect, thank you. Can you please add a function that returns the element count of Widget::m_kids ? Because that member is protected.

    There is a Widget::CountChildren() but it is commented out.

  6. Is there a way to reorder the depth of UI widgets such that I can choose what should appear at the frontmost of the view? At the moment it seems that widgets render in the order they were created.

  7. I haven't really looked too much into the component system. I thought components would be more relevant if I was creating a world using an editor, such that I could change values and whatnot. But most of my things ingame are created by the user I didn't think it necessary. Correct me if I'm wrong?

    Each playable unit that moves on the ground has a NavAgent, and clearly they all work nicely together. I'm not sure if I like units punching straight through a stationary crowd to get to their destination but I'm sure I can fine tune that.

    Beyond that I have a unit manager in which every playable object needs to be checked each frame in order to update positions on the minimap and to make sure they correctly come to a halt when they are close enough to their next destination, and of course to auto attack enemy units if they come close enough.

    I'm open to suggestions if there are better ways.

  8. It seems when a widget is constantly resized, the UI does not appear to either sync or re-render correctly. Using the following sample of code, use the mouse left click to create and draw a rectangle. You can see the rectangle disappears for moments at a time. It doesn't seem to be too bad by itself, but it becomes extremely noticeable when you add the 3D camera and the terrain. This is mostly just the terrain sample and UI sample glued together.

    See attached video.

    video.zip

     

     

    Can anyone please confirm if this happens on your PC.

    -----------------------------------------------

    CPU - AMD Ryzen 9 3900X 12 Core @3.8GHz
    GFX - AMD Radeon RX 6600 XT
    RAM - Corsair Vengeance RGB PRO 16GB DDR4 @3200MHz

     

     

    #include "UltraEngine.h"
    
    using namespace UltraEngine;
    
    #define MB_LEFT 1
    
    int main(int argc, const char* argv[])
    {
        //Get the displays
        auto displays = GetDisplays();
    
        //Create window
        auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0]);
    
        //Create framebuffer
        auto framebuffer = CreateFramebuffer(window);
    
        //Create world
        auto world = CreateWorld();
    
        //Create a 3d camera
        auto camera = CreateCamera(world);
        camera->SetFov(70);
        camera->SetPosition(0, 50, 0);
        camera->SetRotation(45, 0, 0);
        camera->SetClearColor(0.125);
    
        //Sunlight
        auto light = CreateDirectionalLight(world);
        light->SetRotation(45, 35, 0);
        light->SetColor(2);
    
        //Create terrain
        auto terrain = CreateTerrain(world, 512);
        terrain->LoadHeightmap("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Terrain/512.r16");
        terrain->SetScale(1, 100, 1);
    
        //Create base material
        auto ground = CreateMaterial();
        auto diffusemap = LoadTexture("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/river_small_rocks_diff_4k.dds");
        auto normalmap = LoadTexture("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/river_small_rocks_nor_gl_4k.dds");
        ground->SetTexture(diffusemap, TEXTURE_DIFFUSE);
        ground->SetTexture(normalmap, TEXTURE_NORMAL);
        terrain->SetMaterial(ground);
    
        //Create paint material
        auto rocks = CreateMaterial();
        diffusemap = LoadTexture("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/Rocks_Dirt_Ground_2k.dds");
        normalmap = LoadTexture("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/Rocks_Dirt_Ground_2k_dot3.dds");
        auto dispmap = LoadTexture("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/Rocks_Dirt_Ground_2k_disp.dds");
        rocks->SetTexture(diffusemap, TEXTURE_DIFFUSE);
        rocks->SetTexture(normalmap, TEXTURE_NORMAL);
        rocks->SetTexture(dispmap, TEXTURE_DISPLACEMENT);
    
        //Apply material based on terrain slope
        for (int x = 0; x < terrain->resolution.x; ++x)
        {
            for (int y = 0; y < terrain->resolution.y; ++y)
            {
                float slope = terrain->GetSlope(x, y);
                if (slope > 15.0f)
                {
                    float wt = Min((slope - 15.0f) / 10.0f, 1.0f);
                    terrain->SetMaterial(x, y, rocks, wt);
                }
            }
        }
    
        //Load a font
        auto font = LoadFont("Fonts/arial.ttf");
    
        //Create user interface
        auto ui = CreateInterface(world, font, framebuffer->size);
    
        //Create camera
        auto uiCamera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC);
        uiCamera->SetPosition(float(framebuffer->size.x) * 0.5f, float(framebuffer->size.y) * 0.5f, 0);
        uiCamera->SetClearMode( ClearMode::CLEAR_DEPTH );
    
        auto rect = CreatePanel( 0, 0, 0, 0, ui->root, PANEL_BORDER );
        rect->SetColor( Vec4( 0, 0.f, 0.f, 0.f ), WIDGETCOLOR_BACKGROUND );
        rect->SetColor( Vec4( 255, 255, 255.f, 255.f ), WIDGETCOLOR_BORDER );
        auto mouseDown = false;
        iVec2 clickPos;
    
        while (true)
        {
            while (PeekEvent())
            {
                const Event ev = WaitEvent();
                switch (ev.id)
                {
                    case EVENT_WINDOWCLOSE:
                    {
                        if (ev.source == window)
                        {
                            return 0;
                        }
    
                        break;
                    }
    
                    case EVENT_MOUSEDOWN:
                    {
                        const auto button = ev.data;
                        if( !mouseDown && button == MB_LEFT )
                        {
                            mouseDown = true;
                            clickPos = { window->GetMousePosition().x, window->GetMousePosition().y };
                        }
    
                        break;
                    }
    
                    case EVENT_MOUSEUP:
                    {
                        const auto button = ev.data;
                        if( button == MB_LEFT )
                        {
                            rect->SetShape( 0, 0, 0, 0 );
                            mouseDown = false;
                        }
    
                        break;
                    }
    
                    default:
                    {
                        ui->ProcessEvent(ev);
                        break;
                    }
                }
            }
    
            if( mouseDown )
            {
                auto mousePosition = window->GetMousePosition();
                rect->SetShape( Min( mousePosition.x, clickPos.x ), 
                    Min( mousePosition.y, clickPos.y ), 
                    Abs( clickPos.x - mousePosition.x ) + 1, 
                    Abs( clickPos.y - mousePosition.y ) + 1 );
            }
    
            world->Update();
            world->Render(framebuffer);
        }
    
        return 0;
    }

     

  9. One thing I have not really done before in game development is manage multiple screen resolutions. I understand that the viewport size changes so UI graphics don't actually change size in this case, but the positioning of UI elements has to be managed, right?

    I'm wondering for those of you who have done this before; what you did and what advice you have. Is it as simple as just using multiplication of the different ratios to reposition the UI, or store different positions per resolution? Its not overly important at the stage I'm at right now, but its still something to think about. Thanks.

  10. 8 hours ago, reepblue said:

    @St0neD0esSince Josh fixed that problem now, would not hurt to update your project and report back. 

    When you say to update my project, is this an additional step to updating the software under the updates tab? Something interesting that I did notice that under the Projects tab, is that my project has a green tick on it, but then I clicked Update in the Updates tab (which oddly enough took only like 3 seconds), and now it shows a little yellow triangle on my project where the tick was. Does this mean anything?

    This is why I think it would be idea to display the exact version that the software is running eg. v1.01.123

  11. There are some members of the NavAgent class that are useful but protected such as m_velocity would be ideal to have exposed by public function along with destination member.

    Also the ability to control the rate of which an agent must rotate before fully accelerating should be controllable. A larger value would give the object a larger turning circle, wheras a lower value or 0 would indicate that no actual rotation is required, but instead the model immediately faces the direction of the new destination and starts accelerating.

    If I can think of anything else I'll let you know but thats all for now :) Thanks

    • Like 1
  12. 9 hours ago, SpiderPig said:

    I did start off using shared pointers but through a few simple tests found that raw pointers were faster. 

    They will be, slightly, because you don't have the extra overhead. There isn't anything wrong with raw pointers so long as there is a clear memory management pattern, but may not work well amongst larger teams of developers. With smart pointers you won't have leaks, and generally it is the accepted practise.

     

    9 hours ago, Canardian said:

    Not sure, but according to this description, auto variables are slower and constantly reserve and release memory than statically typed variables - even if both are resolved at compile time:
     

    What is the difference between an auto and non auto variable?
     
     
    Automatic variables create a new each time when program's execution enters in the function and destroys when leaves. Static variable create once, when program's execution enters in the function first time, destroys when program's execution finishes, they do not again.
     

    This has been taken out of context (a link to quoted source is ideal). What you're referring to is the 'auto' keyword used in C, not C++. It is just comparing static variable declaration vs non-static. In C++, the type where auto keyword is used is automatically deduced by the compiler at compile time, and has no impact on performance.

    Its true that static variables may be considered "faster" because your only initialzing them once, and destroying them once, but you'll often require logic to track their value. They have their purposes, but not overly common.

    6 hours ago, SpiderPig said:

    Declaring variables inside a loop should generally be avoided if possible for performace reasons. 

    That's not necessarily true. You'll find that the compiler will optimize this and the difference will likely not be measurable or even existent.

    • Like 1
×
×
  • Create New...