Stacker game devlog

i think my new stacker-that-definitely-isnt-t*tris game is barely functional enough that i can show it to everyone. but barely functional it is.

the tentative to-be game will be called Matrix Masters or something if it goes well, and it should be a game that focuses on very fast gameplay. so make sure you have a good gaming chair.

the controls are:

  • left/right to move left/right
  • down to soft-drop (the piece doesn’t lock on its own)
  • space to hard-drop (the only way to lock the piece)
  • up or x for clockwise rotation
  • z for counterclockwise
  • shift for 180 rotation

it’s supposed to run 60 fps and it does on my computer, but i’m curious to see if it runs well for everyone else.

you can rotate clockwise or counterclockwise, or rotate 180 degrees. CW and CCW follows modern kicks (for now), and 180 rotations don’t kick at all (yet).

there is no auto-shift, so you have to press the left/right key every time you want the piece to move over.

there’s no line clear, no death, no gravity, no next/hold, no fancy graphics, none of that. also, the game crashes if your stack exceeds row 22 (that will be fixed). so all you can do is stack pieces.

Stacker11-10-2022_20-46-13.html (2.1 MB)

big to-do list: basic game function, all the modern mechanics, nicer graphics, matrix sway (the board bounces around as your pieces move), sounds, multiplayer maybe???

5 Likes

runs super smooth nice game to play without the stress of the actual game lol. graphics are fine and i can help make some if you want

this actually works pretty well! for the gravity, you can add a timer of some sort that when it is over, the current moving ter, urm, block structure moves it down a certain amount depending on the score(the higher, the faster). i feel like a cool gimmick would be if the game was based on random events that occur either every score milestone or when you clear a line, such as clearing/filling a column and sometimes hilarious and/or devastating distractions. however, that would take a bit of work, and it would probably feel like the game is against you sometimes. a nice thought though. and for multiplayer, im not exactly sure if you can do wireless online gameplay, but side by side is a possibility.

and to assist with this, i have create some possible controls that can get changed later on, but hopefully this will help
player 1:
a and s for left and right
q and e for clockwise and counterclockwise
w and x for soft and hard drop
z for 180 rotation(this will be explained later)

player 2:
left and right arrow keys for left and right
up and down for clock/counterclockwise turn
up and down arrow keys for soft/hard drop

enter would be our other makeshift-shift for p2, as originally, because the game probably wouldn’t tell between either of the both shifts on the keyboard. so i thought p1 could get shift and p2 enter. but because then the first previous message, p2 could sabotage p1 via pressing shift on their side of the board, so, that why p1 has z instead of shift this control conception. hopefully, this is good enough feedback, but yeah. this is pretty cool.

new update, it’s small but it’s nice.

visually nothing really changed, and i didn’t really make that many internal changes either, but now you can hold left and right instead of tapping every time. also, the code now has a way to manage the speed of the soft-drop (the speed that the block falls down when pressing the soft-drop button). still no clearing lines yet, that will probably be next, followed by probably a code cleanup.

i made the default framerate 120 now as a means of testing how fast my game can run (it actually runs at more like 125 fps because of the way wick handles framerates), but the more clips there are on-screen the slower the game gets. so let me know when you notice the framerate to dip below 120 (mine happens maybe 2/3 of the board is full).

(note: at this point for me the game runs at about 100-110 fps, but the screenshot caught when the framerate was reported as 89)

  • 120 fps when the board is completely full or until it is mostly full
  • 120 fps when the board is empty, dips below as the board is being filled
  • 90-120 fps at the start
  • 60-90 fps at the start
  • below 60 at the start

0 voters

Stacker soft drop12-25-2022_13-04-01.html (2.1 MB)

1 Like

Depending on the computer, I think most of them would not see the 120+ fps. I see it from the beginning until the end… but, this is a M1 Max chip macbook pro.

1 Like

line clears! this actually took more work than you might expect. let me know if there are any bugs with the line clearing.

next up is probably a shadow/ghost piece or next queue.

Stacker line clear wow yay woohoo12-27-2022_22-47-48.html (2.1 MB)

few new things.

  • the board is an actual image of a board instead of just a rectangle, definitely looks better now
  • next queue with 5 next pieces, no hold yet
  • sound effects as of now they are the Tetra Online soundpack, but i want to make custom sounds soon
  • delays
    • a short delay between placing the piece and the next piece spawning
    • a longer delay when lines are clearing
  • i decided to add funny kicks to the O piece (the yellow square), just because i can

Stacker1-3-2023_15-43-08.html (2.3 MB)

1 Like

Also, I have to press the space bar so the piece can be submitted to the board. It doesn’t do it automatically yet…

1 Like

so i got a bit carried away with effects… whoops lol

so now there is basic spin-detection. if you have no idea what i’m talking about, don’t worry about it. if you do, all pieces (including the T piece) use the immobile spin check as of now (if the piece can’t move up/down/left/right when it locks, it’s a spin).

the graphics are updated. they look kind of out-of-place though, so i may change them in the future.

line clears look fancier now. when a line clears, there’s 2 animations taking place, neither of which i really know how to describe well.

  • when a line is full, there’s a white stripe that takes the line’s place and flashes away.
  • the blocks that are cleared turn white, pop out of the stack, and eventually fade out.

here’s a slowmo of the line clear. it’s gone from my screen recorder to a slow-mo-ifier (as you can see from the watermark) and a video-to-gif converter so it looks kinda disgusting, but it gets the job done. you can see the white stripe and the blocks jumping out, falling, and fading.
slowmo

so now i’m pretty sure the frame rate is even worse now, buuuut hopefully it’s barely playable?? i might turn off the line clear effects in future updates or leave them to a toggle.
Stacker1-21-2023_13-54-01.html (2.9 MB)

and yeah at some point i will do what i previously said i would (along with the piece automatically locking when it’s on the ground).

just realized that when updating the sprites for the blocks, i didn’t update the sprites of the next queue pieces… whoops, i’ll fix that eventually.

1 Like

The animation is good… I have noticed that when you rotate the yellow one, it started to go to the right every single time.

that’s intentional. it doesn’t do that in normal games but i chose to do that for the funnies.

basically the O piece (the yellow square) tends to be the least interesting piece because since it rotates in place, you can’t rotate it into funny places. so i basically made it so that when the piece rotates, it doesn’t rotate on its center so that you can do silly stuff with it.
ospin

so now the piece is able to get into tight spaces and even climb up 1 block.

and i guess it’s also worth noting that if you rotate clockwise it will go to the right, and if you rotate counterclockwise it will go left.

3 Likes

so i don’t completely remember what i had in the previous version, but i’ll just run down what i have now.

  • a working game… obviously
  • super rotation system kicks, but there’s funny kicks for the O piece (yellow) and an extra kick for the S and Z pieces (green and red respectively) that make them a little less likely to get stuck
  • 5 next pieces and a hold piece
  • a ghost/shadow piece, finally
  • other modern features, including 180-degree rotations (with no kicks)
  • uncapped frame rate, because why not
  • block skin that will be changed out Soon™ because it’s a little unfitting
  • nice-looking line clear animations
  • a healthy amount of customizability (in the code, unavailable for the player)
    • one of these customizations includes having the piece fall smoothly down instead of strictly following the grid. this is turned on for the purpose of showing what i’ve made, but i will most likely turn it off in the future. you will see what I mean when you play the game, it’ll be one of the first things you notice.
  • over a thousand lines of code!

also, for this demo thing, you can infinitely hold the piece even if you’ve held the piece already.

i still need to make the piece auto-lock after some time, and I will also probably change the block skin. I actually still need to make the player lose if the next piece can’t spawn, and the game is still limited to 22 rows high. last thing i want to do is add a leveling system, and I will probably be Done™ after that.

this is what I have so far for the new skin.

let me know what you think. or don’t, that’s fine too.
Stacker2-22-2023_18-10-09.html (3.0 MB)

2 Likes

bug fix with the smooth falling, I think it should work flawlessly now. (there will still be a couple of oddities with it, and i’m not exactly willing to adjust the game just for them. thats just what happens when you take a grid-based game and take it a little off the grid.)

Stacker2-23-2023_15-05-13.html (3.0 MB)

small update sort of, i didn’t do any of the things i said i would lol, but now the board reacts to the movement of the pieces. for example if you try to move the piece left and the piece hits a wall, the board will sway to the left. there’s also some rotational torque-like stuff for all the off-center stuff.

Screen-Recording-2023-03-01-at-1

Stacker3-1-2023_10-53-52.html (3.0 MB)

2 Likes

finally, after all this time, you can lose the game. :P still no auto-locking stuff yet, so if you want to technically never lose the game, you could just do nothing lol.

also, there’s some leveling now. i made the levels advance super fast for testing purposes, so instead of clearing 10 lines to advance a level like you’d expect, you only have to clear 4. the level curve is similar to guideline games, but not identical. it wasn’t really necessary for me to make my own formula but whatever.

board sway is turned off and soft drop is slower now. honestly the soft drop is kind of annoyingly slow, so i may change it back in the future. infinite hold is still on.

so obviously this game is approaching (or already at) the point where it’s unplayable for most players. for me it runs perfectly fine at 60fps at its absolute worst, but this game will probably run at like 20 fps for your average school chromebook.

but i can proudly say that this game, in its (mostly) worst case scenario, still runs twice as fast as my previous stacker game. like i downloaded my old game, opened the file in wick, and uncapped the framerate and it legit runs at 30 fps from the start. and this game has so many more effects and stuff. so i’ll take it as a win.

oh yeah you still crash the game if you stack above 22 blocks lol

Stacker3-9-2023_21-46-27.html (3.2 MB)

1 Like

quick update, auto-lock stuff is here now. so now the piece will lock on its own if it sits on the floor for 500 milliseconds (that’s just the normal lock time). also i increased soft-drop speed a bit.

Stacker3-9-2023_22-37-20.html (3.2 MB)

i added support for music, but that makes the file size explode so i won’t include it. it made use of Jovanny’s WickSound class, but I modified it slightly to add better looping. so basically instead of simply going from the end back to the start, the user can define the end of the loop and how long the loop is. that way, the game will loop to the correct place and not just the beginning.

also I made the board sway a little more efficient. it’s not good enough for me to turn it on though. i also removed the line clear effect while I was at it too, just to save a little bit of energy.

Stacker3-14-2023_20-37-31.html (3.2 MB)

i guess at this point i’m more or less done with the game. at some point i’ll add some toggles so you can mess around with the visual effects but i’m not gonna do much more probably. i guess i’ll stick in the new block skin as well.

if anyone wants to offer last-minute suggestions, go for it. i might try to do a local multiplayer mode just for the funnies (no promises), but most people wouldn’t really be able to play because of the lag.

Try to use a music compression tool online… It will change the quality but the size could be reduced in some cases 10 times. (That is what I usually do, so people can have an idea of the entire experience) You can also do what @Hamzah_Alani does, which is streaming the music from outside.

1 Like

i’m getting hamzah’s method to sorta work, but the music keeps playing inside the editor after stopping the project.

to try to fix this, i’ve been looking around the wick source code and found that stopAllSounds() lives inside of this file. the editor also appears to use stopAllSounds() when stopping the project, which should be what I want.
Screenshot 2023-03-15 at 11.55.39 AM

i’m thinking maybe i can override stopAllSounds() to also include instances of WickSound (cuz i’m using it for looping), but i don’t know how I can do that.

i would think maybe it’s like:

something.stopAllSounds() = function() {
    stopAllSounds(); // original stopAllSounds
    for(all WickSound objects) {
        sound.stop();
    }
}

but this isn’t supposed to be a recursive thing, just an override. i’m not even sure if i can override the method since it’s in an entirely different file and stuff.

@Jovanny any ideas?

in case you want to know, this is what I have for the music-related stuff. window.stopAllSounds() doesn’t work, but it’s a random attempt I made (i didn’t try that hard at this part)

window.allWickSounds = [];
// WickSound by Jovanny, modified by me to add looping and URL source
window.WickSound = class {
	constructor(assetName, loopEnd, loopTime, play = false) {
	    this.asset = new Howl({
	        src: [assetName],
	        autoplay: play
	    });
		//this.asset = project.project.getAssetByName(assetName);
		this.loopEnd = loopEnd; // where the loop ends
		this.loopTime = loopTime; // milliseconds of looping
		this._pan    = 0;
		this._volume = 1;
		this._seek   = 0;
		this._loop   = false;
		this._muteVolume = 1;
		
		allWickSounds.push(this);
	}

	loop(loop) {
		if(loop === null || loop === undefined){
			return this._loop;
		}
		this._loop = loop;
		this.asset.loop(this._loop);
	}
	
	checkLoop() {
	    if(this.seek() > this.loopEnd) {
	        this.seek(this.seek() - this.loopTime);
	    }
	}

	// Method for volume control, volume = 1 is the default sound volume. 
	volume(volume) {
		if(volume === null || volume === undefined){
			return this._volume;
		}

		this._volume  = volume;
		if(this._volume<0) {
			this._volume = 0;
		}else if(this._volume>1) {
			this._volume = 1;
		}
		this.asset.volume(this._volume);
	}

	// Method for panning pan = -1 all left, pan = 1 all right...
	stereo(pan) {
		if(pan === null || pan === undefined){
			return this._pan;
		}

		this._pan = pan;
		if(this._pan<-1) {
			this._pan = -1;
		}  else if(this._pan>1) {
			this._pan = 1;
		}
		this.asset.stereo(this._pan);
	}

	// seek sound in seconds from 0 to sound duration
	seek(seconds) {
		if(seconds === null || seconds === undefined) {
			return this.asset.seek();
		}

		this._seek = seconds;
		if(this._seek >this.duration()) {
			this._seek = this.duration();
		} else if(this._seek<0) {
			this._seek = 0;
		}
		this.asset.seek(this._seek);
	}

	play(seconds=this.seek()) {
		if(!this.isPlaying()) {
			this.seek(seconds);
			this.asset.play();
		}
	}

	mute() {
		this._muteVolume = this._volume;
		this.volume(0);
	}

	unmute() {
		this.volume(this._muteVolume);
	}

	isPlaying() {
		return this.asset.playing();
	}

	stop() {
		this.asset.stop();
		this.seek(0);
	}

	pause() {
		this.asset.pause();
		this._seek = this.currently();
	}

	currently() {
		return this.asset.seek();
	}

	duration() {
		return this.asset.duration();
	}
};

window.stopAllSounds = function() {
    this.getAssets('Sound').forEach(soundAsset => {
        soundAsset.stop();
    });

    // Stop all sounds on frames
    this.getAllFrames().forEach(frame => {
        frame.stopSound();
    });
    
    allWickSounds.forEach(wSound => {
        wSound.stop();
    });
};

[...]

window.song = new WickSound("https://media.githubusercontent.com/media/Juan-Cartes/Tetra-Offline/main/Assets/Resources/Music/dance-grid.ogg", 215.63, 162.001, true);