Jump to content

SpiderPig

Members
  • Posts

    2,318
  • Joined

  • Last visited

Everything posted by SpiderPig

  1. Nope. VS2019 doesn't crash either. Is this normal? I'm sure it never used to be.
  2. No just the one. I'm doing an experiment in VS22... this program below doesn't crash. It does give some warnings. But in some situations it won't even do that. I think in my issue above I'm accessing an element in the array that goes beyond it's size. But it should crash at the array saying it's trying to access an an element that does not exist. I'm going to test this in VS19... it might be a bug with 2022. #include <iostream> int main() { int* myArray = new int[256]; for (int index = 0; index <= 256; index++) { myArray[index] = index; } int value = myArray[300];//will crash here if I make it 512 instead of 300 }
  3. Project won't compile in VS2019 unless build tools v143 is installed but it seems it can't be installed on older version. It can only be used with VS2022. Changing the build tools to use 2019's v142 results in other errors. Probably because it needs something that v142 lacks.
  4. VS2022 is terrible with intellisense not working as it should (mainly with larger projects) and crashes not showing the right info. Like this, I've got an access violation because it says spawn is empty, yet I'm checking if it's nullptr before I execute that code and it's always worked before. Unless there's a better way of checking a shared_ptr is empty?? This code has always worked until I change something else that seems irrelevant - obviously it's not, but... I've had many similar errors that when I finally track down the issue it has nothing do to with what VS is telling me. The only thing that might make this type of error possible is multi-threading but I'm not using threads. Hence I'd like to try using VS2019 and see if that gives me any better info. The only problems with shared_ptr's it seems is that some crashes do take you to weird headers and give wrong debugging info. I am curious if anyone else has had problems like this...
  5. Should Ultra be able to be compiled in VS2019?
  6. That is interesting. After about a minute the spheres vanish for 10 or so seconds too. Near to two minutes they vanish again and the shadows do to. Well on my end anyway. Visual Studio shows RAM all over the place, it stabilizes for a bit but then climbs again.
  7. It is defiantly slow. But I think it might be the fact it's an .svg file and that it has to be rasterised into a usable texture in the rendering thread so it can be drawn. I know this was the same for setting a font for the first time too.
  8. SpiderPig

    Artifacts Fixed!

    Great stuff! Glad it didn't take as long as you thought it would.
  9. Here's a small example on how physics on a moving object can be achieved. The physics objects are different to their visual counter parts so that they can be calculated without any rotation. Then using matrix magic the physics position and rotation can be transformed to any moving target. #include "UltraEngine.h" using namespace UltraEngine; Vec3 mousepos = Vec3(0.0f); float move_adjustment = 0.1f; float move_speed = 1.0f; float lookspeed = 0.1f; float looksmoothing = 0.5f; bool enable_camera = true; void UpdatePhysics(shared_ptr<Entity> source, shared_ptr<Entity> target, shared_ptr<Entity> platform = nullptr) { auto pos = source->GetPosition(); auto rot = source->GetRotation(); if (platform != nullptr) { auto matrix = platform->GetMatrix(); matrix = matrix.Inverse(); matrix.t = Vec4(0, 0, 0, 1); pos = TransformPoint(pos, Mat4(), matrix); rot = TransformRotation(rot, Mat4(), matrix); } target->SetPosition(pos); target->SetRotation(rot); } 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, 10, -5); auto light = CreateDirectionalLight(world); light->SetRotation(35, 45, 0); auto floor = CreateBox(world, 10.0f, 0.1f, 10.0f); floor->SetCollider(nullptr); floor->SetPosition(0.0f, -3.0f, 0.0f); floor->SetMaterial(LoadMaterial("Materials\\Developer\\grid01.mat")); auto box = CreateBox(world); box->SetCollider(nullptr); box->SetPosition(2.0f, 2.0f, 0.0f); auto ref = CreateBox(world); ref->SetCollider(nullptr); ref->SetPosition(11, 0, 0); auto player = CreateCylinder(world); player->SetCollider(nullptr); player->SetPosition(0.0f, 5.0f, 0.0f); auto cam_pivot = CreatePivot(world); cam_pivot->SetParent(player); cam_pivot->SetPosition(0.0f, 1.8f, 0.0f); camera->SetParent(cam_pivot); camera->SetPosition(0.0f, 0.0f, -3.0f); camera->SetDebugPhysicsMode(true); //Create physics objects auto f2 = CreatePivot(world); auto ff2 = CreateBoxCollider(10.0f, 0.1f, 10.0f); f2->SetCollider(ff2); f2->SetPosition(0, -3, 0); f2->SetCollisionType(COLLISION_SCENE); auto b2 = CreatePivot(world); auto bb2 = CreateBoxCollider(1.0f, 1.0f, 1.0f); b2->SetCollider(bb2); b2->SetMass(1.0f); b2->SetPosition(2.0f, 2.0f, 0.0f); b2->SetCollisionType(COLLISION_PROP); //player physics object auto player_phys = CreatePivot(world); auto cyl = CreateCylinderCollider(0.5f, 1.0f); player_phys->SetCollider(cyl); player_phys->SetPhysicsMode(PHYSICS_PLAYER); player_phys->SetCollisionType(COLLISION_PLAYER); player_phys->SetMass(1.0f); player_phys->SetPosition(0, 5, 0); bool stage = 0; while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->KeyHit(KEY_F2) == true) { camera->SetWireframe(!camera->GetWireframe()); } if (window->KeyHit(KEY_F3) == true) { camera->SetDebugPhysicsMode(!camera->GetDebugPhysicsMode()); } if (window->KeyHit(KEY_F4) == true) { enable_camera = !enable_camera; } if (enable_camera) { auto _displaySize = window->GetSize(); float cx = Round((float)_displaySize.x / 2.0f); float cy = Round((float)_displaySize.y / 2.0f); auto mpos = Vec3(window->GetMousePosition().x, window->GetMousePosition().y, window->GetMousePosition().z); window->SetMousePosition(cx, cy); mpos = mpos * looksmoothing + mousepos * (1 - looksmoothing); auto dx = (mpos.x - cx) * lookspeed; auto dy = (mpos.y - cy) * lookspeed; auto camrot = cam_pivot->GetRotation(); camrot.x += dy; camrot.y += dx; cam_pivot->SetRotation(camrot); mousepos = mpos; } floor->Turn(0.0f, 0.1f, 0.0f); auto y_angle = cam_pivot->GetRotation().y; auto move = 0.0f, strafe = 0.0f; if (window->KeyDown(KEY_W)) { move = 1.0f; } else if (window->KeyDown(KEY_S)) { move = -1.0f; } if (window->KeyDown(KEY_A)) { strafe = -1.0f; } else if (window->KeyDown(KEY_D)) { strafe = 1.0f; } player_phys->SetInput(y_angle, move, strafe); if (window->KeyHit(KEY_P)) { b2->AddForce(0,200,0); } UpdatePhysics(b2, box, floor); UpdatePhysics(player_phys, player, floor); world->Update(); world->Render(framebuffer); } return 0; }
  10. I think I've nearly got paths & roads working. The answer was using A* pathfinding but stopping whenever it hit an existing path. This way each access point will link up to an existing path. The only problem I can see thus far is some paths are created parallel to each other when in reality they should merge to one or the other. I'll have to experiment with some sort of neighbour check that will weight a path towards an existing one if it's close enough. For now though I think it's time to get a spline mesh going.
  11. I think it did. Josh is currently doing a bit of work on the rendering stuff he said.
  12. Just curious, did you restart the editor after creating it manually?
  13. Your numeric values should be numbers instead of strings. Not sure if this is why it's not showing up though... maybe try creating one ".h" file and another ".cpp" file for the definitions. I think this changed a while back so it might need both files as well as the json file now. Take a look at the default components to see how they work. { "component": { "properties": [ { "name": "m_WalkSpeed", "label": "Walk Speed", "value": 5.0 }, { "name": "m_SprintSpeed", "label": "Sprint Speed", "value": 10.0 } ] } }
  14. Spent today refining an old class. The above shot was generated procedurally from this JSON file. Basically, towns can be created all over a terrain. Each town is made up of districts which can be defined by vertices so can be any closed 2D shape. Each district can hold properties which can also be any 2D shape. Each property can have access points (the blue wireframe at some of the edges) and neighbouring properties are aligned to an edge and allow room for roads if that edge is an access point. Then each property can be filled with a list of models. Right now there's only one and it's placed at the centre of the property. But once each model has a footprint calculated (probably from it's AABB) it can be placed randomly within a property. Hopefully, creating some nice randomized towns. With more defined shapes and models to place I think it'll look quite random. I'm going to try and work on roads next, probably use some sort of mesh spline that weaves between the properties that have access points. { "towns": [ { "name":"TownA", "min_radius":100, "max_radius":250, "min_height":0, "max_height":1000, "min_slope":0, "max_slope":90, "scatter":false, "districts": [ { "name":"DistrictA", "enabled":true, "primary":true, "vertices":[[0,0,4],[29,0,4],[29,0,-6],[20,0,-14],[-7,0,-14],[-10,0,-10],[-6,0,0]], "edge_access":[false,false,false,false,false,false,false], "normal":[0.0,1.0,0.0], "scale":5.0, "path_width":4.0, "zone_buffer":0.25, "properties": [ { "name":"Zone1", "vertices":[[-1,0,-1],[-1,0,1],[0,0,1.5],[1,0,1],[1,0,-1]], "edge_access":[true,true,false,false, false], "scale":5.0 }, { "name":"Zone2", "vertices":[[-1,0,-1],[-1,0,1],[1,0,1],[1,0,-1]], "edge_access":[true,false,true,true,false], "scale":6.0 } ] } ] } ] }
  15. Obviously, terrain needs LOD, but if you want to still see far away towns, boulders, trees or any other objects you're going to need to stop them clipping through the terrain as those far away patches reduce in resolution. If you leave the objects at the height required for the lower LOD level (tile size of 1m) they may be clipped or vanished entirely beneath the surface when that patch reaches a tile size of 8m or 16m as you move away from it. There are three approaches I can think of to solve that but I don't know which one I should go for or if you guys might know of something even better. Don't lower the patch resolution beyond a certain tile size if the patch has certain objects on it. Easy to implement Probably makes the point of terrain LODs redundant as nearly every patch can't go beyond a certain LOD Use the tessellation shader to tessellate the areas of the terrain around certain objects based on a mask, keeping the tile size at that area no bigger than the object footprint. Fast to run Won't know how good it looks until implemented Hard to implement Adjust each object's height to a height picked at the lower patch resolution when that patch changes. Easy to implement Player will see objects pop to new heights in distance This is mostly for my voxel terrain but it pretty much applies to all terrain I think. Hopefully some of you might have some input or some better ideas.
  16. Yikes Ultra is fast! 25FPS 2,500 instanced trees 53 million verts and 19 million polys
  17. I'm about to start work on a foliage system for voxel terrain and just wanted know if the FPS for the amount of vertices and polygons seems reasonable? If so it will tell me how I should proceed. This is only a 16x16 grid of instances so the instance count is off. Bug report is here. 70 FPS for 5.4 million verts and 2 million polys. I am doing a small bit of work in the vertex shader which sways the trees. Disabling that gets me about 100 to 120FPS.
  18. In this example without any instances I have an instance count of 5, If I create an instance of the box that count goes up to 7, not 6. Is this a bug or has it made more instances for the render thread and the world is tracking those too? I need to know because another project of mine my tree model increases the instance count by 4 for each instance even though it's one model. Just want to be sure if it's my model, or a bug, or a natural part of the engines workings. #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Ultra Engine", 0, 0, 1440, 900, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); auto world = CreateWorld(); world->RecordStats(); auto framebuffer = CreateFramebuffer(window); //Create a camera auto camera = CreateCamera(world); camera->SetSweptCulling(true); camera->SetClearColor(0.125); camera->SetFov(70); camera->SetPosition(0, 0, -3); camera->SetRotation(0, 25, 0); auto font = LoadFont("Fonts/arial.ttf"); auto ui = CreateInterface(world, font, framebuffer->size); ui->SetRenderLayers(2); ui->root->SetColor(0, 0, 0, 0); auto w_fps = CreateLabel("FPS : 0", 10, 10, 150, 30, ui->root); auto w_vertices = CreateLabel("Vertices : 0", 10, 30, 150, 30, ui->root); auto w_primitives = CreateLabel("Primitives : 0", 10, 50, 150, 30, ui->root); auto w_instances = CreateLabel("Instances : 0", 10, 70, 150, 30, ui->root); auto ui_cam = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); ui_cam->SetPosition(framebuffer->size.x / 2, framebuffer->size.y / 2, 0); ui_cam->SetRenderLayers(2); ui_cam->SetClearMode(CLEAR_DEPTH); auto light = CreateDirectionalLight(world); light->SetRotation(35, 45, 0); light->SetRange(-10, 10); light->SetColor(5.0f); auto box = CreateBox(nullptr); //Comment out this line and instacne count is 5 //Leave this line uncommented and the instacne count is 7 auto inst = box->Instantiate(world); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { w_fps->SetText("FPS : " + WString(world->renderstats.framerate)); w_vertices->SetText("Vertices : " + WString(world->renderstats.vertices)); w_primitives->SetText("Primitives : " + WString(world->renderstats.polygons)); w_instances->SetText("Instances : " + String(world->renderstats.instances)); world->Update(); world->Render(framebuffer, false); } return 0; }
  19. I just tried your example above and am getting the same result as you after a few clicks back and forth between new game and main menu. It's getting stuck somewhere weird.
  20. You are correct, that was the issue.
  21. I thought that it didn't but that might be my shader editor... I'll add that manually and see if it works.
  22. Thanks, how would this be checked inside an extension? I mean, is there an update event or loop I could add it too to check when I've closed the process?
×
×
  • Create New...