Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Marko Taht wrote:So it would be something like this:
while(true){
while(userevents.notEmpty()) handleUserEvent();
move user
move ai
enviroment events
some other stuff needed to be done(rendering or whatever)
}
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Marko Taht wrote:While everything does happen with events, it still seems to me that at some deeper lower level it boils down to a while loop, because something needs to trigger the timer event and that means something needs to keep on checking the timer.
Marko Taht wrote:So by adding stuff to actionperformed i can control AI and environment too, right? While everything does happen with events, it still seems to me that at some deeper lower level it boils down to a while loop, because something needs to trigger the timer event and that means something needs to keep on checking the timer.
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Marko Taht wrote:So by adding stuff to actionperformed i can control AI and environment too, right?
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Marko Taht wrote: ... i can control AI ...
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Marko Taht wrote: ... make multiple eventhandler?
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Marko Taht wrote: So my first steps are designing the basic game consept , and researching about different programming methods and stuff.
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Les Morgan wrote:Marko,
I always recommend people start in these places: Java Tutorials and The Java Really Big Index. Once you understand what is there, then you can apply almost anything you read and adapt it to Java and your specific need.
Marko Taht wrote:I can program java, i have done some pretty big stuff in it. I just havent dealt with game programming so mutch, so im trying to find a good concept on programming game.
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Marko Taht wrote:My main confusion about event driven programming currently is, how can i handle events and movement and other stuff that are not connected to player, like environment. The main event handler handler render events while no player event has happened or handles event that player has caused. But how and where do i handle the environment events and AI events, so that it wont interfere with player event handling. This is the point i'm not so sure about.
Marko Taht wrote:About graphics, i have used SDL in C++ and OpenGl in Java, but i always have a main loop that handles everything or i have some thread system that substitutes main loop. So i though maybe learn something new and try event driven programming, but the tutorials about it are not very well made. Your code example and the things you have explained have been much more helpful than a dozen of tutorials.
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
There are three kinds of actuaries: those who can count, and those who can't.
There are three kinds of actuaries: those who can count, and those who can't.
Marko Taht wrote:This looks quite a lot like a multi threading only that some threads work only when they get the signal to do something.
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Marko Taht wrote:If rendering is done on EDT, wouldnt the FPS be whatever same as the Timer event tick?
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Paul Clapham wrote: Sure, responding to events is part of what a game has to do but it's not the whole thing, and what this thread demonstrates is that looking at the problem from the top down (writing games) is a far more productive approach than looking at it from the bottom up (responding to events).
There are three kinds of actuaries: those who can count, and those who can't.
Marko Taht wrote:So... If i set my base timer to tick with 10ms interval. I can tell render panel to paint image every X ticks or render when something is complete and i can calculate the FPS rate on how many times repaint is called. Did i understand it correctly?
Marko Taht wrote:Secondly the operator =! look weird, i haven't seen one like this before. Inequality operator is != but what is =!?
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Marko Taht wrote:Simple small fast code where ball bounces around. Timer ticks 100 times per sec and rendering happens 50 per sec. Used some small bits from your example before. Hope you don't mind.
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Marko Taht wrote:Done. And for extra a lot of randomness. Thank you for your patience and time
.
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Marko Taht wrote:1 more thing. EDT pushes all events to other threads, but rendering is done on EDT, correct?
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Greg Pata wrote:Great example! In the above code, RADIUS should have been named DIAMETER.
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
It runs on an internal combustion engine. This ad does not:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|