Jump to content

f13rce

Members
  • Posts

    510
  • Joined

  • Last visited

Everything posted by f13rce

  1. For every frame, save it as a material (just like how water is done). After that make an array with all the materials. From there you only need a few variables to loop through the array and assign it to the model. Example of how I'd do it (C++ though, Lua should be similar): Material aMaterials[10]; // For example 10 frames float fCurrentFrame = 0.f; // Start at frame 0 int iMaxFrame = 10; // Amount of frames the array has float fFrameSpeed = 1.0f; // Set desired speed here void Start(){ aMaterials[0] = Material::Load("./Materials/Animation/00.mat"); aMaterials[1] = Material::Load("./Materials/Animation/01.mat"); // etc } void Update(){ // Animate fCurrentFrame += fFrameSpeed; // Note: Deltatime is not applied here // Did we reach our limit? if (fCurrentFrame >= iMaxFrame) fCurrentFrame = 0; // Reset // Assign material model->SetMaterial( aMaterials[ Math::Floor( fCurrentFrame ) ] ); }
  2. You will need Time::GetCurrent() for this. This returns the time the application has been running for in milliseconds. You basically keep a variable with the time of when it's started, and constantly check if the Current time minus the start time (so the elapsed time) is bigger or equal than the requirement. Code would look like this: float fStartTime = 0; float fRequiredTime = 5000; // in milliseconds bool bStartChecking = false; void OnCollision(){ fStartTime = (float)Leadwerks::Time::GetCurrent(); // Have to convert from long long to float bStartChecking = true; } void Update(){ if (bStartChecking){ if ((float)Leadwerks::Time::GetCurrent() - fStartTime >= fRequiredTime){ // Do stuff when time has ended } } }
  3. Some fun project I'm willing to complete before Sunday the 1st: Gameplay only video:
  4. You can try this: Material::SetColor()
  5. Really want to join the hangout, but I'll be celebrating my birthday till 5PM PST.
  6. I believe FindPath() is having a bug where it crashes whenever you try to navigate near an obstacle. It looks like it's failing to plot a path so it just crashes. You can't check it for NULL either. It might have to do with the gap over here: How to recreate it: Preparation: Create a new scene Create a large box as ground Create a box as obstacle in the scene (In C++) Create an object (let's say player) that uses FindPath() to navigate around.* Recreating it: Move close to the obstacle with the player (or just spawn the player near the obstacle) Use FindPath() to move to the other side of the obstacle (preferably near the obstacle as well) Video example: (Skip to 3:27 to see a short version, everything before is how I prepared it) *Code example of moving around: void Unit::SetTargetPoint(Vec3 pos){ //Clear path before use if (path != NULL) path->points.clear(); waypoint = -1; NavPath* p; try{ printf("Finding path... plswork\n"); p = path->navmesh->FindPath(pivot->GetPosition(), pos); } catch (exception& e){ cout << "Exception: " << e.what() << endl; printf("Path could not be made.\n"); return; } //If we can find a path if (p != NULL){ path = p; goTo->SetPosition(path->points.at(0).x, 1, path->points.at(0).z); //goTo is a pivot for calculating distance when moving; basically to see whether we're at our waypoint or not finalGoTo->SetPosition(path->points.at(path->points.size()-1).x, 1, path->points.at(path->points.size()-1).z); //same at goTo, but for our final waypoint //Look at our newest waypoint pivot->Point(goTo, 3); pivot->SetRotation(0, pivot->GetRotation().y, 0); canMove = true; } //Could not find a path else{ canMove = false; waypoint = -1; } } //Not really needed because we only need to plot a path, but maybe nice to have to make testing easier void Unit::MoveToPoint(){ if (!canMove) return; if (path->points.size() <= 0) return; //Just in case... int pps = path->points.size(); //pps = Path Points Size if (waypoint < pps-1){ pivot->Point(goTo, 3); pivot->SetRotation(0, pivot->GetRotation().y, 0); pivot->Move(0,0,GetSpeed()*Time::GetSpeed()); } if (waypoint+1 < pps-1){ if (pivot->GetDistanceToEntity(goTo) < 0.65f){ waypoint++; goTo->SetPosition(path->points.at(waypoint+1).x, 1, path->points.at(waypoint+1).z); pivot->Point(goTo, 3); pivot->SetRotation(0, pivot->GetRotation(false).y, 0); } } }
  7. Nothing too special actually: world = World::Create(); NavPath *np = new NavPath(); np->navmesh = world->navmesh; //np = np->navmesh->FindPath( Vec3(0,0,0) /*from*/, Vec3(5,0,5) /*to*/ ); //To use it np->navmesh->Build( float maxedgelength, int callback(float progress) ); np->navmesh->BuildTile( int x, int y, float maxedgelength, float maxedgeerror );
  8. I'm making an RTS game right now. The editor and all work fine and smooth during the making of it. You can basically create any kind of game with Leadwerks, you just see a lot of FPS games/tutorials because it's easy to set up.
  9. You should try out 3DS Max or Maya. Both are really aimed for professionals so there's a lot to explore. It's free for students.
  10. Yes, the server will require a graphics card. It doesn't need a good one though because at the moment it only draws an image on the screen. I'm not really sure yet how to hide the input lag. I think I can make the actions already happening on the client's screen, but eventually will get synced with the server. Games like LoL also have this. Whenever I purchase an item in LoL I couldn't have purchased according to their server, the item will disappear from my inventory and the amount of money you have gets synced.
  11. It's all made with Leadwerks, even the server. There are no physics in the game, so that makes it a lot easier. It's another reason why I made this thread about navigation without physics. It also just saves a lot of processing power which is nice for a server to have. For example, the player requests to move to a position it has clicked on. The server gets the position the player wants to move to and calls the NavPath->NavMesh->FindPath() function. After getting the path with its points to move to, the server will tell every client a certain unit will now walk to that point via the points of the path. Every client can only read and request. The server will always check if it's a valid request and will process it after.
  12. Some basic gameplay explanation. You can see that the networking is working as well. Everything is server-sided so there can be no cheating.
  13. This should help you out if you're planning on using RakNet: http://www.leadwerks.com/werkspace/page/Leadwerks_2_tutorials/_/programming/raknet-in-leadwerks-tutorial-r80 It was posted in the LE2 tutorials but it works perfectly fine in 3.0 and above. I'd recommend bookmarking it just in case.
  14. (Almost) Everything is working as it should be Unit control, chatting, combat, purchasing units and items via the store and more! I think it's time for some 3D models instead of these placeholders
  15. Working on the networking at the moment for Grievous Grounds using RakNet: Filmed with my phone because I had to film two different computers. Video quality doesn't look to bad I think.
  16. Combat Helo: http://www.combat-helo.com/ Ravage Online: http://www.moddb.com/games/ravage-online And I forgot a very known one... Hoodwin? Hoodkin? Something like that... It actually got released on Steam if memory serves correctly
  17. Using 3.0 at the moment. Waiting for the C++ version.
  18. Have you made sure every entity you're trying to pick has a shape? Basic models like a box and sphere already have a shape. Imported models don't have a shape by default.
  19. Sometimes when I try to call the NavPath->NavMesh->FindPath() function I get weird UPS issues affecting the game. A basic project with just a cube with a built NavMesh gives me 700 UPS on my laptop. After calling FindPath() a few times the UPS "snaps" all the way down to ~30. It also stays solid on ~30. This apparently only happens in debug mode. It does happen in release as well. Way to reproduce: Make a project with a simple scene. Build a NavMesh for the scene Create a NavPath variable and assign its navmesh to world->navmesh Call FindPath() a few times Production rate: Sometimes, just keep spamming the LMB I've included my test project (in C++) simulating the bug. All you have to do is hitting any mouse button on the floor and watch the UPS go down.
  20. Had to pause Grievous Grounds to make an intake assignment for a school I'm willing to go to. My task was to make a 2D game where the theme was "Rolling"... I know Leadwerks isn't 2D, but at least I made it look like it with tricks like setting the camera projection to orthographic and stuff. Here are some screenshots of the game: Simple splash screen. The text "Press space to continue" changes its alpha from 100% to 0% and back slowly. HUD is transparent unless you hover it with the mouse so you can enjoy the fancy physics. Sooo in this game you collect the white dots with the colored balls. You can not control the balls but you can enable and disable objects in the map such as platforms, jump-pads and teleports. After collecting the dots you will have to put the balls all the way down where currently the red ball is. You can reset the balls their position by clicking on them. Resetting doesn't reset their velocity though, so you can mess around with that for different results. Still need to add some visual feedback, sounds and maybe an extra level. I'll put this in the store for free when it's done. Will add the source code as well after my interview for the intake (just to make sure).
×
×
  • Create New...