Game Development Community

Httpobject

by Glenn Kaino · in Technical Issues · 08/03/2004 (12:55 am) · 4 replies

I am trying to use HTTPObject to load persistent character data off of a web server. The tutorial in the resources provides a good start (http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4085), but how do I delay the character from spawning until the character data have been retrieved?

I tried using a semaphore in the main loop (waiting for a variable to be set by the asynchronous onLine() method), but the program just locks up. Is there an equivalent to C/C++'s sleep() available? So that it doesn't spend all the CPU time in the tight loop.

Not sure my approach is correct at all. Is there a better way to do this?

About the author

Recent Threads


#1
08/03/2004 (5:50 am)
It seems like the simplest solution would be to spawn the character in the onLine method, that way you don't need to wait in the main loop.
#2
08/04/2004 (8:54 am)
That tutorial is grossly incomplete and if you study it a little bit you'll see why the entire thing has to be rewritten to handle more than one player loging in at a time. In fact, that's exactly what I'm doing now.
#3
08/04/2004 (11:17 am)
Gonzo:

Excellent - keep us updated!
#4
08/06/2004 (3:09 pm)
Gonzo,

What problems do you see with more than one player logging in at a time? Are there shared resources being overwritten? How are you getting around it? I'm curious in your approach.

Thanks.