»jabjabjab Posted September 27, 2011 Author Report Posted September 27, 2011 (edited) I have 3 nights off tomorrow to be able to do more work. Edit:shifted by one day. Something went wrong in my work scheduling >.> Edited September 27, 2011 by jabjabjab Quote
»jabjabjab Posted September 29, 2011 Author Report Posted September 29, 2011 I just made most of a ToDo list. So many X's in things.. heh. Anyways working on special weapons Quote
»Lynx Posted September 29, 2011 Report Posted September 29, 2011 How's networking coming along? Quote
»jabjabjab Posted September 30, 2011 Author Report Posted September 30, 2011 I honestly hate the noise the decoy noise makes, so i went out to find a replacement. this is the result:http://www.sounddogs.com/previews/2109/mp3/147873_SOUNDDOGS__do.mp3 Quote
»jabjabjab Posted October 1, 2011 Author Report Posted October 1, 2011 (edited) With the help of spidernl, the jvm crash is history. A tip for those who wish to use CopyOnWriteArrayList objects, please do not do this when running multiple threads: Subtracting at an thread not synced with another listening to it. Edit: oh and multiple for loops reading the info across threads. Edited October 1, 2011 by jabjabjab Quote
spidernl Posted October 1, 2011 Report Posted October 1, 2011 Making the add/remove/loop "methods" synchronized doesn't help much. Far as I know that'd just prevent multiple threads from both adding at the same time, or both removing at the same time, etc. A thread-safe list would have to make all functions that can modify the list's contents block when one of them is 'in use'. Not that that's impossible, just sayin'. Quote
Drake7707 Posted October 1, 2011 Report Posted October 1, 2011 I usually do a List<meh> list; lock(somequeue) list = somequeue.ToList(); foreach l in list { ... } in c#. Without the handy linq functions such as ToList twould be slightly more of a hassle, but it could still be done if there aren't a lot of methods that access the list, and by keeping those methods in the same class (otherwise it gets confusing very fast). Isn't there a thread safe list in java, similar to the recently added ConcurrentBag in c# (although locking yourself woulds probably still be faster)? Quote
»jabjabjab Posted October 2, 2011 Author Report Posted October 2, 2011 I honestly dont know,. Im not out of the woods with the error yet. Only the update thread works, but the collision thread is identical, and is accessing the same info to push a method, (and i cant seem to merge both because of delay on updates) so i dunno atm wut to do about that. Quote
spidernl Posted October 2, 2011 Report Posted October 2, 2011 (edited) class YourList extends ArrayList { FancyLockingSystem mySystem; @override public void add() { //Do cool stuff with locks } @override public void remove() { //Do cool stuff with locks } } edit: You could also have a global lock and not do the locking inside the list, but instead lock the list whenever you want to access it, and unlock it whenever you're done. Then you just go like.. lock();for (element : elements)//loopunlock(); Edited October 2, 2011 by spidernl Quote
Drake7707 Posted October 2, 2011 Report Posted October 2, 2011 Holding the locks for the entire action on the array is usually a bad idea when there are a lot of concurrent threads that access the same list. If it's only occasionally this wouldn't pose a problem, but if it's accessed per frame by multiple threads I'd go for a copy of the list and do the actions on the copy (well unless the action itself also has to be blocked, then this would be fine). The lock(); and unlock(); mentioned would have to be implemented with a mutex, semaphore or monitor, depending on what kind of locking you'd need Quote
JoWie Posted October 2, 2011 Report Posted October 2, 2011 (edited) Or just use 1 of the 100 java thread safe collections? Edited October 2, 2011 by JoWie Quote
Cheese Posted October 2, 2011 Report Posted October 2, 2011 from the moment you touch threads, its only a matter of time until youre forced to learn about mutexes Quote
»jabjabjab Posted October 4, 2011 Author Report Posted October 4, 2011 3 more days off now. Will work on stuff later tonight. Quote
»jabjabjab Posted October 7, 2011 Author Report Posted October 7, 2011 http://i559.photobucket.com/albums/ss31/XDreamersMS/Continuum/Aphelion/AphelionLogo2.png?t=1317992328 How is this for a logo? Quote
Dr Brain Posted October 7, 2011 Report Posted October 7, 2011 Fine, but you spelled Javaspace wrong. Quote
Resol Posted October 8, 2011 Report Posted October 8, 2011 Did it it take you all 3 days to make that? Quote
»jabjabjab Posted October 8, 2011 Author Report Posted October 8, 2011 Look whose getting impatient Quote
»jabjabjab Posted October 16, 2011 Author Report Posted October 16, 2011 http://i559.photobucket.com/albums/ss31/XDreamersMS/Continuum/Aphelion/AphelionLogo4.pnghttp://i559.photobucket.com/albums/ss31/XDreamersMS/Continuum/Aphelion/AphelionLogo3.png Quote
»jabjabjab Posted October 20, 2011 Author Report Posted October 20, 2011 When SSDR comes out of Beta (which is probably due in a few days) I will resume work on this client. Quote
»jabjabjab Posted October 26, 2011 Author Report Posted October 26, 2011 It's pretty obvious that I know next to nothing on networking, so this is going to be a big horrid thing for me to do :/... (tries to find way to set this up) Quote
Drake7707 Posted October 26, 2011 Report Posted October 26, 2011 Best way is much like an IRC chat system, where all messages from a client are applied on the server and are forwarded to the others. It's not really that hard in java. I wouldn't focus much on optimization or lag issues at first though, even if it takes 20kb/s per client at first, getting it to work is more important. Otherwise it might end up as a case of premature optimization. Quote
Cheese Posted October 26, 2011 Report Posted October 26, 2011 basically, you need a socket on the server for each connected clientclient sends data to the server, whether a weapon packet or a chat messageserver checks to see if its legit and other stuff, then sends it to all connected clients piece of cake Quote
»Lynx Posted October 26, 2011 Report Posted October 26, 2011 Don't bother with the checks until you've got the basics down, or you'll be adding more work prematurely. Have a look at getting a basic chat client working first (using the method Cheese highlighted). Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.