Stacker game devlog

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);

i decided to just live with the music bug cuz its just a bug in wick and it doesnt affect the html.

i actually changed the song in the game because it has both a regular and danger version. the song is Sprint from Tetra Legends (i know this is a marathon game and not a sprint game, but i just like this song more). if you stack really high the board becomes red and the danger version plays, and if you go back down the music becomes normal again.

the last thing I need is a display for the level, lines cleared, etc. maybe i’ll do score, not completely sure.

Stacker3-17-2023_9-55-24.html (3.3 MB)

edit: for some reason i’m finding that the game likes to freeze every now and then (for up to 10 seconds or maybe even more). i don’t know if it’s something to do with the music, or just really inefficient code somewhere getting caught, or the uncapped framerate causing stress, or something else.

the game is Done™. basically done, anyway. i’m probably going to move on to reprogramming this in Unity C#, or just plain Java.

i put back all the graphics. the new block skin is in now, and there’s a display for lines and level. also, you can press “r” to reset the game.

there’s no menus, no game over screen, none of that. just stacking blocks and stuff.

Stacker3-18-2023_21-15-08.html (3.2 MB)

1 Like

It feels like a good quality game. Congratulations. The grid animation for the game over is nice.

1 Like

maybe you could add a title screen and maybe settings as well. I know you’re done and if you don’t want to that’s fine (and yes I know you said the game is done)

no!! java is my least favorite language if i had one. how come String can overload the plus operator but i can’t?

2 Likes

:thinking:

trying to work on a new feature… let’s see how long i can keep trying for.

2 Likes

I love the art, the pieces with the shine FX. Question: why the game board has a double lined like thin line with a thick line? I think that It could be cleaner without the thin line. (just an opinion)

1 Like

i’m guessing you are talking about these on both sides.

in multiplayer, these would be used for, well, multiplayer reasons. the left side shows how much garbage you are about to receive. so here, there’s a red line 4 blocks tall in the left thing, and when i receive that garbage i get 4 lines of garbage.
garbageLines

the right side can be used for something else. one example would be to indicate level or lines cleared. so if cleared 7 lines out of the 10 lines needed to advance to speed level 2, the right side would be 70% full.

so those 2 columns are there in case i need them at a later time, and if they don’t need to be used, they won’t be.

2 Likes

so, i kinda half-succeeded and gave up.

i was trying to work on the zone, which is a mechanic from Tetris Effect. if you press a button, you can activate the zone and line clears accumulate like in the gif below. when you reach the top, all the lines clear at the same time.

there are a few minor bugs, like when you are supposed to “die” and clear the zone lines, it allows you to play one more piece. you can see it in the gif actually. there’s 2 T pieces (purple) in a row, and the first one should have stopped the second from spawning but it didn’t. i was allowed to place it still.

also it shouldn’t contribute to the line count. (that shouldn’t have been too hard of a fix, maybe)

zone_demonstration

not sure if I will release the html for this cuz it doesn’t exactly work properly. i think now is about a good time to transition to another game that i’ve been thinking about, or maybe i’ll return yet again to update this. (maybe i’ll start during the summer)

1 Like

preview of something i’m working on now… trying to do multiplayer, so here’s some garbage mechanics. (im using the keyboard to inject lines to myself as a test)

ezgif.com-video-to-gif-converter

2 Likes

nice, like preparing this for a multiplayer game…

here’s a pretty exciting update!

you can’t see the garbage queue yet (that should come soon hopefully), but you can send and receive lines now. you cannot cancel lines yet (defend against incoming garbage by attacking), but that is in the plan.

this actually does not use SomeoneElse’s websocket code, but it is powered by a replit server.

ezgif.com-video-to-gif-converter (1)

1 Like

multiplayer is, done? feel free to test it out along with me!

so basically, what happens now is you clear lines to attack/defend. there’s a one-second cooldown between being sent garbage and having it be able to attack you (so you can react). garbage is dim red when you cannot be hurt by it, and it is bright red when you can.

when sending garbage you attack every player online cuz i’m lazy right now, which means that any more than 4 players is essentially chaos.

attack table is as follows.

     SINGLE - 0
     DOUBLE - 1
     TRIPLE - 2
       QUAD - 4

SPIN SINGLE - 2
SPIN DOUBLE - 4
SPIN TRIPLE - 6

  ALL CLEAR - +10

there are no combos or back-to-backs because i’m lazy lol

you can press “R” after you die to instantly revive, cuz why not

Stacker multiplayer1-4-2024_20-49-11.html (3.2 MB)

if i decide to make more changes, i might do a proper home screen, better UI, and customizable controls. i would make opponents visible but i think that would get very hard and slow, very fast.

1 Like

I’ll take a look in within 2 hours… Is this online multiplayer or local.

online multiplayer, but you can’t tell if others are online unfortunately… you only know when you receive garbage. i hope to make opponents visible but i’ll have to see what i can do.

I’m playing… I left. It works pretty well. Congrats, great game, and beautiful graphics.

looks like it works pretty well then! i’ll try to add opponent previews now and hopefully it will work.

1 Like

websocket has been doing some funny stuff lol

  • you cannot use wick-specific code inside of a websocket event handler thing, because it will not understand what it means. this INCLUDES calling an outside function that uses wick-specific code lol. so when adding SFX to the garbage sending, i had to make workarounds because i could not use playSound() when receiving a lines message from the server.
  • if i remember correctly, SomeoneElse’s server was able to be kicked on when someone tried to join the server. so the Replit is usually turned off cuz of inactivity or disconnection or something, but magically if you connected to the server it would automatically turn the server on. i literally have no idea how that works and i can’t get it to work with my new server code.

anyways, i will try some more with the multiplayer thumbnails a little later, but i did add sound effects (will release along with the multiplayer thumbnails).