Jump to content

Josh

Staff
  • Posts

    24,629
  • Joined

  • Last visited

Everything posted by Josh

  1. I'm going to do some more testing and record a few videos today. Pro version will be released on Steam tomorrow.
  2. Today is not a great time but we can work this out over the next week. It will probably require some additions in the editor to expose more things to Lua.
  3. There is always a way: https://www.ultraengine.com/learn/Terrain_SetLayerWeight It should be possible to use that to add an editor extension that does this...
  4. The problem is not related to culling or the vertex pipeline, because if I fly underneath it and look up so I am looking at the backside of the polygons, it runs just fine.
  5. Oh wow, simply having your terrain selected makes the rendering super super slow if any of it is onscreen...
  6. It will be released on Steam Monday.
  7. I fixed the undo/redo problem for cut and paste operations, on dev channel
  8. In Options > Viewports there's a setting for tessellation.
  9. I changed it so that even if the option for "render during drag" is enabled, the terrain editing will not cause other viewports to redraw until you release the mouse. I believe this fixes the issue reported here.
  10. Can you provide some files that will trigger this error?
  11. Okay, I believe I have this fixed and it will be uploaded in a build tomorrow. Note that in your example,. the saved state cannot be reloaded unless it was saved during the same session, because your entities are created in code. Entities do not have a unique identifier unless they are either loaded from a map that specifies their UUID, or upon the first call to GetUuid().
  12. I can confirm the Reload() method is not written in a way that supports this correctly and I need to change it a bit...
  13. The behavior has been changed so this does not happen anymore, in dev channel.
  14. Okay, another reason to switch the component to using processed mouse events.
  15. Have not tested with anyone else yet but I think this will handle player movement: #include "UltraEngine.h" #include "Steamworks/Steamworks.h" #include "ComponentSystem.h" using namespace UltraEngine; class Player : public Object { public: static inline std::map<uint64_t, shared_ptr<Player> > players; shared_ptr<Entity> entity; WString name; uint64_t userid; static std::shared_ptr<Player> Spawn(shared_ptr<World> world, const uint64_t userid) { auto player = std::make_shared<Player>(); player->entity = CreatePivot(world); auto model = CreateCylinder(world, 0.25, 1.8); model->SetPosition(0, 0.9, 0); model->SetParent(player->entity); model->SetCollider(nullptr); player->userid = userid; Player::players[userid] = player; return player; } }; struct PlayerState { Vec3 position; Vec3 velocity; float yaw, omega; }; int main(int argc, const char* argv[]) { // Initialize Steam if (not Steamworks::Initialize()) { RuntimeError("Steamworks failed to initialize."); return 1; } // Get the displays auto displays = GetDisplays(); // Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280 * displays[0]->scale, 720 * displays[0]->scale, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); // Create a framebuffer auto framebuffer = CreateFramebuffer(window); // Create world auto world = CreateWorld(); world->SetGravity(0, -18, 0); // Create lobby auto lobby = Steamworks::CreateLobby(Steamworks::LOBBY_PRIVATE); // Spawn local player auto player = Player::Spawn(world, Steamworks::GetUserId()); player->entity->AddComponent<FirstPersonControls>(); //Add a floor auto floor = CreateBox(world, 50, 1, 50); floor->SetPosition(0, -0.5, 0); auto mtl = CreateMaterial(); mtl->SetTexture(LoadTexture("https://github.com/UltraEngine/Documentation/raw/master/Assets/Materials/Developer/griid_gray.dds")); floor->SetMaterial(mtl); auto light = CreateDirectionalLight(world); light->SetRotation(55, 35, 0); // Main loop while (not window->KeyDown(KEY_ESCAPE) and not window->Closed()) { while (PeekEvent()) { const auto e = WaitEvent(); switch (e.id) { case Steamworks::EVENT_LOBBYINVITEACCEPTED: case Steamworks::EVENT_LOBBYDATACHANGED: case Steamworks::EVENT_LOBBYUSERJOIN: case Steamworks::EVENT_LOBBYUSERLEAVE: case Steamworks::EVENT_LOBBYUSERDISCONNECT: auto info = e.source->As<Steamworks::LobbyEventInfo>(); auto username = Steamworks::GetUserName(info->userid); switch (e.id) { case Steamworks::EVENT_LOBBYINVITEACCEPTED: Print("Invite accepted to lobby " + String(info->lobbyid)); if (not Steamworks::JoinLobby(info->lobbyid)) { Print("Failed to join lobby"); } break; case Steamworks::EVENT_LOBBYDATACHANGED: Print("New lobby owner " + username); break; case Steamworks::EVENT_LOBBYUSERJOIN: Print("User " + username + " joined"); if (not Player::players[info->userid]) { // Spawn remote player Player::Spawn(world, info->userid); } break; case Steamworks::EVENT_LOBBYUSERLEAVE: Print("User " + username + " left"); // Remove remote player Player::players[info->userid] = nullptr; break; case Steamworks::EVENT_LOBBYUSERDISCONNECT: Print("User " + username + " disconnected"); // Remove remote player Player::players[info->userid] = nullptr; break; } break; } } // Receive data PlayerState state; while (true) { auto pak = Steamworks::GetPacket(); if (not pak) break; if (pak->data->GetSize() == sizeof(PlayerState)) { auto player = Player::players[pak->userid]; if (player) { pak->data->Peek(0, (const char*)&state, pak->data->GetSize()); player->entity->SetPosition(state.position); player->entity->SetRotation(state.yaw); } } } // Send player data auto userid = Steamworks::GetUserId(); auto player = Player::players[userid]; state.position = player->entity->position; state.yaw = player->entity->rotation.y; Steamworks::BroadcastPacket(&state, sizeof(PlayerState), 0, Steamworks::P2PSEND_UNRELIABLENODELAY); // Enable voice chat when the C key is pressed bool record = window->KeyDown(KEY_C); Steamworks::RecordVoice(record); if (record) { window->SetText("Ultra Engine (Microphone Enabled)"); } else { window->SetText("Ultra Engine"); } // Update world world->Update(); // Render world world->Render(framebuffer); // Update Steamworks Steamworks::Update(); } // Close Steam Steamworks::Shutdown(); return 0; }
  16. This supports voice chat and allows you to join and invite other users to your lobby. You need to be using the dev branch for this. #include "UltraEngine.h" #include "Steamworks/Steamworks.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { // Initialize Steam if (not Steamworks::Initialize()) { RuntimeError("Steamworks failed to initialize."); return 1; } // Get the displays auto displays = GetDisplays(); // Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280 * displays[0]->scale, 720 * displays[0]->scale, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); // Create a framebuffer auto framebuffer = CreateFramebuffer(window); // Create world auto world = CreateWorld(); // Create camera auto camera = CreateCamera(world); // Create lobby auto lobby = Steamworks::CreateLobby(); // Main loop while (not window->KeyDown(KEY_ESCAPE) and not window->Closed()) { while (PeekEvent()) { const auto e = WaitEvent(); switch (e.id) { case Steamworks::EVENT_LOBBYINVITEACCEPTED: case Steamworks::EVENT_LOBBYDATACHANGED: case Steamworks::EVENT_LOBBYUSERJOIN: case Steamworks::EVENT_LOBBYUSERLEAVE: case Steamworks::EVENT_LOBBYUSERDISCONNECT: auto info = e.source->As<Steamworks::LobbyEventInfo>(); auto username = Steamworks::GetUserName(info->userid); switch (e.id) { case Steamworks::EVENT_LOBBYINVITEACCEPTED: Print("Invite accepted to lobby " + String(info->lobbyid)); if (not Steamworks::JoinLobby(info->lobbyid)) { Print("Failed to join lobby"); } break; case Steamworks::EVENT_LOBBYDATACHANGED: Print("New lobby owner " + username); break; case Steamworks::EVENT_LOBBYUSERJOIN: Print("User " + username + " joined"); break; case Steamworks::EVENT_LOBBYUSERLEAVE: Print("User " + username + " left"); break; case Steamworks::EVENT_LOBBYUSERDISCONNECT: Print("User " + username + " disconnected"); break; } break; } } // Enable voice chat when the C key is pressed bool record = window->KeyDown(KEY_C); Steamworks::RecordVoice(record); if (record) { window->SetText("Ultra Engine (Microphone Enabled)"); } else { window->SetText("Ultra Engine"); } // Open friend invite interface when space key is pressed if (window->KeyHit(KEY_SPACE)) { lobby = Steamworks::CurrentLobby(); if (lobby) Steamworks::InviteFriends(newlobby); } // Update world world->Update(); // Update Steamworks Steamworks::Update(); // Render world world->Render(framebuffer); } // Close Steam Steamworks::Shutdown(); return 0; }
  17. Fixed on dev branch: #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto world = CreateWorld(); auto brush = CreateBoxBrush(world, 1, 1, 1); auto pick = world->Pick(Vec3(-2), Vec3(1, 1.5, 2)); Print(String(pick.normal.x) + ", " + String(pick.normal.y) + ", " + String(pick.normal.z)); return 0; }
  18. Try deleting the "C:\ProgramData\Ultra Engine" folder.
  19. Got rid of the Lobby and Leaderboard classes and replaced them with procedural function that just accept the IDs. This feels closer to the Steamworks API, which I think is fine. I don't think I need to try to reimagine that API in Ultra style: https://www.ultraengine.com/learn/Steamworks
×
×
  • Create New...