This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Thread and simulation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Thread and simulation" Watch "Thread and simulation" New topic

Thread and simulation

danesh far

Joined: Nov 25, 2004
Posts: 15
I am trying to simulate a footbal game which is a part of my project in the field of Opponent Modeling and its application in robocups.As you know we have 22 players and at any time they have to do something based on the their duty and position such as catch the ball ,shoot the ball and ...
How could I do that in JAVA.I already simulate a player and a goolkeeper is using Thread technic.In this simulation first goalkeeper moves and according to its position, the player move. What should I do if I have 23 different agents (22 players +ball)in a game and if everyone have to make a decision based on their mind (using some local information.Is there anyone who is interested to contribute in this project ?
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Just thinking out loud ... if you have a thread for each player you are not guaranteed they will get a fair share of processor time. One player might stand there unable to respond to anything happening around hime while another runs for a goal.

"Life" game implementations use two copies of the playing board. So maybe each player makes a decision where to go based on the current board and puts himself in the new position on the new board. You'd have to deal with collisions of course - maybe allow multiple players in one square but one stays up and the others are "knocked down". The advantage is for a single virtual time click - faster or slower than real time - you move everybody. Nobody gets starved for time slices.

Any of that help?

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link:
subject: Thread and simulation
Similar Threads
Simulate simultaneous movement by pieces on gameboard
Load test a two player game
help with tcp causing lag in ping pong game
TicTacToe user vs computer
Official, Blue, Red player multi-threaded problem