Discuss Simple Game Question in the Game Development forum on Dev Shed. Simple Game Question Game Development forum covering non language specific programming - game creation, design, modding, theories and math. A place for developers and gamers of all levels to discuss and debate all things involved in game creation and modding.
Location: Woodland Hills, Los Angeles County, California, USA
Time spent in forums: 2 Months 3 Days 6 h 58 m 35 sec
Reputation Power: 4106
Your loop is slightly incorrect. Instead of "Wait for player input", it should read "Check if player input" and continue through the loop if there is no input.
__________________ Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
Time spent in forums: 2 Weeks 1 Day 19 h 1 m 52 sec
Reputation Power: 1901
Originally Posted by drezard
So I should use multithreading for this?
And what happens if a user inputs a key while its doing the AI logic and such.
- Cheers, Daniel
You should have a few threads each specializing on something. One for getting user input, one for AI logic (probably one for every ai), one for for sync'ing with the server, one for display...
I'm no expert on game programming but it should go along those lines.
Then you can have the system take care of doing all of it "together". What you still will have to do is that the different threads don't mess with each other. You do this by ensuring that a thread that reads or writes some data doesn't get interrupted by another thread writing or reading that data...
Monitors, Semaphores and Deadlock Prevention are some keywords to look up for this.
Won't be easy though...
- Hugh of Borg
The first thing young borg are taught: Keep away from Microsoft software!