Jump to content

gamecreator

Members
  • Posts

    4,937
  • Joined

  • Last visited

Everything posted by gamecreator

  1. This might be informative regarding the Launcher: https://www.leadwerks.com/community/blogs/entry/2088-game-launcher-and-game-distribution/ The easier thing is likely just having your friend install OpenAL. He can go to the download page and download the Installer (not the SDK): https://www.openal.org/downloads/ It's a super small download (less than 1MB).
  2. Two curiosities: 1. For some reason the vegetation in the distance pops in for me instead of dithering in. This only happens in my C++ program. It's happening in the editor now too. Any idea why this would be? 2. I get controller jitter when walking around, as shown in the video below. This is much less noticeable in fullscreen mode. I wonder if it's related to this: Code looks like this (speed doesn't change; it's always 1.0 right now): float move = (input.up-input.down)*3; float strafe = (input.right-input.left)*3; float jump = input.jump*12; controller->SetInput(input.camerarotation.y, move*(speed+(input.run*0.7)), strafe*speed, jump);
  3. For this reason, it's best to use a pivot as a character controller and parent anything you'd like to it, like so: Model* player_sphere = Model::Box(); player_sphere->SetPosition(0, 0.5, 0); Entity* controller = Pivot::Create(); controller->SetMass(1); controller->SetPhysicsMode(Entity::CharacterPhysics); player_sphere->SetParent(controller, true); Also, it may help you to turn on physics debugging to see what's going on. camera->SetDebugPhysicsMode(true); Great job on all the detail you provided, by the way. It inspired me to jump into Visual Studio to research this.
  4. I really appreciate it Bolt but it's a purchased model so I can't share it. Thank you regardless.
  5. Thank you; I think this is what Iris3D was suggesting as well. I did try both options and nothing changed. The negative scaling is an interesting theory though. It's certainly possible though I don't see how scaling would rotate the 90 degrees on two axes.
  6. Yes, it look like it (including the entity's children). The camera and world picks do any entity in the world (assuming they are part of the collision type).
  7. A possible improvement to this is to use a function like SetFileTime to change the patched exe to match the online patch file. That way you can just compare the two file dates instead of storing the date in a file. Edit: I'm not sure how well this works with Daylight Saving Time and such.
  8. This program checks a file online to see if its timestamp is different from one you have saved. If it's different, it downloads the file and patches your old file with it. This is thanks to the libcurl library (which is bundled with Leadwerks, so you can use it immediately). Usage: Simply create a new C++ project and replace your code with the code below. This prints info to the console so have that enabled if you want to see that (in Visual Studio this in under Project Properties, Linker, System, SubSystem). Make sure you have/create the necessary files and change the first four variables appropriately to point to the proper files. #include "leadwerks.h" using namespace Leadwerks; // This is the patch file we download char onlinepatchfileURL[200] = "http://www.yoursite.com/yourfile.exe"; // This is the name of the temporary downloaded patch file we save char localdownloadedpatchfile[80] = "patchfile"; // This is the executable we replace with the above patch file and then launch char localfiletobepatched[80] = "yourgamefile.exe"; // This file contains the timestamp we compare to the online file above char localtimestampfile[80] = "patchfiletimestamp.txt"; char onlinetimestamp[25]; char localtimestamp[25]; long downloadprogresstimer; // Callback function called regularly by libcurl as a file is downloaded int downloadprogress(void *p, double dltotal, double dlnow, double ultotal, double ulnow) { // Print download progress once a second if(Time::Millisecs()>downloadprogresstimer) { cout << "Downloaded bytes: " << dlnow << " / " << dltotal << "\n"; downloadprogresstimer=Time::Millisecs()+1000; } return 0; } // Compare online timestamp with one we have saved in a file bool ispatchfiletimestampdifferent() { // Retrieve timestamp from local file FILE *fp=fopen(localtimestampfile, "r"); if(fp==NULL) { printf("Error opening local timestamp file: %s\n",localtimestampfile); exit(1); } fgets(localtimestamp, 80, fp); fclose(fp); // Retrieve timestamp from online file // WARNING: some sites may not return a timestamp so this may fail CURL *curl=curl_easy_init(); time_t fileTime = 1; curl_easy_setopt(curl, CURLOPT_URL, onlinepatchfileURL); curl_easy_setopt(curl, CURLOPT_NOBODY, 1); curl_easy_setopt(curl, CURLOPT_FILETIME, 1); curl_easy_perform(curl); curl_easy_getinfo(curl, CURLINFO_FILETIME, &fileTime); curl_easy_cleanup(curl); // Format online timestamp string char buf[80]; struct tm *ts=localtime(&fileTime); strftime(onlinetimestamp, sizeof(buf), "%a %Y-%m-%d %H:%M:%S", ts); // Sanity check to compare two strings // printf("-%s-\n-%s-\n", onlinetimestamp, localtimestamp); // Compare the two dates. Are they different? if(strcmp(onlinetimestamp, localtimestamp)==0) return false; else return true; } bool downloadpatchfile() { CURL *curl; CURLcode res; FILE *fp; curl = curl_easy_init(); if(curl) { fp = fopen(localdownloadedpatchfile, "wb"); if(fp==NULL) { printf("Error opening local patch file: %s\n", localdownloadedpatchfile); exit(1); } curl_easy_setopt(curl, CURLOPT_URL, onlinepatchfileURL); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL); curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp); curl_easy_setopt(curl, CURLOPT_NOPROGRESS, FALSE); curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, downloadprogress); res = curl_easy_perform(curl); curl_easy_cleanup(curl); fclose(fp); if(res == CURLE_OK) { printf("Patch file download complete.\n"); return true; } else printf("Error downloading patch file.\n"); } // Something went wrong... return false; } void savenewtimestamptofile() { FILE *fp; fp = fopen(localtimestampfile, "wb"); if(fp==NULL) { printf("Error opening local timestamp file: %s\n", localtimestampfile); exit(1); } fputs(onlinetimestamp, fp); fclose(fp); } int main(int argc, TCHAR *argv[]) { // Compare online patch file timestamp to one stored in local file // If it's different, download new file and replace old one if(ispatchfiletimestampdifferent()) { printf("Patch file date is different from stored date. Downloading patch file...\n"); downloadprogresstimer=Time::Millisecs(); if(downloadpatchfile()) { savenewtimestamptofile(); // Remove old file remove(localfiletobepatched); // Rename patch file to old file rename(localdownloadedpatchfile, localfiletobepatched); } } else printf("Patch file date is the same as stored date. There is no need to download patch file.\n"); // Launch program STARTUPINFO info={sizeof(info)}; PROCESS_INFORMATION processInfo; if(CreateProcess(argv[1], localfiletobepatched, NULL, NULL, TRUE, 0, NULL, NULL, &info, &processInfo)) { // WaitForSingleObject(processInfo.hProcess, INFINITE); CloseHandle(processInfo.hProcess); CloseHandle(processInfo.hThread); } else printf("Could not launch program. CreateProcess failed (%d).\n", GetLastError()); }
  9. This used to not be possible without coding it yourself but I wonder how Leadwerks handles GUI edit boxes. Maybe there's Lua code you can look at.
  10. That definitely seems like a reasonable compromise between turn-based and full action. Once a unit is created, the client and host can independently guide it to its target via the same code. I could see this working on a two-player tower defense game too.
  11. True, it's ideal to make a server a separate non-player. For me the host is also the player so I'd need to get clever. Still tempting to look at turn-based games for simplicity but I'm really an action game type of guy.
  12. Yes, it's far from ideal. If I ever released a major version, I would definitely do it manually, like you do.
  13. Thanks Rick. This may be over my head but I'll give it a shot.
  14. Hmm. I just tested this and the "only include used files" publish created a 44.5MB folder. The everything publish created a 54.8MB folder. So it's definitely doing something for me. However, the "only used" folder's zip file did include files that I definitely didn't use in the project. I'm not sure how Josh checks for this (hence my previous post) so don't know if this is a bug... but it doesn't act as you would hope.
  15. I suspect it's to save on packet size. Say a grenade was supposed to explode a few frames back among a group of characters. It's less information to send that grenade information in the past to all clients than to send every character's. Also, there is always latency. By the time you get a confirmation from the server, you will be several frames past from when the server said you were where you were. So it makes natural sense to send a time stamp and simulate from the past.
  16. This function will get all entities in the world (I believe it includes hidden as well): https://www.leadwerks.com/learn?page=API-Reference_Object_World_ForEachEntityInAABBDo Others like triggers you would need to code yourself.
  17. I was thinking about how a multiplayer game with Leadwerks would work and I'm curious about if anyone else successfully pulled it off, or has thoughts on it. My understanding is that the host and the clients both simulate locally. Then, every few frames, the host makes sure everyone is where they should be. If they aren't, he tells the clients to correct in the past, where they started diverging, and simulate from that point again (having kept position/rotation and input history). That means that every once in a while, the clients need to simulate multiple frames' worth of stuff in a single frame. I may have to test it but is this something Leadwerks is fast enough to do for a scene with multiple players and enemies? (I understand that there are a lot of variables here like triangle and bone count.) Also, can the character controller be properly set to a position/rotation/velocity/acceleration? What's the best way to do this?
  18. I'm curious how the engine now determines what you use. I thought it might have been mentioned on the forums before but I don't have time now to look into it.
  19. If you only need it to go up and down (not side to side), you can rig and animate it in your 3D modeling program and then just bend it by using the appropriate animation frame.
  20. It's a bit messy but on the Editor Interface page it mentions you can create a new project in the editor. Then the Introduction to C++ page says that you need to install Visual Studio 2017 and that when you create a new project, it will include a Visual Studio file you can open. After that, you can copy and paste examples/snippets from the documentation to learn the API. Creating objects, loading maps, etc. have examples (though the documentation is lacking in some important areas like GUI). You can search the forums for anything that might be missing above. I've been saved by this a few times, even when I had to try to figure things out from Lua code. And finally, you can always post if you have a question. There is a bit of a learning curve (as with all engines) but I've found the Leadwerks C++ API to be very easy to understand. I do understand some people prefer to be guided through the process and I agree that it would go a long way if there was a single, modern Getting Started with Leadwerks Professional video out there.
  21. Thank you but they were all exported together in the above screenshot. If one rotated, wouldn't they all rotate? I think I will try the tool you mentioned though, to see if it makes a difference.
  22. What causes a single model in a scene to rotate 90 degrees along two axes when exported as FBX from 3DS Max and imported into Leadwerks? I was exporting dungeon pieces individually when for some reason my wall showed up in my game rotated. I can't figure out why. So to test this, I tried to export multiple pieces together, as one FBX. But again, the wall came in rotated. Below is the scene, the left one in the Leadwerks model viewer, the right one in Max. Any idea why this could happen?
  23. Yes, you can uninstall by going into your Steam Library, right-clicking on the program and clicking Uninstall. However, you can also verify the program's integrity by right-clicking on the program and going to Properties, then Local Files tab, then the verify button. Not sure that will work but you can try it.
  24. Consider restarting your computer. For some reason sometimes that fixes weird things like this for people. You can also try deleting Leadwerks.cfg in Documents\Leadwerks.
×
×
  • Create New...