Computer Science Canada

Click Click Defence

Author:  copthesaint [ Tue Jun 15, 2010 2:21 pm ]
Post subject:  Click Click Defence

Well I was bored yesterday and today aswell, so I made this game, which my friends thought was pro :p its a very interactive defence game when you have to click click on every target before they reach the destination :p You need both files to play, and they both must be in the same director

if anyone gets to level 10 without cheat engine, printscreen and show me! lol

Author:  Cezna [ Tue Jun 15, 2010 2:46 pm ]
Post subject:  RE:Click Click Defence

Lags a bit, but has a very cool explosion animation.

You should use View.UpdateArea instead of View.Update (I believe it was actually you who posted the topic where I learned that even if you are using View.UpdateArea to view the whole screen, it goes faster than View.Update, but sorry if I'm wrong)

EDIT: in this section of the code:
Turing:

particles -> newStar (x - 1 + i, y, o (i).clr)


What does the -> mean, I have seen it before, but have no idea what it does.
Is this how you avoided using a process for the death effect?

Author:  copthesaint [ Tue Jun 15, 2010 2:49 pm ]
Post subject:  RE:Click Click Defence

Lol It doesnt lagg, its just your computer... lol, The computer you used to test it, was it a win 98? or what? No offence, it's just old desktop with win me runs this without lagg.

Also, thanks, but this isnt me asking for help, also the -> is just a reference to the method from the pointer


Too prove no *lagg* replace the code of the loop main program with this where View.Set is and down with this:

The most delay Ill ever get in-game is 7 ms which you will only get if you reach lvl 7! *I dont believe possible lol
plus there is a Time.Delay since last of 24 ms, so there is no lagg

Turing:
View.Set ("Graphics,OffscreenOnly,NoButtonbar")
particles -> initStarsIDAll
levelTimer := Time.ElapsedCPU - 10000
lvl := 1
var currentTime, prevTime : int := 3
loop
    currentTime := Time.ElapsedCPU
    put "Total Delay: ", (currentTime - prevTime)
    prevTime := Time.ElapsedCPU
    Mouse.Where (mX, mY, mB)
    timer := Time.ElapsedCPU
    if mB = 0 and reset = true then
        reset := false
    end if

    if mB ~= 0 and reset = false then
        clicked := true
        reset := true
    end if

    if levelTimer + 15000 < timer then
        lvl := lvl + 1
        newObject (Rand.Int (1, 4))
        levelTimer := Time.ElapsedCPU
    end if

    for i : lower (o) .. upper (o)
        if (o (i).timeDelay + Time.ElapsedCPU) <= timer and o (i).running = false then
            resetObject (i)
        end if
        if o (i).running = true then
            if clicked = true then
                if ((mX - o (i).x) * (mX - o (i).x)) + ((mY - o (i).y) * (mY - o (i).y)) < 49 then
                    freeObject (i)
                    deathEffect (round (o (i).x), round (o (i).y), i)
                    score := score + round ((o (i).vel + (lvl / 20)) * 1000)
                end if
            end if
            moveObject (i)
            drawfilloval (round (o (i).x), round (o (i).y), 6, 6, o (i).clr)
        end if
    end for
    particles -> drawStars
    View.Update
    %Time.DelaySinceLast (24)
    cls
    %exit when lives <= 0
    drawfillbox (0, 0, maxx, maxy - 25, 24)
    Font.Draw ("Score: " + intstr (score), 5, maxy - 12, fnt1, black)
    Font.Draw ("Lives: " + intstr (lives), maxx - 72, maxy - 12, fnt1, black)
    if levelTimer + 12000 < timer then
        Font.Draw ("Level " + intstr (lvl) + " in: " + intstr (round ((levelTimer + 15000 - timer) / 1000)),
            maxx div 2 - (Font.Width ("Level " + intstr (lvl) + " in: " + intstr (round ((levelTimer + 15000 - timer) / 1000)), fnt2) div 2), maxy div 2, fnt2, black)
    end if
    clicked := false
end loop

Author:  Cezna [ Tue Jun 15, 2010 3:22 pm ]
Post subject:  Re: Click Click Defence

My pc is a duo core running Windows XP, with nothing running in the background but one firefox tab.

It might not be lag, but instead just the deathEffect running its course, I would have to understand that pointer thing a little better to know for sure (I am still learning classes by reading a tutorial on this site).

As for the View.Update, I was trying to point out some advice that you gave here:

http://compsci.ca/v3/viewtopic.php?t=20238

I did not mean for it to come across as condescending.

Below is a picture taken with print screen on level 2 or 3 I think it was, and it got up to 254 one time, but I couldn't hit printscreen fast enough to catch it, so this is it on the tail end of the lag spike.

Author:  copthesaint [ Tue Jun 15, 2010 3:37 pm ]
Post subject:  RE:Click Click Defence

just as I thought, your computer. Go, press Ctrl-Alt-Delete then go to resource monitor and check what's consuming your processor. Also saying duo core, doesnt help. I would need to know how much Ghz for each core and how much ram you have.

If you read the whole discussion here
http://compsci.ca/v3/viewtopic.php?t=20238
you find out that really there isnt any benefit unless you want trailing lines and using it for the whole screen aswell doesnt save any substantial speed.

Next time Pm me cause this is way off topic and false judgments...

Author:  copthesaint [ Tue Jun 15, 2010 3:38 pm ]
Post subject:  RE:Click Click Defence

I have to say, you probably just here on killed my topic from any responses to the program it's self...

Author:  Monduman11 [ Tue Jun 15, 2010 3:41 pm ]
Post subject:  RE:Click Click Defence

nope he didint i played ur game and it think its awsome lol way better than mine Smile how long did it take to make? and how do you do the shattering effect?

Author:  copthesaint [ Tue Jun 15, 2010 3:44 pm ]
Post subject:  RE:Click Click Defence

It took me 4 hours to make it in total time, The shattering effect is just a bunch of variables in arrays that are recalled and a bunch of other stuff that is hard to explain in something short and sweet! basically arrays. look at the starDebrisClass

Author:  Monduman11 [ Tue Jun 15, 2010 3:46 pm ]
Post subject:  RE:Click Click Defence

kk i will thx Razz btw great game Razz

Author:  Cezna [ Tue Jun 15, 2010 4:03 pm ]
Post subject:  RE:Click Click Defence

As you can see, healthy debate does not ruin interest in a program (and if it did, doubling posting can't possibly help)
Very Happy

And about the View.UpdateArea, I am just regurgitating what you posted, so it must do some good (however small a boost in speed) or it wouldn't have been posted.

As for my speed, I know how to check my resources, and there is next to nothing running on this machine.
And just because it has a long delay, that dosn't mean that my machine is slower than any other average machine.... that could just as easily mean the program is lagging it up because it is doing so much.

Anyway, I did not mean to seem overly aggresive, and if I did, I apologize.

Despite anything I said, it is still a great game.

Author:  chrisbrown [ Tue Jun 15, 2010 6:32 pm ]
Post subject:  RE:Click Click Defence

Try these changes to smooth things out (may need to adjust):
Turing:

o (i).vel := Rand.Int (1000, 2000) / 3000  %Line 31
Time.DelaySinceLast (8)  %Line 98

Author:  copthesaint [ Tue Jun 15, 2010 8:06 pm ]
Post subject:  RE:Click Click Defence

uggh, I dont believe a word you say Cezna, Show me an Nfo of your computer then if its legit, I'll believe its my program.

@chrisbrown For his computer, unfortionatly that wont help since he is running at 93 ms per loop, 20X Aprox. slower then my own computer, and 3X slower then my Old standalone. However that will smoothen it out for other computers Smile but is 100+ cycles per loop really needed? lol, Wink I wish my tv ran that many cycles... Sad

Author:  chrisbrown [ Tue Jun 15, 2010 8:15 pm ]
Post subject:  Re: RE:Click Click Defence

copthesaint @ Tue Jun 15, 2010 8:06 pm wrote:
but is 100+ cycles per loop really needed?

Why limit it at all? I was actually going to suggest you make it time-based, and remove the delay altogether. This seemed like an easier way though, at least for faster machines.

Author:  copthesaint [ Tue Jun 15, 2010 11:28 pm ]
Post subject:  RE:Click Click Defence

I was going to use Fps, but I was set to a goal for first version to get done during two lunches XD. The computers at school will not be accessible anymore so I wanted to post it so I can download it :p When I get bored during this summer, I will work and actually try to make it a good quality game. this was just something I throw together quickly over 2 hours using an older class of mine lol.

Author:  Cezna [ Wed Jun 16, 2010 5:40 am ]
Post subject:  RE:Click Click Defence

As I explained, that 94 was a spike, not the consistent running speed (which was around 3 to 4 most of the time).
Don't know what an Nfo is Embarassed

Anyway, that dosn't really mater, and I think both of us have gone too far with it.

I do look forward to your next release though!
And just an aside, if you want to transfer anything else, Google Docs is always an option, as it also allows you to upload files (good ol' cloud computing), so you won't have to post them to the site.

Author:  copthesaint [ Wed Jun 16, 2010 12:43 pm ]
Post subject:  Re: Click Click Defence

Though way off topic, an NFO is your system information, with it you can see basically all installed software, hardware on a computer, error reports, processes, everything but actual files or anything like that as ROM. I just wanted to first look at your system summary first so I can see if the speed has to do with your lack of computer speed, or if you just have to much running on your computer.

Here is my NFO as an example. I don't have anything anyone would get from looking at this other then the fact bit torrent appears in it :p
Pm me or even the admins and they would even most likely be able to tell you whats wrong if you send us your NFO or even a printscreen of yours. To view you NFO of your computer, just open the file in the download, go to file -> close, then your System NFO file will appear. go to file again -> save, and save the name as whatever, this may take 2 min, then just send the nfo to me or dan or something if they have been following this thread.

Edit Nfos arn't allowed :p just highlight your system summary and paste here lol.
Edit #2 since You cant use my Nfo as a shortcut, either save a textdoc as and .NFO and open it, open msinfo32.exe located in system32 in Windows

This is my labtop, nothing special about it, believe me. lol
code:
OS Name Microsoft? Windows Vista? Home Premium
Version 6.0.6001 Service Pack 1 Build 6001
Other OS Description    Not Available
OS Manufacturer Microsoft Corporation
System Name     CHRISTIAN-PC
System Manufacturer     TOSHIBA
System Model    Satellite L300
System Type     x64-based PC
Processor       Intel(R) Pentium(R) Dual  CPU  T3200  @ 2.00GHz, 2000 Mhz, 2 Core(s), 2 Logical Processor(s)
BIOS Version/Date       INSYDE 1.30, 09/10/2008
SMBIOS Version  2.4
Windows Directory       C:\Windows
System Directory        C:\Windows\system32
Boot Device     \Device\HarddiskVolume2
Locale  Canada
Hardware Abstraction Layer      Version = "6.0.6001.18000"
User Name       Christian-PC\Christian
Time Zone       Eastern Daylight Time
Installed Physical Memory (RAM) 4.00 GB
Total Physical Memory   3.87 GB
Available Physical Memory       2.76 GB
Total Virtual Memory    7.95 GB
Available Virtual Memory        6.45 GB
Page File Space 4.16 GB
Page File       C:\pagefile.sys

Author:  copthesaint [ Wed Jun 16, 2010 12:56 pm ]
Post subject:  Re: Click Click Defence

Double post because the first one is directed specifically to Cezna

Anyone make it to level 10?
One of my friends made it to lvl 8 XD after half an hour of failed attempts lol.


: