Jump to content

Laurens

Members
  • Posts

    564
  • Joined

  • Last visited

Everything posted by Laurens

  1. Laurens

    Networking

    Just tried mutex' first. Same end-result sadly. I then even tried creating two projects, a server that purely listens and does nothing else LW related and a client that just connects, sends some data and disconnects, nothing else. Still the same result (that is no result). I used PortQryV2 to confirm that the port is actually open and it is, so CreateHost seems to work and I suspect the problem must be with ConnectHost. I am about to give up on this and switch to RakNet unless Josh could take a look at this and confirm whether it is truly a bug or not. Many thanks for the help everyone!
  2. Laurens

    Networking

    I just tried the LUA example Josh posted on the Wiki by dragging server.lua and client.lua on engine.exe, only to get a "CreateHost: attempted to call a nill value" (or something of that sort). Is it safe to say networking is completely broken and I should file a bug report?
  3. Hi! There is an auto-updater included in the toolset and it features networking commands. You can take a look on the wiki: http://www.leadwerks.com/wiki/index.php?title=Networking. Cheers!
  4. Laurens

    Networking

    Wouldn't that only prevent a particular section of my[/code] to be thread safe? Say I make the entire Update method mutually exclusive. The first time the method is called it gets a lock. A second call would wait until the lock is released but I never make a second call to Update. Maybe I get how mutex' work wrong. If I encapsulate all LW calls in a mutex, would that prevent LW commands from getting called concurrently? If I have two threads executing a different method but still calling LW commands from those methods, wouldn't I still be calling LW methods concurrently, even if I surround those methods in a mutex. If the former is the case than I can never send a packet from the main loop and listen for incoming packets (WaitNetEvent) in a second thread, making the entire library useless. I think however that is not how it works. It would only prevent my code getting called twice which I am not doing anyway. Thanks for the response though!
  5. Laurens

    Networking

    I created a sample application which does not run on my computer but does seem to work for the example on the wiki. I would be very grateful if anyone could tell me if this is running for them, and even more grateful if anyone could tell me what I am doing wrong. Thanks! #include <process.h> #include "engine.h" #include "netwerks.h" bool keepRunning = true; THost host; void __cdecl Update(void* params) { while (keepRunning) { TEvent event; WaitNetEvent(host, &event); if (event.id == EVENT_CONNECT) { printf("Client connected."); } if (event.id == EVENT_PACKETRECEIVED) { printf("Packet received."); } if (event.id == EVENT_DISCONNECT) { printf("Client disconnected."); } } } int main() { InitializeNetwerks(); Initialize(); SetAppTitle("Game Code"); Graphics(1280, 800); CreateFramework(); host = CreateHost(); _beginthread(Update, 0, 0); THost client = CreateHost(0, 7778); TPeer server = ConnectHost(client, HostIp("127.0.0.1")); while (!AppTerminate() && !KeyHit()) { TPacket p = CreatePacket(); WriteLine(p, (byte*)"Hello world!"); SendPacket(client, server, p); UpdateFramework(); RenderFramework(); Flip(); } keepRunning = false; Terminate(); TerminateNetwerks(); return EXIT_SUCCESS; }
  6. Laurens

    Networking

    Does anyone have a working C++ example? I am still stuck on this. Thanks!
  7. Laurens

    Networking

    Hi, Thanks for the replies all I have decided to take a stab at multithreading using the LE commands as I have taken special care not to call on entities or anything in both threads. I do have a problem connecting two hosts even though it looks like I'm doing everything just like in the example on the wiki yet none of the networking events ever trigger. Netwerks initializes just fine as well and turning of my (Windows) firewall does not make a difference. This is my server setting up the host and calling the Update method in a new thread. const bool Game::Initialize() { host = CreateHost(0, 7777); _beginthread(Game::Update, 0, reinterpret_cast<void*>(this)); return true; } This is the update method that should capture all networking events: void Game::Update() { while (true) { TEvent event; WaitNetEvent(host, &event); if (event.id == EVENT_CONNECT) { peers.push_back(event.source); } if (event.id == EVENT_PACKETRECEIVED) { // TODO } if (event.id == EVENT_DISCONNECT) { peers.remove(event.source); } } } This is the test code I use: THost client = CreateHost(0, 7778); TPeer server = ConnectHost(client, HostIp("127.0.0.1"), 7777); while (!AppTerminate() && !KeyHit()) { TPacket packet = CreatePacket(); WriteLine(packet, (byte*)"Hello world!"); SendPacket(client, server, packet); UpdateFramework(); RenderFramework(); Flip(); } Any clue as to what is wrong here? Many thanks!
  8. I believe what you are looking for is called an area light and afecelis requested it at one point although I do not know what came of it. Maybe you can dig something up by searching for "area light". Cheers!
  9. Laurens

    Networking

    So I just confirmed that WaitNetwork is indeed blocking all further executing. Specifying a timeout of 1ms in a loop is still unacceptable due to timer inaccuracy so the only way out I see now is multithreading. Should I run into any trouble if the only thing I do in the other thread is networking? Any actions taken upon network activity (for example, a "ENTITY_CREATED" event is sent across the network) would still be handled in the main thread. Thanks!
  10. Laurens

    Publishing my game

    I'm rooting for you, I will surely be picking this up if they decide to release it Good luck!
  11. Laurens

    Networking

    Hi everyone, Lately I have been reading up on networking and it occurred to me that in order for me to receive events I need to call WaitNetwork and specify a timeout. I suppose this means that it will halt all further execution (updating, rendering) until it either times out or receives an event. It could be easily solved with multithreading but I have heard rumours that this does not work well with the engine or should I be fine since I would only be doing networking in the other thread? Thanks!
  12. Yay for events instead of polling
  13. Laurens

    VS 2010

    I have no such issues using VS2010 for LE although I would stray away from the Express version which crashes quite a lot when trying to use IntelliSense. I use Express on my desktop for game development, and Ultimate on my laptop professionally which does not suffer from the problems that Express does. So if you have the option, go Professional or Ultimate.
  14. SDL. It has other modules such as font rendering and net but you can choose not to include them in your project.
  15. No, you can't call Leadwerks methods (as far as I know) without calling Graphics(). If it is possible to call Leadwerks methods without calling Graphics() it sure ain't the body commands so you would not be able to run physics. Plus, Aggrors code does call Graphics(). Cheers!
  16. Thats exactly what I was thinking. I look around the net some more and it turns out C4 is built this way as well. It has a main engine executable and several DLL's for not only games, but also the level editor and the model/texture importer.
  17. Hi guys and gals, Last night I was reading a chapter on plugins in C++ applications in "C++ for Game Programmers" and it got me thinking. Conventionally people create an engine, compile it into a DLL and end-users use the functions the DLL supplies to create and compile it into a game executable. But what if you turn it around? I was thinking it would be possible to wrap Leadwerks around an executable who's sole purpose it is to load a game from a DLL. Additionally the engine could provide some basic structures such as a state manager, networking and whatnot but really the only thing a developer would have to do to get a game going is override the plugin interface defined by the engine and he/she would be able to run it in the engine. It would require no main function, no initialization, it could all be contained within that engine wrapper around Leadwerks. Of course this does impose a pretty serious architecture for the game developer but it would also make setting up a game easier with a lot of structures already present. Another example would be a console window. The engine could define a console window so there is no need for game developers to implement their own. What are your thoughts? Cheers!
  18. You can load physics meshes (.phy) without loading the actual visual meshes (.gmf) but you will still need to call Graphics() and thus need a SM3.0 capable card.
  19. The object in question does not open any files or anything so that would have not been a problem, but to ensure some future requirement won't change this I opted to no longer use singletons but instead use the service locator pattern that does give me control over when I want to delete the managers. Cheers!
  20. Hi, This is probably a real simple question but I was unable to find a conclusive answer searching the web for a bit. I have a singleton that manages some pointers to objects that have been new'ed at some point. Now, if my game has a clean exit, will the O/S (Windows/Linux/Mac) automatically reclaim the memory that my game was using without me having actually deleted the singleton and the pointers it manages? And what if my game crashes? Will the O/S still reclaim the memory? Thanks!
  21. If you have no prior experience in programming then I'd say you can pick up LUA up to a point where you can comfortably modify other people's scripts in about 5 working days. If you have ever opened one of the more easier scripts you will see it really speaks for itself. Aggror has a great set of LUA tutorials over on the tutorials page ranging from getting started to some of the more advanced concepts such as character controllers. http://leadwerks.com/werkspace/index.php?/page/resources/_/programming/lua/
  22. That will indeed only require minor modification of the skybox script. LOD and lighting/shading is all handled for you by the engine. Only the full version comes with the fbx2gmf converter although Ultimate Unwrap Pro (not free) also comes with a GMF exporter. http://www.unwrap3d.com/u3d/index.aspx
  23. I like how the godray effect works on the title. Combined with the rain and the fog it sets a pretty dramatic tone. Very nice video Cheers!
  24. When you say you can hardly code apart from some GLSL, does that mean you can't script in LUA either? Although there are a lot of premade scripts with the engine, it's hardly enough to create an original, quality game with it. That will require either some coding or some scripting. Compiling it into an executable is peanuts compared to that. Regarding the skydome, yes, that is possible. You would probably need to modify the skybox script though. I'm not sure if anyone has actually swapped the skybox out for a skydome yet. To answer your questing regarding importing; you need to put the GMF model file in a subdirectory of Editor and restart it. Yes this is a little clunky
×
×
  • Create New...