Anthony Hay

Greenhorn
+ Follow
since Jan 08, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Anthony Hay

Your welcome. I happy to help anytime.
14 years ago
Your game runs quite well even under even under heavy CPU usage, theirs one more tweak below but I really don't think it's necessary. And also a word of advice, virus scanners don't make very good load generators because they use tons of ram and Hard-disk access. Your game lagged on your computer probably because the AVG scan was hogging up all the ram and hard-disk usage time. Both of which are part of the life blood of any smooth running game. On my machine even notepad runs slow when a virus scan is underway, and I can run Crysis on high graphics with no lag.


The last thing now would be separating updates from rendering. So basically while the game runs we want to add up the overruns(frames that take longer to render then the allotted time) and do extra updates without rendering when necessary to catch up. Even though the frame rate will not be would it should be the update rate will stay really close to the desired FPS. So even though the graphics are running a little slow the game still advances at it's assigned pace. You should be careful not to let the code skip too many frames at once, otherwise the game will appear to jump forward.

so say we separate the updates from rendering.

so say we want 100FPS, this is fast in the gaming world but I'm just using it for the simplicity of the example.

Each frame should take 10ms (1000ms/100)

frame 1 takes 9ms, we have some time left so no overrun is added.

frame 2 takes 12ms, we went 2ms over the allotted time. we will add this to our overrun.
overrun = 2, since a frame should take 10ms and we only went over 2ms we don't need an extra update.

frame 3 takes 11 ms, we add one to our overrun and it now become 3.
again 3ms is not enough to warrant an extra update.

frame 4 takes 18ms, overrun = 18-10 + 3(from previous overruns)
overrun = 11ms

since our overrun is now grater then our allotted time we have lost at least one frames time, so now we do an extra update to cover that lost time,
we update without rendering.

overrun is now 1, we started with 11 and did one extra update wich covers our allotted time so we subtract our allotted time from the overruns.
14 years ago
Theirs not much more you can do without a direct call to paint.
14 years ago
So now the next step is to trash repaint, and call paint directly. your going to have to grab a graphics object directly by getting a graphics object from your applet and passing it into paint directly. This little code snippet should do, place this where your repaint is. If it still runs choppy after that theirs other things we can do to make your game appear to run faster when in fact it's not.

14 years ago
I see many problems with this code. First the game logic is interlaced with drawing code, preventing you from separating updates from renderings. Second your calling repaint, which only places a request to redraw the applet. The time between you call repaint and the time it's actually redrawn is unpredictable at best, sometimes under heavy load or when lots of requests are made some of those requests are dropped, making the game appear choppy. Since you got your game logic interlaced with the drawing code the game only advances when paint is called, because your calling repaint in your main loop the call to paint is made at the determination of the VM and not your code. Fixing the game will involve major rewriting, that rewrite however will almost guarantee smoothness on all but the most paltry of systems.I recommend reading the first few chapters killer game programing in java, it will tell you alot you need to know when programing games and teach you how to write an effective main loop. A free online version can be found at the link below

http://fivedots.coe.psu.ac.th/~ad/jg/

14 years ago
your welcome.

In a main loop we have to sleep at some point to keep the FPS from being out of control. I suspect that the code that handles the sleep timing is ether insufficient or has a bug in it. I would take your games logic and rendering code and put theme into separate methods so you only have to make a few method calls in your main loop. That will help keep your code clean. I would really like to see that main loop, it would shine lots of light on the problem. Also id like to see your double buffering and painting code, maybe there is some speed ups we can make there.

14 years ago
What are the specs to your computer?, I played the applet and it ran just fine, although it paused for a split second while loading the levels which is understandable.

I'm running an
AMD Athlon64 Dule core @ 2.7GHz
8GB system ram
NVidia 9600GSO with 1GB video ram

It would also help to have the code to the main loop.


Edit: I ran a test by playing your game and looking at my total CPU usage via task manager. I found that the game would slow down but CPU usage would stay around 3% and ram usage by the VM did not decrease as it would normally would during garbage collection.
14 years ago
Well I would start by analyzing what states lock has, like whether the lock is open or not, the numbers in the combination, what place in the combination we are at. I would put all that information at the top of the class. like this

Then in your constructor your going to have to assign values to some variables you want initialized in the lock class when it is constructed. For example:

lastly your going to have to implement the logic. Look at how the lock steps through it combination and replicate those steps in the programing. Id recommend using a switch statement and using a int variable to keep track of the part of the combination we are in. An example switch statement is presented below.

at any rate http://java.sun.com/docs/books/tutorial/ has lots of basic information about the java language and should help you if you get stuck on what to type in for code or need help understanding the syntax and how to use it.
14 years ago
{Late lol}
Bugs Bunny
14 years ago
System restore might be able to to get your file back if a restore point was created while the file was on the drive. Restore points are created every month and every time you install or uninstall soft-where. To check what restore points you have go into your system tools and run system restore, then select restore my system to an earlier time and a calender will be shown to you with restore points in bold. Select the nearest bold date and your system will be restored to what it was like on that date. Keep in mind that system restore will change all your settings back to what they where at that date. Any work you did after the restore point on the deleted file is lost. The files you created and edited after the restore point will be preserved. If you still can't find your file you can restore your computer back to the point where you flashed it back, system restore creates a restore point when you restore your computer to an earlier time.

If you do manage to get the file back id recommend that you back it up somewhere.
14 years ago

The little clock battery on the motherboard supplies enough current to keep the system clock running even when powered off.



To expand on what Peter wrote

computers don't shut all the way off when you shut theme down. Even if you remove the clock battery and shut down the computer it will draw a tiny amount of power from the wall to run the clock and keep the CMOS. So in order to stop the clock you would have to shutdown and unplug computer then remove the clock battery and wait a few minuets for the capacitors in the power supply filter to drain. Then your computers clock will be completely reset and won't count time until you power your computer up again. I don't recommend doing this even to keep pirated running as it erases the COMS settings which might cause a loss of performance or system instability.
14 years ago
Is there any sites out there that give a good rundown of UML?
Xbox 360s have a fatal flaw that causes them to malfunction after about 3 to 4 years of use, WII's and PS3's are more solid. I do component level electronics at school and we always have an excess of Xbox 360s that people send in all with the same problem.
14 years ago