Computer Science Canada Remove Flickering (it came back) and program simple AI |
Author: | Velocity [ Tue Dec 13, 2011 6:42 pm ] | ||
Post subject: | Remove Flickering (it came back) and program simple AI | ||
What is it you are trying to achieve? Remove the god damn flickering! once and for all... before i got rid of it but now i came back and its not gonig away. I also want to program the AI where i indicated it... i want to know how to go about doing that. What is the problem you are having? The flickering is really pissing me off. And the A.I is confusing :O I want the A.I to follow the direction of the ball once i make it move ( which i can do ) but i want to know how to make the paddle follow the ball and make it miss sometimes but not alot Describe what you have tried to solve this problem Read all the documentations for flickering ... got nada from it. A.I - I have not really looked that much into it, im just looking for someone to share some words of wisdom or a tutorial on it.
Please specify what version of Turing you are using 4.1.1a Gladly giving karma for help ![]() |
Author: | Insectoid [ Tue Dec 13, 2011 6:51 pm ] | ||
Post subject: | RE:Remove Flickering (it came back) and program simple AI | ||
How many times does this line occur in your code? |
Author: | Dreadnought [ Tue Dec 13, 2011 7:08 pm ] | ||
Post subject: | Re: Remove Flickering (it came back) and program simple AI | ||
Velocity wrote: Read all the documentations for flickering ... got nada from it. Did the documentation actually tell you that this line (the exact way it is written here and in your code) was valid?
|
Author: | crossley7 [ Tue Dec 13, 2011 8:17 pm ] | ||||
Post subject: | RE:Remove Flickering (it came back) and program simple AI | ||||
first, try
or whatever you wan the upper range to be. You can adjust these bounds through testing to find an optimal way of having it work. If it has a constant movement then you can give it a certain chance that the paddle will move or not. I have implemented basic AI such as this in a few places and it works quite well. Since it should read through the code many times a second, it will appear to move slowly as opposed to stop/start type of motion that would come with a boolean move or don't statement. Thee are a few ideas to get you started, but there are countless ways of designing an AI and it all depends on how strong you want it and what you want it to do. |
Author: | Velocity [ Tue Dec 13, 2011 10:00 pm ] |
Post subject: | RE:Remove Flickering (it came back) and program simple AI |
crossley thanks, i know alot about A.I in C++ as i do quite alot of work in C++, i also tutor it. Turing is like a whole new story for me. Thanks alot for the advice and @ insectoid and dreadnought i have already tried all the possible things that are inside the documentation and none of them work? can you guys please run my program and implement something that could possibly run it smoothly? i was thinking of how it take a picture of every single line or procedure that way it has a saved knowledge of how it may run. P.S To all i will gladly give you all karma and bits once i get the commands implemented, and since you tried ![]() |
Author: | Tony [ Tue Dec 13, 2011 10:17 pm ] | ||
Post subject: | Re: RE:Remove Flickering (it came back) and program simple AI | ||
Velocity @ Tue Dec 13, 2011 10:00 pm wrote: i do quite alot of work in C++, i also tutor it.
I highly doubt that you are able to write anything meaningful in something as complex as C++, and then have trouble figuring out Turing's documentation while people are telling you exactly what you are doing wrong. With a bit of paraphrasing: Dreadnought @ Tue Dec 13, 2011 7:08 pm wrote: [hey Velocity, you made up an invalid mode instead of using one from documentation; your error is at:]
crossley7 @ Tue Dec 13, 2011 8:17 pm wrote: |
Author: | Aange10 [ Wed Dec 14, 2011 12:10 am ] |
Post subject: | Re: Remove Flickering (it came back) and program simple AI |
I agree. I'm sorry to flame, but 90% of your posts fail to show that you actually try anything. You usually fail to do anything on your own, or use tools provided to you. You seem to waver from question to question, never figuring out how to think for your self. velocity wrote: i have already tried all the possible things that are inside the documentation and none of them work? ... Further more ... velocity wrote: can you guys please run my program and implement something 134 posts and you still fail to think for your self. You deem the tools everybody else uses as useless, and look to everybody else to solve your problems. Here's some people to look to; http://wiki.compsci.ca/index.php?title=Main_Page www.wikipedia.org www.google.com |
Author: | Velocity [ Wed Dec 14, 2011 7:14 am ] |
Post subject: | RE:Remove Flickering (it came back) and program simple AI |
okay i tried to use this as a help forums, never mind. |
Author: | Aange10 [ Wed Dec 14, 2011 8:34 am ] |
Post subject: | Re: RE:Remove Flickering (it came back) and program simple AI |
Velocity @ 14/12/2011, 6:14 am wrote: okay i tried to use this as a help forums, never mind.
into Quote: can you guys please run my program and implement something
If you read the rules Welcome to Turing Help; Important Info & Tutorial Links wrote: ... Also plz don't post asking people to do your schoolwork for you, we will help but we will not do your projects for you. ... ... Please use these sources, as well as the Search, before posting your question. ... You must try so hard. |
Author: | mirhagk [ Wed Dec 14, 2011 8:45 am ] |
Post subject: | RE:Remove Flickering (it came back) and program simple AI |
Velocity, I ran your code, and fixed it (along with other various mistakes you had which prevented it from even running). Here is your game logic: draw players screen View.Update delay draw paddle View.Update delay cls draw other stuff View.Update delay As everyone has said, you need to draw everything all at once and do any of the following: draw everything View.Update delay cls or cls draw everything VIew.Update delay Do one of those. Also in this particular instance I fixed it by first of all using offscreenonly not offscreen, and then removing every View.Update or View.UpdateArea and only having 1 in your code. You should only ever have 1 per loop. |
Author: | Insectoid [ Wed Dec 14, 2011 9:06 am ] |
Post subject: | RE:Remove Flickering (it came back) and program simple AI |
Velocity, do you know what causes flickering? It happens because Turing draws things to the video buffer at a different speed than the video card draws to the screen. When you tell Turing to draw lots of things, it only manages to draw a few of them before the video card draws to the screen. So the video card draws half an image, then Turing draws a little more, the video card draws a little more, Turing draws a little more, the video card draws a little more, etc. This causes flickering. View.Set ("offscreenonly") tells turing to double-buffer graphics. This means when you tell it to draw things, it will draw them to its own internal 'screen' (you can't see it). The video card never gets to see this. Then, when you call View.Update, Turing shows the whole picture to the video card and says "Draw all of these things". If you call View.Update more than once per loop, it's just like drawing things individually. You'll draw half an image, show it to the video card, then draw a bit more, show it to the video card, and then draw some more, and show it to the video card. Hopefully this illustrates why you should be using View.Update, how you are using it wrong, and how to fix it. |
Author: | crossley7 [ Wed Dec 14, 2011 12:07 pm ] |
Post subject: | RE:Remove Flickering (it came back) and program simple AI |
Also, if you say you have made AI in C++ then you should be fine in turing. Changing language doesn't change the logic, just the words that are used to implement it. I use C++ mostly now and I find it tends to be a step up from Turing rather than a step down. It is faster and has more functionality and the only thing turing has on it is if you need really basic graphics for a simple program. I somehow doubt that you struggle with Turing if you have any understanding of any language, nevermind C++. |
Author: | Velocity [ Wed Dec 14, 2011 6:37 pm ] |
Post subject: | RE:Remove Flickering (it came back) and program simple AI |
Thank you very much for mirhagk for that help, since now i have completely removed my flickering. Also thank you very much to Insectoid for clearly explaining in detail the purpose of those commands (that cleared up alot of thing, thanks alot) ! |
Author: | mirhagk [ Wed Dec 14, 2011 8:23 pm ] |
Post subject: | RE:Remove Flickering (it came back) and program simple AI |
For future reference don't post and say "My program flickers and I can't fix it, I've read everything, you guys fix it". Try and understand and fix it on your own, and failing that, ask us to explain it. We will gladly explain things in detail if you ask, it's just a matter of asking for help in understanding. |
Author: | Velocity [ Wed Dec 14, 2011 8:36 pm ] |
Post subject: | RE:Remove Flickering (it came back) and program simple AI |
That being said, may you please explain to me my next post that i made about clearing the brick after it is hit. |
Author: | crossley7 [ Thu Dec 15, 2011 4:32 pm ] |
Post subject: | RE:Remove Flickering (it came back) and program simple AI |
Did you not understanding anything that was just said? Look at it and think for yourself about a way to solve the issue. It isn't a hard one to fix and so you should try solving it before going on here with your problem. IF you are dedicated to programming you need to be ready to spend 2 hours debugging for every hour you code |