123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|664|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz -> My Shroom is as slow as a Snail...

Fri, 05 Jan 2007, 14:17
shroom_monk
OK, I've been working on one of my entries for the Community Project, called Shroom Maze Run. You have to get your Shroom from the red to the green square of the maze, but not get touched by the evil acid of doom. However, it's really, really slow!!! Now, I know that my computer is slow, but I do wish to speed up my game. If anyone can tell me how to make it faster I would be most grateful.

Download zip file (19KB)
You need to run the file 'starter.bb' to run the main thing, but the actual code is in the 'shroom_maze_run.bb' file. Thanks.

-=-=-
A mushroom a day keeps the doctor away...

Keep It Simple, Shroom!
Fri, 05 Jan 2007, 15:27
bram32
It looks okay, the speed isn't too bad on my PC.
I think the biggest slowdown is using ImageCollide. Maybe instead, you could use ReadPixel() ?
Sometimes, the space doesn't work. It is better to read KeyHit(57) only one time each loop. You could store it in a variable 'SpaceHit' o.s.
If you change the 'Flip' in the main loop to 'Flip False', you can see the actual speed of the program. Otherwise it gets rounded to the refreshrate of the monitor.

Fri, 05 Jan 2007, 15:58
power mousey
thank you bram32.

I was going to download and check it. But I see you got to it first...did your homework first.

haha I like the topic of this post. My Shroom is slow as a snail. Thats good. true


cheers,
power mousey
Fri, 05 Jan 2007, 16:07
steve_ancell
Shroom... Your game is so fast, it told me that I lost as soon as I run it.
Fri, 05 Jan 2007, 16:31
JL235
Very nice, but I have a few minor issues. First the acid starts too quickly, or more it's not shown approaching. The first 5 times I didn't understand why it was suddenly dying as I was still on the left and the acid killed me by only one pixel. You could also have the acid continue to move across, which would show to the player why they died. Second the maze is too hard, as if you don't go up right at the beginning, you've lost, but I really like the idea. Finally nothing happened when I got to the green square.

As I said, I really liked the idea, and it's fast and short too.

|edit| Also Bram, 'Flip True' does not make the frame rate round to the monitors refresh rate. It makes Blitz wait until the vertical blank before drawing, which is entirely different.

Although I also know exactly what you meant, to say 'Flip False' will give you the 'actual speed' of the program is also misleading. With 'Flip True' the vertical wait is now a deliberate aspect of the program, and just as if you added drawing functions, this requires time to be achieved (even if the program spends that time waiting). To say removing this will give you the 'actual speed' is like saying removing drawing functions will give you the 'actual speed'. |edit|

Fri, 05 Jan 2007, 17:59
bram32
:o i didn't want to mislead .. You are right, I chose my words carelessly. I'm sorry. With 'Rounding' I ment, that if your program can't make, say, the 60 hz vsync, it will wait for the next one. So it will run at 30 hz.
In this case, changing to flip false didn't speed up the program. However, commenting out all ImageCollide calls, made the program much faster. I believe that when optimizing, it is helpful to change to 'flip false'. That way, you can see how much 'spare capacity' you have.
Fri, 05 Jan 2007, 18:20
JL235
I know exactly what you meant Bram, but I feel we could really start a proper game and programming society here. But if you want to truely debate a subject, you need to first use the correct terminology.
Fri, 05 Jan 2007, 18:49
bram32
I agree, it would be nice to have a good community. For me, helping out on the forums has been very helpful. I read somewhere (I believe back on cw) that you learn the most by helping out others. That, I found, is true. I learnt a lot about game programming while trying to help the last year. For every answer, I take my time. Before I post links or routines, I check them, twice if needed. I often read my posts and try to correct spelling mistakes. I admit, terminology is a problem, since English isn't my mother's tongue. So if I'm using any incorrect terms, please just correct me. I won't feel offended. I'd be happy to learn. But I do want you to know, that when I answer, I try to answer seriously and to the best of my knowledge.
Sat, 06 Jan 2007, 00:46
shroom_monk
OK, thanks guys. I will try out your suggestions.

@mousey - I'm glad you like my title.

-=-=-
A mushroom a day keeps the doctor away...

Keep It Simple, Shroom!
Sat, 06 Jan 2007, 02:52
shroom_monk
OK, I've made some more changes, based on what you said. But for the new collision thing without using the image, I put in a whole new system. And I think that collision loop is what is now slowing it down. Any suggestions on that? (use the old download link at the top)

-=-=-
A mushroom a day keeps the doctor away...

Keep It Simple, Shroom!
Sat, 06 Jan 2007, 09:11
bram32
It is difficult to optimize the program, because it runs fairly okay on my system. I tried ReadPixel instead and removed the timer. I don't know if it helps:

Sat, 06 Jan 2007, 10:48
shroom_monk
Bram32 - I couldn't make your system work with my game for some reason.

Anyway, it appears to run at decent speeds on other peoples computers, so I'll leave it as it is, and work on my other idea.

-=-=-
A mushroom a day keeps the doctor away...

Keep It Simple, Shroom!
Sun, 07 Jan 2007, 07:52
power mousey

shroom,

I tried your program. the source looks cool and the backgrounds too.

But.....but, the game runs too fast cause after I press any key it says game over and that I lose.

Either that, or my mousey paws n claws move slower than a snail. At a speed of a sloth. I just hang in the trees and sleep.

cheers,
power sloth mousey
Sun, 07 Jan 2007, 09:00
shroom_monk
Have you tried the newer version in the Community Project topic? I added some other stuff to that.

-=-=-
A mushroom a day keeps the doctor away...

Keep It Simple, Shroom!