developing a kind of radar?
Hi, I'm back! I was wondering if anyone has some suggestions as to the best ways to develop a kind of radar, that detects what's in front of the player for maybe 4 or 5 steps, in a half-circle? I've tried to do this, but in its current form it cau
Re: developing a kind of radar?
This is where the typical architecture breaks down and is also why I advocate reading sighted game programming tutorials. You'll need to architect your whole game to not use wait statements save in exactly one place. The typical approach to this
Re: developing a kind of radar?
Camlorn is right on track. The loop-and-wait thing works if you never have multiple things happening simultaneously (or as close to simultaneously as possible, anyway).In BGT, you _could_ use timers to keep track of these various independent mechanisms, but
Re: developing a kind of radar?
You can use timers in any language. There is only one good reason to even consider it: a fully online game that never pauses. But probably not even then. Being able to work with time in strange ways is an amazingly helpful thing.That said, you can
Re: developing a kind of radar?
+1 for post 2.An important architectural concept for game programming, and explained very well.
URL: http://forum.audiogames.net/viewtopic.php?pid=200106#p200106
___
Audiogames-reflector mailing list
Re: developing a kind of radar?
Ah, okay. So just make a timer then, and call the update method every time it's elapsed? Or I could put the timercheck in the update function itself. I do that with a couple of my classes, doing that for this didn't even cross my mind, hough. T
Re: developing a kind of radar?
You don't need timers. You do exactly what I did in post 2. And then:while playing:
for i in all_tickers:
i.tick(frame_rate)
wait(however long)Determining the time to wait can take just a little math if you want it to "catch up", b
Re: developing a kind of radar?
Hi, thanks for the suggestions. I don't completely understand, but I'll definitely take a look at some game programming tutorials for information. I'm now trying to figure out though, how I can update the angles the radar is scanning based
Re: developing a kind of radar?
Hi, thanks for the suggestions. I don't completely understand, but I'll definitely take a look at some game programming tutorials for information. I'm now trying to figure out though, how I can update the angles the radar is scanning based
Re: developing a kind of radar?
You're going to have to record the angle on the radar as an offset, say that it always goes from -45 to 45 for example. You then compute the actual angle by adding this offset. Because of the pattern I am describing--that you have tickers as a class
Re: developing a kind of radar?
Hi, I'm still struggling with the concept of frames and ticks. I understand how it can be helpful, and I understand your code in post 2, I'm just not sure how for example, you'd tell the game how to tick everything properly, given a certain
Re: developing a kind of radar?
I'm afraid not. I've gone through like 2 computers since I last looked at it. i'm now at the point where I can tell you all about DSP, and you probably do not want to see the articles I read at this point (I've been having huge mi
Re: developing a kind of radar?
For BGT, I wrote a clock class that takes care of the timer shenanigans. All you need to specify is how much time should pass between the start of each frame.A main function might look like this:void main() {
clock fps(50); // The constructor takes frames
Re: developing a kind of radar?
For BGT, I wrote a clock class that takes care of the timer shenanigans. All you need to specify is how much time should pass between the start of each frame.A main function might look like this:void main() {
clock fps(50); // The constructor takes frames
Re: developing a kind of radar?
Hi, I think what confuses me is how ticking is different from something like, while (true) {keyboard_function();wait(5);}and how to know when to call something like tick, and how calling tick methods will effect the game. I'm really sorry I'm havi
Re: developing a kind of radar?
This might be a little much for one post. I apologize in advance if it is.To keep using my invented word...Keyboard_function is a ticker. Whatever keyboard_function normally does goes inside one. In reality, you usually end up breaking keyboard handling
Re: developing a kind of radar?
The difference betweenwhile(true) {functions(5);wait(5);}andwhile(true) {functions(fps.delay);fps.tick();}Is minor when you're doing something simple. You can go ahead and do it the first way, if you want. The only real advantage to the second way is th
Re: developing a kind of radar?
Hi, so, I think I'm, incredibly close to figuring this out. I do have one question, though. What's the best way to regulate the time that passes between ticks? I know that's the entire point of the thing, and I looked at that frame clock for b
Re: developing a kind of radar?
You can use a constant value, and this is likely to be fine.Or (Python again, sorry):while True:
start =time.time()
do_stuff()
end = time.time()
took = end-start
if took >= wanted_time:
continue #we don't wait because we took too long.
ti
Re: developing a kind of radar?
Thanks! I think I am beginning to understand this.
URL: http://forum.audiogames.net/viewtopic.php?pid=200853#p200853
___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https
Re: developing a kind of radar?
Good. We really, really need more people around here advocating for it. It is frustrating to keep watching people use blocking architectures and throwing all their stuff right in the main loop. Sighted people solved these problems for us like 20 years ago
Re: developing a kind of radar?
The wait function in BGT was pretty novel for me, on the grounds that I'd been working primarily in Java and _javascript_ up to that point._javascript_ first. This was way before HTML5. Timers with callbacks were the only way to go.Java's Thread.
22 matches
Mail list logo