|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Simple Game Question
Hello, Im wondering with Live action RPGs, FPSs and such. How do you check if the user is dead while your waiting for a key input?
(I know this isnt code its a design) I always thought games go like this: Code:
Game Loop Starts: Wait for user input Check what user inputed Collision Detection AI Logic Game Loop starts again. But what if the player is attacked while waiting for the user to input something? How would u move AI while waiting for the user to input something? - Cheers, Daniel |
|
#2
|
||||
|
||||
|
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 Puzzle of the Month solved by Keath and KevinADC, superior perl programmers of the month Looking for a perl job with kick-*** programmers in a well-known NASDAQ listed tech company with branches in the US and Europe? We're hiring. PM me for details. Requirements |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
||||
|
||||
|
Quote:
Yes. 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! |
|
#5
|
||||
|
||||
|
Thats why you find a good 3rd party game development engine. Its faster, often easier, and hopefully some good support.
__________________
"Java makes impossible things possible, but makes easy things difficult." - Somebody
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Game Development > Simple Game Question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|