Jump to content

Bytecroc

Members
  • Posts

    56
  • Joined

  • Last visited

Profile Information

  • Location
    Germany Baden-Württemberg

Recent Profile Visitors

5,462 profile views

Bytecroc's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

13

Reputation

  1. an editor field for colored text input and different font
  2. My tactic right now is to wait until LE5 is published. Since it is most likely very different from LE4, I no longer invest as much time in LE4 programming. I hope it comes out soon.
  3. I must make first a few tests, identify models from map and vegetation from map if this is possible. I need also different spawn points for the camera, it would be the best I implement a developer class for programming and grab them out for release versions. In this map I used I have not set a camera and no player, only the map itself. I posted that only for C++ users which have that same problem and did not find anything in the search function. But anyway thank you for help and suggestions.
  4. Yes, but if I want to have a dynamic weather system I will do that in C++ to have the control, I am not a Lua programmer. In the moment I want only a fix weather it is good to have it with the map. But thank you anyway for your info.
  5. I worked the half day on that problem and I think I give the information to everyone who also has this problem with fog. In the Editor fog looks a little bit like fog. Without implementig fog in C++ source, no fog is visible in C++. Loading a map after craeting a camera only a touch of a color is visible in the very far, and fog is not working as it should. I mean with map not a terrain, I loaded a map with only a plattform and some prefabs. I have not tested with terrain. So load a map before creating a camera. Nothing works correct if you not do that.
  6. I searched in the forum but found no artice with a link for TreeIt. It is a nice tree generator http://www.evolved-software.com/treeit/news
  7. First I load a prefab I saved "2 sliding doors, with slidingdoor.lua script", the first prefab works as it should. I loaded the prefab and it did not work. I duplicate the existing prefab in the editor and did not work. I checked all entries, all perfect. I looked in flowgraph editor all perfect ... but wait, it looks only perfect. The duplicated prefab lays directly over the first and when I click the first prefab the Tab from the first are on top when I clicked on the second prefab and look in the flowgraph the second Tabs are on top and it looks they where connected. I move the tabs around and they are not connected, they are both in the flowgraph but the second was not connected. After I connect them it works.
  8. Since 3 years I have not programmed anything with Leadwerks, that has nothing to do with Leadwerks it was a real life thing. So I must learn the stuff from the beginning. My natural language is not English, I hope you can forgive me a mistake or two . If you want test the code you make a new project and a map. I made some test objects to see if climbing fails or not and under which steps I can crouch and on which step I can jump. I make this blog for me to save the source code. Two times in my life I lost nearly all my source I programmed by HardDrive crashes. So it is a nice thing to have that online. And for beginnes to have a start code. In your project folder, by me in "documents/Leadwerks/Projects/.... <-- here are my Projects" you have a subfolder also named projects: "documents/Leadwerks/Projects/ProjectName/projects/" by me in the folder windows is the VisualStudio 17 project: "ProjectName.sln" << Start this with Doubleclick, but first install VisualStudio. I delete all the stuff inside main.cpp, App.cpp and app.h and put the following code in main.cpp change your mapname > "YouMapName.map" from your project and compile. I can not say whats the menu names in english because I have the german GUI. For VisualStudio tutorials look in the Web or YouTube, I am sure there are dozens of them. #include "Leadwerks.h" #include <string> using namespace Leadwerks; int screenwidth = GetSystemMetrics(0); int screenheight = GetSystemMetrics(1); Window* window; Context* context; World* world; Model* thePlayer; Camera* theCam; // declare functions that we need, they are used once so I made them inline for faster code. inline void Start(); inline void loop(); inline void DrawInfo(); //crouch, crawl, jog, run // used for mouse handling Vec3 mausdata = Vec3(0, 0, 0); float mausx = 0.0; float mausy = 0.0; // used for player movement Vec3 mdat = Vec3(0, 0, 0); Vec3 ppos = Vec3(0, 0, 0); Vec3 velo = Vec3(0, 0, 0); float walk = 0.0; float strafe = 0.0; float jump = 0.0; float crouch = 0.0; float strafespeed = 2.0; float movespeed = 2.4; float jumpspeed = 5.0; bool cdown = 0; bool sdown = 0; // used for mainloop bool mainloop = true; // mainfunction int main(int argc,const char *argv[]) { // hold the mainfuntion small and insert what we need with an inline function. Start(); // mainloop while (mainloop) { loop(); // Here is the most mailoop stuff if (window->Closed() || window->KeyDown(Key::Escape)) mainloop = false; //Quit if ESC is pressed Leadwerks::Time::Update(); world->Update(); world->Render(); // For holding the mainloop small put all drawing stuff inside an inline function. DrawInfo(); context->Sync(true); } return 0; } // Inline functions we use only once. inline void DrawInfo() { // For the first, all the drawing stuff in this funtion. context->SetBlendMode(Blend::Alpha); context->SetColor(1.0, 1.0, 1.0); context->DrawText("Camera Rotation: " + theCam->GetRotation().ToString(), 2, 2); context->DrawText("Player Position: " + thePlayer->GetPosition().ToString(), 2, 40); context->DrawText("Player Position: " + std::to_string(ppos[0]), 2, 70); context->DrawText("Player Position: " + std::to_string(ppos[1]), 2, 100); context->DrawText("Player Position: " + std::to_string(ppos[2]), 2, 130); context->DrawText("UPS: " + String(Time::UPS()), 2, 160); context->DrawText("Velocity: " + thePlayer->GetVelocity().ToString(), 2, 190); // a way to check if the player is not on ground, for possibly later use. if (thePlayer->GetAirborne()) { context->DrawText("In the air", 2, 220); } context->SetBlendMode(Blend::Solid); } inline void Start() { // Window //window = Window::Create("",0,0, 2560, 1440, Window::Fullscreen); //window = Window::Create("", 0, 0, screenwidth, screenheight, Window::Fullscreen); window = Window::Create("", 0, 0, screenwidth, screenheight); context = Context::Create(window); window->Maximize(); // The world world = World::Create(); // The player that we need for "First Player Sight" thePlayer = Model::Create(); thePlayer->SetPhysicsMode(Entity::CharacterPhysics); thePlayer->SetPosition(0, 5, 0); thePlayer->SetMass(1); // Put the camera as a child to the player, so we can move and look up and down separately theCam = Camera::Create(thePlayer); theCam->SetPosition(0,1.65,0); // Font we use for drawing operations Font* font = Font::Load("Fonts/Arial.ttf", 12); context->SetFont(font); // Map //Map::Load("Maps/TheWorld.map"); Map::Load("Maps/BetonMap.map"); // <<<<----- put here your mapname ............................................. } inline void loop() { ppos = thePlayer->GetPosition(); mausdata = window->GetMousePosition(); mausx += (mausdata[0] - window->GetWidth() / 2) * 0.1; mausy += (mausdata[1] - window->GetHeight() / 2) * 0.1; window->SetMousePosition(window->GetWidth() / 2, window->GetHeight() / 2); // not Shift: walk if (!window->KeyDown(Key::Shift) && sdown == 1) { sdown = 0; movespeed = 2.4; } //Shift: run if (window->KeyDown(Key::Shift) && sdown == 0) { sdown = 1; movespeed = 5.0; } // not CTRL: stay if (!window->KeyDown(Key::ControlKey) && cdown == 1) { cdown = 0; movespeed = 3.0; ppos = thePlayer->GetPosition(); theCam->SetPosition(0,1.65, 0); crouch = 0; } // CTRL: crouch if (window->KeyDown(Key::ControlKey) && cdown == 0) { cdown = 1; movespeed = 1.0; crouch = 1; ppos = thePlayer->GetPosition(); theCam->SetPosition(0,0.95,0); } // Walk with movespeed when press Key W walk = (window->KeyDown(Key::W) - window->KeyDown(Key::S)) * movespeed; strafe = (window->KeyDown(Key::D) - window->KeyDown(Key::A)) * strafespeed; // check if player is on ground, this means velo[1] = "y direction" has no velocity = 0 // in this way the player kann not jump if he is already in the air. velo = thePlayer->GetVelocity(); if (velo[1] == 0.0) { jump = window->KeyHit(Key::Space) * jumpspeed; } else { jump = window->KeyHit(Key::Space) * 0.0; } if (mausy > 50.0) mausy = 50.0; if (mausy < -90.0 ) mausy = -90.0; thePlayer->SetInput(mausx, walk, strafe, jump, crouch); //void SetInput(float angle, float move, float strafe = 0, float jump = 0, const bool crouch = false, const float maxaccel = 1, const float maxdecel = 0.5, const bool detailed = false, const float maxrotationspeed = 5.0) theCam->SetRotation(mausy, 0, 0); mdat = theCam->GetRotation(); } The next step I will made is to put the code into a class. Use the C Key for toggle crouching and use the CTRL for faster runnig, the I have walk with Key W, jogging with Shift+W and running with CTRL and W.
  9. Bytecroc

    Key down

    For C++ this is possibly a suggestion for the problem with some missing key functions http://www.leadwerks.com/werkspace/topic/14370-is-there-a-scan-code-function/
  10. Textures are paintet with a program like Paint or Gimp and much more or Texture Generators for Walls Floors. With Blender you give them a UV map
  11. what did you understand to animate something ? I often read something in the web of animations, and see the whole scene was meant. Something like let us roll a ball over a parkour or something. Or in OpenGL Tutorial something like, now let us program some animations and the result is moving some static objects around. in this case programming is needed. But only animating a model in it's movement or gesture is done by an rigging and skeletton or keyframe animation software like Blender, Fragmotion, 3D Studio Max, Milkshape Anim8tor and much more. If your friend must animate some character with an animation software only, then no programming is needed, but must he also move the characters inside a scene for a movie, then yes, but ask him if C/C++ is needed or if a script language or something else is used.
  12. OK, I was not informed about the speed of LUAJit or better I have not recognized that there is a difference to LUA. LUA was for me a interpreted script and so automatically slow. This let me think about some tests I will made in the near future. And possibly a BASIC to LUA converter.
  13. Nice game! Now what could be better. Pressing ESC should not immediately quit the game. I am too often press it to go out of the inventory or crafting window and the game quits. Starting with rain ? Rain should have a better quality. OK, now starting again and hope I did not press ESC OK, I am dead. Night should be dark but not only black.
  14. This gives you an overview how slow lua is against C/C++ http://benchmarksgame.alioth.debian.org/u64/which-programs-are-fastest.html
×
×
  • Create New...