Update: Starlight 0.3.rar
Can someone find out why the pathfinding is so bugged? (It works but you walk like an autistic dog) Also please give me some feedback about the coding, I can't do anything with the usual "not useful" or "nice".
I wasn't talking about Butterfly. I was talking about Holograph, Thor. They're pretty decent.
If you're doing it for your own coding experience, I don't see why it has to be released. It doesn't have sufficient features to run a hotel so therefore it's useless.
There are reasons for your multiple issues with your pathfinder. Firstly let me point them out to you;
- You create a new thread each time the user walks (very unstable). It should be per room instead.
- This method call
Should be 500 milliseconds instead, this processes the thread with less speed so it's like normal walking. If you want to see how a pathfinder is properly implemented, look at Room.java from the Sierra leak. The syntax is almost the same so you should be able to understand it.Code:Thread.Sleep(130);
Last edited by Quackster; 10-06-13 at 05:05 AM. Reason: Pathfinding help.
Sorry to not update the thread every 2 seconds, I already fixed pathfinding yesterday. I know about the roomhandling, I'm gonna recode it after this works better and I cleaned up some code so recoding is easier. Also, I released it here because I want feedback from some coders. If you'd like to come on Skype to give me a lot of feedback about my coding I'll close this thread if you want. I just want to improve my coding by listening to other people's advice.
Add some try { } catch or it will hang.
Ok, kids, let me explain how this stuff works. First of all, adding a try-catch block around ANY code would NEVER make it hang less.
Having one thread per room is shooting yourself in your foot. It would cause X = amount of loaded rooms to be added to your CPU to be cycled. It scales incredibly poorly and literary eats up system resources.
The way to go is pooling, as I did in Butterfly. It would probably be a better idea to use a timer or something like that, but the way I did it in bfly was good enough. The difference between this and the other approach is that the OS handles how many threads should be running, not the amount of rooms that is loaded. That way it is more scalable and the calls are asynchronous.
Edit:
Also, here is a way better socket which I used in bfly: https://github.com/martinmine/Connectivity It basically talks directly to the Winsock API so you don't need all the overhead caused by the generalized socket class in .NET