First non-demo project work.
/* * Audin Malmin * 4-20-98 * Java programming assignment 3. * * Last week I was still throwing around the idea of having each on-screen object * running in a seperate thread. However, java's thread mechanism isn't really up * to this. (I don't know that any thread mechanism is...) So we've abandoned * that idea. * * This week I've mainly been working on the general layout of our program. * * We've worked out that we will employ around 6 threads: * * * Event handling * * Local player's Dudes. (Movement and probably learning.) * * Remote player's Dudes. (Movement and probably learning.) * * Temples. (Animation, mainly.) * * Network daemon. (send out the local movements. Maybe recieve the incomming.) * * Reproduction. (I haven't decided yet, but this may be handled by its own thread.) * * On the data structure side of things: * * * Linked list of local user's Dudes. * * Linked list of remote user's Dudes. * * Linked list of temples. * * These three lists are each animated by one of the threads layed out above. * * * 1024 x 768 2D array of integers. We may use something like this to * keep track of where people are. This will help with figuring out which Dude * was clicked on, and also help prevent a moving Dude from running right over * another non-moving Dude. * ******************************************************************************** * * Below is the second version of my DudeList class. Two instances of this class * handle the local user's and the remote user's Dudes. * * I have yet to completely figure out how to cordinate access to these lists. Both * the update (movement) processes, the event handling process and perhapse the * reproduction process have to be able to access them. Currently I'm thinking that * I can suspend the update process, update the list, and then resume the process. * However I am still working on getting it to work correctly. (Attached you will * find my current trial code. Depending on one's timing the code works fine. There * is a race conditon somewhere that I have yet to find. * * This code can be found on my web page. I will also set up a runnable binary. */
The source code.
The Live demo.