davidn: (prince)
[personal profile] davidn
Yes, I said that it wasn't over yet. But today, I spent my time finally cutting down the first level of Crystal Towers 2 to make it suitable for uploading as a Flash demo as an advert for the full game. That meant replacing the music system (which handled MODs), anything that ever accessed the hard drive (which was everything), and a couple of graphical extensions which don't have Flash equivalents (which I'd happened to use extensively).

It just shows the first level and the types of challenges that you can expect later in the game, along with hopefully directing some traffic back to the full game - you can now play it on Newgrounds.

Tomorrow I am not going to work on anything at all.

Date: 2011-07-03 05:15 am (UTC)
From: [identity profile] ravenworks.livejournal.com
Err :X Not to interfere with your empty schedule, but... is it really slow for you too? I have a pretty fast processor, and it's... distinctly underwatery feeling... if I had to guess, it's that your game runs at something like 60 fps, but... well, browsers NEVER give you 60 fps, but you aren't frameskipping if the enterframe events take twice as long as you asked them to...

It should be easy enough just to loop over your game logic a number of times corresponding to the clock difference since the last enterframe, though.

Date: 2011-07-03 05:25 am (UTC)
From: [identity profile] ravenworks.livejournal.com
At the risk of telling you something you're perfectly aware of, I'm going to err on the side of explaining more than I need to, rather than risk you spending a bunch of time implementing a less-great solution...

The way I spelled it out in the previous comment, it would sound like the solution is

gap = currenttime - previoustime
while (gap > 1000/60) {
    doLogic();
    gap -= 1000/60;
}

which would be fine if you were consistently getting 30 or 15 fps instead of 60...

but in the case of something where you're consistently getting 45 fps, it would do very little to actually help the problem, since you're never actually falling a full frame behind...

what I do is this:

theoreticalFrames = currenttime - gamestarttime;
while (framesThisGameHasHad < theoreticalFrames) {
    doLogic();
    framesThisGameHasHad++;
}

so that the overflow can actually build up over two or three frames before a skip kicks in to right you, like a leap year.

It's less noticeable than it sounds (and it's EASILY less noticeable than running at 75% speed, making this easily the lesser of the two evils.)

Actually I left one important thing out of that previous example for the sake of readability, but you'll probably want

theoreticalFrames = currenttime - gamestarttime;
// this part
if (theoreticalFrames - framesThisGameHasHad > 5) {
    framesThisGameHasHad = theoreticalFrames - 5;
}
//
while (framesThisGameHasHad < theoreticalFrames) {
    doLogic();
    framesThisGameHasHad++;
}

just so it never skips TOO many frames, like if the hard drive suddenly gets busy with itself you'd rather have the game freeze for a second than jump forward a second without you... not to mention, if someone really does have an abysmal computer, slow motion WOULD be preferrable to frameskip in their case (but maybe call up a "hey the binary's much faster so maybe try that" message)

Date: 2011-07-03 05:28 am (UTC)
From: [identity profile] ravenworks.livejournal.com
err

theoreticalFrames = (currenttime - gamestarttime) / (1000/60)

:P

and incase it wasn't obvious from context, framesThisGameHasHad is global, i.e. is initialized at program start and sticks around

Date: 2011-07-03 06:25 am (UTC)
From: [identity profile] xaq.livejournal.com
Darned muscle memory...sat on that demo for a good 2 minutes trying to figure out why nothing was working.

Then I remembered: My controls on the full game are setup completely different from the defaults. XP

Buttons

Date: 2011-07-03 08:50 am (UTC)
From: (Anonymous)
Using the Z button together with X and C is not a very good idea. On german keyboards e.g. Z is in a completely different place...

Date: 2011-07-03 02:29 pm (UTC)
From: [identity profile] ravenworks.livejournal.com
You shouldn't need its permission as long as you can read the system time accurately! (Err.. assuming that all your logic stems from a single call, which now that I think about it, may not be how clickstuff works..! Phooey..)

But yeah, at the very least, it would probably be easy enough for THEM to implement as a configurable option somewhere :)

Date: 2011-07-03 06:34 pm (UTC)
From: [identity profile] crassadon.livejournal.com
eh, it ran fast enough for me.

Pretty excessive, for a flash game. I was surprised that it went beyond the "get to the end of the first level" challenge. That's already longer than most games made in flash : P

Might want to note the controls in game, though. I was sort of smashing buttons until I found one that made the character jump.

Date: 2011-07-03 07:46 pm (UTC)
From: [identity profile] ravenworks.livejournal.com
It seems to be slightly better, depending on circumstances.... out of curiosity, what did you change?

(Interesting comments; "I'll fix the rest tomorrow", you marvellous bastard..)

Date: 2011-07-04 04:02 am (UTC)
From: [identity profile] tamakun.livejournal.com
Nice work on the adaptation! I found that the flash version does run a little slower than the downloaded version, but it still ran at an acceptable speed for me.

And I doubt you can adjust this, but I noticed that it has that odd "holding X down allows Bernard to keep jumping" versus the actual game where he doesn't continually make jumps if you held the key down.

I've had that exact song stuck in my head ever since I read this earlier today, somehow replacing the Raccoons theme song (https://www.youtube.com/watch?v=80CD_Ez4jXc) which got caught in my head the day prior. Your music's quite catchy!

(Sorry for us making you work on this the following day of saying "I'm not doing anything tomorrow".)

Expand Cut Tags

No cut tags

May 2020

S M T W T F S
     12
3456789
1011121314 15 16
171819 20 212223
24252627 28 2930
31      

Most Popular Tags

Style Credit

Page generated Jan. 28th, 2026 08:59 pm
Powered by Dreamwidth Studios