Jump to content

Paul Thomas

Members
  • Posts

    339
  • Joined

  • Last visited

Everything posted by Paul Thomas

  1. Very nice! How have you been Klepto? It's been a long time and you've come a very long way; great to see!
  2. Ah, thanks! I love learning new things every day. I didn't even know world->SetSkybox() exists either. It's not on here: https://www.leadwerks.com/learn?page=API-Reference_Object_World I need to start relying on just reading the headers LOL Also, for my purposes, I will soon be doing a lot more than just a skybox. Day/night cycles, weather, clouds, etc.. I want the sky to be completely responsible.
  3. Copy and pasted as-is, edit for your purposes, this is a direct recode (with minor additions) of the provided LUA script. #pragma once #include "Leadwerks.h" using namespace Leadwerks; class Spectator { private: // context width int width = 1024; // context height int height = 768; // parent Entity* parent = nullptr; // camera Camera* camera = nullptr; public: Spectator() {} Spectator(int _width, int _height) : width(_width), height(_height) {} Spectator(int _width, int _height, Entity* _parent) : width(_width), height(_height), parent(_parent) {} Spectator(int _width, int _height, Camera* _camera) : width(_width), height(_height), camera(_camera) {} Spectator(int _width, int _height, Camera* _camera, Entity* _parent) : width(_width), height(_height), camera(_camera), parent(_parent) {} void Create() { camera = Camera::Create(); } void Create(Entity* _parent) { parent = _parent; camera = Camera::Create(_parent); } void Create(int _width, int _height) { width = _width; height = _height; camera = Camera::Create(); } void Create(int _width, int _height, Entity* _parent) { width = _width; height = _height; parent = _parent; camera = Camera::Create(_parent); } void Create(int _width, int _height, Camera* _camera) { width = _width; height = _height; camera = _camera; } void SetWidth(int _width) { width = _width; } int GetWidth() { return width; } void SetHeight(int _height) { height = _height; } int GetHeight() { return height; } void SetDimensions(Vec3 dimension) { width = dimension.x; height = dimension.y; } Vec2 GetDimensions() { return Vec2(width, height); } void SetParent(Entity* _parent) { parent = _parent; } Entity* GetParent() { return parent; } void SetCamera(Camera* _camera) { camera = _camera; } Camera* GetCamera() { return camera; } private: bool enabled = true; Vec2 center = Vec2(0.0f, 0.0f); Model* spectator; public: float moveSpeed = 5.0f; float maxSpeed = 50.0f; float speedStep = 5.0f; float moveSmoothing = 0.3f; float radius = 0.5f; float lookSpeed = 0.1f; float lookSmoothing = 0.5f; Vec3 mousePos = Vec3(0.0f, 0.0f, 0.0f); Vec3 cameraRot = Vec3(0.0f, 0.0f, 0.0f); virtual void Initialize() { if (camera == nullptr) { Create(width, height); } center = Vec2(width * 0.5f, height * 0.5f); mousePos = Vec3(center.x, center.y, 0.0f); cameraRot = camera->GetRotation(); spectator = Model::Sphere(8); spectator->SetMass(10.0f); spectator->SetGravityMode(false); spectator->SetBuoyancyMode(false); spectator->SetCollisionType(Collision::Projectile); spectator->SetShadowMode(0); spectator->SetFriction(0.0f, 0.0f); spectator->SetElasticity(0.0f); spectator->SetSweptCollisionMode(true); camera->SetPosition(spectator->GetPosition()); camera->SetParent(spectator); } virtual void Update(Window* window) { if (window == nullptr) return; // debug if (window->KeyDown(Key::F1)) { enabled = !enabled; } if (window->KeyDown(Key::F2)) { camera->SetDebugEntityBoxesMode(!camera->GetDebugEntityBoxesMode()); } if (window->KeyDown(Key::F3)) { camera->SetDebugPhysicsMode(!camera->GetDebugPhysicsMode()); } if (!enabled) return; Vec3 mpos = window->GetMousePosition(); window->SetMousePosition(center.x, center.y); mpos = mpos * lookSmoothing + mousePos * (1 - lookSmoothing); float dx = (mpos.x - center.x) * lookSpeed; float dy = (mpos.y - center.y) * lookSpeed; cameraRot.x = cameraRot.x + dy; cameraRot.y = cameraRot.y + dx; mousePos = mpos; Vec3 move = Vec3(0.0f, 0.0f, 0.0f); if (window->KeyDown(Key::W) || window->KeyDown(Key::Up)) { move.z += moveSpeed; } if (window->KeyDown(Key::S) || window->KeyDown(Key::Down)) { move.z -= moveSpeed; } if (window->KeyDown(Key::D) || window->KeyDown(Key::Right)) { move.x += moveSpeed; } if (window->KeyDown(Key::A) || window->KeyDown(Key::Left)) { move.x -= moveSpeed; } if (window->KeyDown(Key::Q) || window->KeyDown(Key::Space) || window->KeyDown(Key::PageDown)) { move.y += moveSpeed; } if (window->KeyDown(Key::E) || window->KeyDown(Key::ControlKey) || window->KeyDown(Key::PageUp)) { move.y -= moveSpeed; } if (window->KeyDown(Key::Shift)) { moveSpeed = maxSpeed; } else { moveSpeed = 5.0f; } Vec3 velocity = spectator->GetVelocity(false); Vec3 desired = Vec3(move.x, 0.0f, move.z) + Transform::Vector(0.0f, move.y, 0.0f, nullptr, spectator); spectator->AddForce((desired - velocity) * spectator->GetMass() / moveSmoothing, false); spectator->PhysicsSetRotation(cameraRot); } virtual ~Spectator() { delete camera; } virtual void Enable() { enabled = true; } virtual void Disable() { enabled = false; } }; I will edit the class later if needed. Cheers!
  4. You are setting the mouse position to center with this line: window:SetMousePosition(cx, cy) If you have game logic that needs to stop the mouse from being forced to center, then you need to encapsulate this line with that logic.
  5. Paul Thomas

    pfx_pow.png

    Wow! Fantastic results!
  6. I found the Leadwerks Wikidot again, here: http://leadwerks.wikidot.com/
  7. Paul Thomas

    Skybox

    A buddy asked me about the Skybox in my latest blog screenshots. As I had mentioned to him, credit is not mine, I found it perusing the API documents. I'm sure it's somewhere on the forums, but I'm pasting my C++ conversion here. At the time (apparently July 16th) I had shared the code on the "Leadwerks Community Wiki" but my ignorant self had a hard time finding the link again. Please clean this up for your own purposes. This code is an exact copy conversion from the LUA code written by .. not sure .. probably Josh? class Sky { private: Model* sky; Surface* surface; Material* material; public: Sky(Camera* camera) : sky(nullptr), surface(nullptr), material(nullptr) { sky = Model::Create(); surface = sky->AddSurface(); surface->AddVertex(-0.5f, -0.5f, 0.0f, 0.0f, 0.0f, -1.0f); surface->AddVertex(0.5f, -0.5f, 0.0f, 0.0f, 0.0f, -1.0f); surface->AddVertex(0.5f, 0.5f, 0.0f, 0.0f, 0.0f, -1.0f); surface->AddVertex(-0.5f, 0.5f, 0.0f, 0.0f, 0.0f, -1.0f); surface->AddTriangle(2, 1, 0); surface->AddTriangle(0, 3, 2); sky->SetPosition(camera->GetPosition()); sky->SetRotation(camera->GetRotation()); sky->Move(0.0f, 0.0f, camera->GetRange().y - 50.0f); sky->SetScale(camera->GetRange().y * 10.0f); sky->SetParent(camera); material = Material::Load("Materials/Sky/skybox_texture.mat"); sky->SetMaterial(material); } virtual ~Sky() { delete material; delete surface; delete sky; } inline Model* GetSky() { return sky; } inline void SetSky(Model* mesh) { sky = mesh; } inline Surface* GetSurface() { return surface; } inline void SetSurface(Surface* face) { surface = face; } inline Material* GetMaterial() { return material; } inline void SetMaterial(Material* mat) { material = mat; } }; A camera must be provided as seen in the original LUA code. Here is an example: Camera* camera = Camera::Create(); Sky* sky = new Sky(camera); Remember to delete the sky when the game loop is closed. delete sky; The "Materials/Sky/skybox_texture.mat" and texture "Materials/Sky/skybox_texture.tex" is already provided by Leadwerks. This is not for Ultra Engine. Sharing a snippet library doesn't sound like a bad idea. Cheers P.S. I was going to attach a .zip file with my personal "sky.h" file, but I decided to paste here directly (no need to download a .zip for a single file - no, I did NOT try uploading just the H file, I'm just pushing forward at this point): // LEADWERKS 4 / STEAM LEADWERKS C++ // https://leadwerks.com // https://ultraengine.com #pragma once #include "Leadwerks.h" using namespace Leadwerks; // SKY class Sky { private: // skybox mesh Model* sky; // skybox surfaces Surface* surface; // skybox material - @edit: change line 38 to include your own material Material* material; // camera Camera* camera; // material path std::string materialPath; public: // SKY //@notes: A camera is required //@params: CAMERA Sky(Camera* icamera) : sky(nullptr), surface(nullptr), material(nullptr), camera(icamera), materialPath("Materials/Sky/skybox_texture.mat") { Initialize(); } // SKY //@params: CAMERA, string MATERIAL PATH Sky(Camera* icamera, const std::string& ipath) : sky(nullptr), surface(nullptr), material(nullptr), camera(icamera), materialPath(ipath) { Initialize(); } // destructor virtual ~Sky() { delete material; delete surface; delete sky; } // get/set functions inline Model* GetSky() { return sky; } inline void SetSky(Model* mesh) { sky = mesh; } inline Surface* GetSurface() { return surface; } inline void SetSurface(Surface* face) { surface = face; } inline Material* GetMaterial() { return material; } inline void SetMaterial(Material* mat) { material = mat; } private: // Initialize Sky void Initialize() { sky = Model::Create(); surface = sky->AddSurface(); surface->AddVertex(-0.5f, -0.5f, 0.0f, 0.0f, 0.0f, -1.0f); surface->AddVertex(0.5f, -0.5f, 0.0f, 0.0f, 0.0f, -1.0f); surface->AddVertex(0.5f, 0.5f, 0.0f, 0.0f, 0.0f, -1.0f); surface->AddVertex(-0.5f, 0.5f, 0.0f, 0.0f, 0.0f, -1.0f); surface->AddTriangle(2, 1, 0); surface->AddTriangle(0, 3, 2); sky->SetPosition(camera->GetPosition()); sky->SetRotation(camera->GetRotation()); sky->Move(0.0f, 0.0f, camera->GetRange().y - 50.0f); sky->SetScale(camera->GetRange().y * 10.0f); sky->SetParent(camera); material = Material::Load(materialPath); sky->SetMaterial(material); } }; // Example: // Camera* camera = Camera::Create(); // Sky* skybox = new Sky(camera); // If you have a custom material use: // std::string material_path = "path/to/skybox/material.mat"; // Sky* skybox = new Sky(camera, material_path); // // Do not forget to delete when the game loop ends with: delete sky;
  8. Wow! SALVATIONLAND looks great! I will purchase today along with Cyclone!
  9. Hello! This blog was created in 2012, but here I am resurrecting it. The option to create a new blog disappeared when I deleted another old blog that had no articles. Anyways, please ignore the previous entries, because they are really old and outdated. The code shown in those blogs do not work with LE 4, and I don't even think I have the engine that was released around 2012. To catch up a bit; back then I ended up doing contract work with various game engines, then getting the job/career I have now, and I work on personal 2D/3D projects when I get the time. Time is expensive lately, and I'm sure it is for most. I had no work and a large web related contract fell through, and I ended up purchasing Leadwerks on Steam. I was in the middle of finding random new engines or rendering libraries I've never tried before. I saw Leadwerks during the sale, made my purchase on July 7th, and started reading the API. I got nostalgic reading the API and tutorials. Leadwerks 2 with BlitzMax. It was excellent. During those times I had a "Blogger" blog showing my progress learning the engine. I made a bunch of post-process shaders (which I actually need to do again), a day and night cycle, dynamic clouds, and so forth. Great times. So, I started another blog. Laziness and lack of time prevented me from also writing here. I wasn't sure when I started if I would even make a game. I'm still not sure. My day job is fairly relaxed right now, but it often jumps into 12 hour days at times during the Summer. Maybe I can get myself to keep returning even if I only have 30 minutes of time available. Now, to explain the map used as my Featured Photo. That is the result of my Biome Generator. Technically, it's just written in C++, but overall it's for a Leadwerks project. You can think of it as a Minecraft clone, but I don't like the word "clone." I will have custom gameplay, points of interest, and so on. I don't have a copy of Minecraft source code either, so my results are from trial and error. Procedurally generated terrain is the shared major difference, and the decision to use blocky art. The biome map shown is actually seed #18446744073709551614 (not joking) and is 2048x2048. This is roughly 8 regions worth (8 chunks, and each chunk has 16 blocks) and has 40 different biomes, which include mixed/blended biomes, and generated under the constraints of a temperature map. If you look closely, it includes rivers, ponds, even beaches and coasts. You can read more detail about those development days here: https://leadwerks-scavenge.blogspot.com/2023/07/biome-generation.html The attached images are the results from development yesterday into this morning (date of this blog posted - yes, I'm tired). It's entirely experimental, but it's basically what I want. I need caves under the ground, and in the end it looks like several layers of caves in a single 16x16 chunk.. I think. At the end I threw in some textures so it wasn't just white. I have a LOT of work to do to add all of the block types. Thanks to SpiderPig for the SimplexNoise library! If you want to read the details you can here: https://leadwerks-scavenge.blogspot.com/2023/07/3d-landscapes.html Starting on the next blog I will write it on Leadwerks first, and then copy & paste over to Blogger. I may just leave Blogger out of it from now on. Thanks for reading! P.S. The game name is "Scavenge." The name "Scavenge" is actually the name of a game I had designed on paper meant for a post-apocalyptic world. It's too ambitious for a single person with no extra budget. I'm stealing the name from myself for this project.
  10. Oh yeah, sol is way easier. Thanks
  11. I apologize if this has already been answered, but the answers I've found don't seem to work. The answers are also from 2015 if I'm not mistaken, and I tried those answers in multiple ways to expose a C++ class to LUA. How do we expose C++ classes to LUA? Thanks!
  12. You're welcome man. I'm glad I was able to help.
  13. I am interested in trying this with my DK2. Anyone tried with the latest build and Oculus version/drivers/etc? Thanks
  14. I voted on an RTS because it can give everyone plenty of features and would consume less time than a full RPG. I would have said vehicles because they don't exist yet, but I was thinking that a game template for vehicles wouldn't be as important as documentation and an example vehicle for a newly releasing feature. Learn the vehicle instead of the template or the game. My second vote would be RPG if you have the time and resources.
  15. Thanks Pixel Yeah, I guess it keeps things interesting, lol.
  16. I figured I would finally write up an update. The plan was to juggle between my main project, which has been in development for three years now, and this Leadwerks project I had started. The idea was simply for the fun and experimentation of game development and programming. Which is great, was going great, as Leadwerks automatically gives that overall creative freedom; designing/programming everything from the ground up if you so desire. That is after all one of the reasons we all love LE. A couple weeks or so after my last blog here at LE my main project hit a milestone that put us into closed beta stage. A very exciting time, especially for a large project you've been working on for years, and the first time you gather valuable input from people that are new to the game as our view of it all starts to get stale. Their input leads to additional tasks which gain utmost importance, especially things accidentally overlooked, which are usually user friendly aspects of the game (easily accidentally overlooked by developers). This all would be the first curve of the curve ball for the LE project. I was then introduced to another curve of the curve ball; Hurricane Sandy. My area didn't get hit as bad as other area's, but we indeed had taken a beating with 60 to 80 miles per hour winds. The situation is escalated when, like myself, you're surrounded by tree's, or like me your house is right next to a forest. Perfect ammunition for a hurricane with a dose of some bad luck. Needless to say that curve ball had some interesting twists. Beyond damages caused I ran into other interesting circumstances such as flat tires most likely caused by driving over debris when heading out for building materials. Among it all I also lost my only PC which I use for game development, but at least I thankfully have my work on several backup mediums. My situations don't even come close in comparison to the people in New York and New Jersey, who got the real raw end of the deal, so I have no need to complain, and I haven't. I don't know how to end this blog. I, of course, plan to get my PC back into working order, but home repairs and bills come first. Once I have everything back in order I will continue where I left off. My main project comes first though and already had a list of tasks before which have only increased as expected. I'm definitely extremely anxious to get back to it all. I'm also tired of using my droid razor for everything. Thanks for reading and a huge thanks to my friends for all of their help.
  17. Great work as always, Ken. Don't worry about long blogs man, I enjoy reading them, and I'm sure others do as well. It's actually one of a handful of reasons I keep an eye out on the blogs page. I personally also keep a clear separation of definition between path-finding and AI. I guess it's just personal taste. Just as I don't consider the actual movement of an object as part of path-finding or AI, leaving AI simply to the definition of behavior and decisions; which also work together. All-in-all you have the results you were looking for, which look flawless, and done at a quick pace. Kudos, man. I look forward to more game-play mechanics you create and the blogs to follow, including long one's (or "blooks" lol).
  18. I highly recommend Macklebee and Marley's Ghost for closed beta invite. I believe everyone, especially the veterans here, would agree and know exactly why they deserve the invite. Congratulations on moving to closed beta milestone, Josh. EDIT: Throw Pixel Perfect into that list too.
  19. Great work and progress, Ken. Those thoughts are the same we all have to battle, just keep moving forward bud.
  20. I'm in the same boat as Naughty Alien. Purchasing to support Josh but I have no actual use for LE3D at the moment.
×
×
  • Create New...