Game Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesGame Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 8th, 2007, 07:59 PM
drezard drezard is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2006
Posts: 185 drezard User rank is Sergeant (500 - 2000 Reputation Level)drezard User rank is Sergeant (500 - 2000 Reputation Level)drezard User rank is Sergeant (500 - 2000 Reputation Level)drezard User rank is Sergeant (500 - 2000 Reputation Level)drezard User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 13 h 24 m 59 sec
Reputation Power: 11
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

Reply With Quote
  #2  
Old January 8th, 2007, 08:28 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,536 Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 6 h 45 m 12 sec
Reputation Power: 876
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.
Comments on this post
tagmanadvance agrees: yup. Threading should be used for this.
__________________
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

Reply With Quote
  #3  
Old January 9th, 2007, 03:42 AM
drezard drezard is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2006
Posts: 185 drezard User rank is Sergeant (500 - 2000 Reputation Level)drezard User rank is Sergeant (500 - 2000 Reputation Level)drezard User rank is Sergeant (500 - 2000 Reputation Level)drezard User rank is Sergeant (500 - 2000 Reputation Level)drezard User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 13 h 24 m 59 sec
Reputation Power: 11
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

Reply With Quote
  #4  
Old January 9th, 2007, 09:01 AM
Hugh of Borg's Avatar
Hugh of Borg Hugh of Borg is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2004
Location: Switzerland
Posts: 577 Hugh of Borg User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hugh of Borg User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hugh of Borg User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hugh of Borg User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hugh of Borg User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hugh of Borg User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hugh of Borg User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 6 Days 22 h 8 m 5 sec
Reputation Power: 86
Quote:
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

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...
Comments on this post
jorgejones disagrees: And you should make another thread to scratch your balls too! - Because you're over-killing the
entire idea here. Thats just overkill, read a book god damnit. Even on Intel's manuals you'll read
onto proper multithreading.
__________________
- Hugh of Borg

The first thing young borg are taught: Keep away from Microsoft software!

Reply With Quote
  #5  
Old January 9th, 2007, 04:19 PM
tagmanadvance's Avatar
tagmanadvance tagmanadvance is offline
Kage Bunshin
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2005
Location: The Seven Seas Of Rhye
Posts: 771 tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 9 h 53 m 35 sec
Reputation Power: 185
Send a message via AIM to tagmanadvance Send a message via Yahoo to tagmanadvance Send a message via XFire to tagmanadvance
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesGame Development > Simple Game Question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway