ejona86 / taus

Tetris - Actually Useful Statistics and other mods
MIT License
90 stars 3 forks source link

[two player mod - feature wish] make it more like CTWC #27

Open yepyepyep4711 opened 3 years ago

yepyepyep4711 commented 3 years ago

Hello @ejona86!

First, thanks a lot for this fantastic mod! Allow me explain where my excitement comes from: today, I successfully used this mod to play a vs game across the network. That's right, player one was my laptop, while player two was my console, and both used Retroarch and Netplay to play against each other while viewing the same screen. Amazing! We could play against each other across continents and still see what the other is doing!

It got me thinking: could this be made to be more like the Classic Tetris World Championship overlay? For illustration: https://www.youtube.com/watch?v=dtLQOIwdjX4 So we're looking at six to seven bits of data, some we already have: score, next piece, lines, level, then the new ones score difference, Tetris rate (TRT), and possibly the tally of max three victories that would start a new match after three victories by the same player. That last one might be more hassle than it's worth, though, as outside of competition people might be fine with deciding for themselves how many games they want to play against each other, and it means additional game logic.

What do you think? Is any of these feasible? If only one is, it should be score difference with red and green, as it's the simplest indicator of who's leading. If place doesn't allow for additional data at all, maybe just making the taller score green and the smaller one red? Colours are easier to spot off the corner of your eye while concentrating on the playfield than just numbers.

As an aside, here's how the real CTWC overlay works, which is quite amazing in its own right: https://www.reddit.com/r/Tetris/comments/9sbdl6/how_the_classic_tetris_world_championship/

Many thanks again and best regards

ejona86 commented 3 years ago

Such a thing is possible, and a partial implementation is in twoplayer when compiled with make CAFLAGS=-DTOURNAMENT_MODE. Although I think I broke it accidentally on master, but it looks like it was building at v1.1.1 tag. See https://github.com/ejona86/taus/pull/1 and https://github.com/ejona86/taus/pull/4 . It has the UI designed and some stats, such as the lead.

I had originally thought taus should provide the stats, but taus was incompatible with twoplayer at the time so the few implemented stats are just reimplementations.

All-in-all, it just needs someone to work on it.

yepyepyep4711 commented 3 years ago

so you're saying you don't have the time :) I understand that. Sadly, I wouldn't know where to start. Which is too bad, as I do have some time. As is, I'll just have to hope someone shows up to take up the mantle. The CTWC community would go bananas over this, I believe.

TGGC commented 3 years ago

Hi, I worked on the features you requested. Many things have been finished, at least inside a single game. Now also the menu needs to be extended to select a common starting levels in turns and Bo3, Bo5 and WarmUp Modes. I hit several roadblocks time only one of them, but in general would be willing to continue. I could however need more help for testing and also merging the version back into TAUS (or give up that both versions can coexist). But there was also quite a road map ahead to make it work the way I envisioned.

yepyepyep4711 commented 3 years ago

well that doesn't sound too bad! I could setup a cloud based development platform with jenkins if you want, to automate building and testing, although I'm being told github now has something similar called Actions. Also , if you mean testing by humans, I can dedicate some time. We would need requirements specifications of course so that we don't miss anything, but I'm willing to do the same thing over and over again :)

What do you think? Would it make more sense to integrate this in this project, or make a "CTWC" fork and leave this code base clean? If forking it is, I could also take care of writing the readme explaining what this is, where it comes from and where it's going.

ejona86 commented 3 years ago

@TGGC, are you referring to the stuff already merged or do you have more changes pending? Honestly, I thought the UI design was one of the largest parts of the effort. But I agree menu systems are a pain.

I'd be very willing to fixup master to get it working again. I was trying to keep it working but failed at one point; I think the rearrangements to have taus+twoplayer compatible caused the problem.

@yepyepyep4711, there's a CI here already. I think the issue is bug-seeking by a person.

yepyepyep4711 commented 3 years ago

@yepyepyep4711, there's a CI here already. I think the issue is bug-seeking by a person.

Great. I can do that. It'd be great if a list of specific tests to do already existed or if not, If I could get help compiling it, but other than that I'm happy to help

TGGC commented 3 years ago

There are no automatic tests, creating those would be very time consuming. Unfortunately manually checking is not easy especially for a multiplayer mode.

I think there were problems to update my fork to be at the latest version (I am still a git newbie...). And I think I also got to the point, where stuff like B-type, demos and highscores need to be removed to make more space for new code and UI screens. I would need to have a close look what was not put back in git or added to pull request. If I remember correctly I started working on a screen before the "real" game where you would enter names for the players, a common level for both and then initiating a start count down when both players indicate to be ready and none of that was added to git yet.

yepyepyep4711 commented 3 years ago

There are no automatic tests, creating those would be very time consuming. Unfortunately manually checking is not easy especially for a multiplayer mode.

I can test both local 1v1 and Netplay. I'll be using an NES Classic Mini with two players for local games and an Intel NUC based Batocera setup opposite a win7 laptop with Retroarch for Netplay.

yepyepyep4711 commented 3 years ago

@ejona86 @TGGC so, what do you think, guys? You code, I test? Should we get this show on the road? :)

TGGC commented 3 years ago

I think that currently all my forks stopped to even build and I lack motivation to fix this. Not really fluent enough in the linux world to work efficiently in my spare time. :(

yepyepyep4711 commented 3 years ago

So what should be the next step. Which code tree should we try and get back to the point it at least builds? I can set up a building environment fairly easily. So even though I'm not a programmer I could have a look.

ejona86 commented 3 years ago

I just made a change to avoid split -x, which should make things easier to build with older coreutils. I've also restored compilation of what is already merged. To build, use make CAFLAGS=-DTOURNAMENT_MODE. Make won't detect if you change the CAFLAGS, so make sure to make clean before running make with different CAFLAGS.

After a deep look, it actually seems like there's very little not merged at this point. https://github.com/ejona86/taus/pull/4 seems to correspond with the tournament_0_2 branch and there's only one commit after that in tournament_0_3. So this actually just needs to cherry-pick commit https://github.com/ejona86/taus/commit/e0a6c5bd443cd9ecd7f988f8497d37faef4255fc . That said, it does currently conflict because of 2086dbf6a0c2ddd3d72bf1c4b2f3a964acfaa9cc. But it should be easy to re-apply the changes in 2086dbf6a0c2ddd3d72bf1c4b2f3a964acfaa9cc on top of e0a6c5bd443cd9ecd7f988f8497d37faef4255fc.

@TGGC, are you fine if I cherry-pick https://github.com/ejona86/taus/commit/e0a6c5bd443cd9ecd7f988f8497d37faef4255fc into this repo? I'd leave you as the author, although I would modify the nam file to reverse the player palettes.

ejona86 commented 3 years ago

@yepyepyep4711, feel free to test this build: tournament-1.5.0-dev.zip. It has the nametable/background changes integrated I mentioned needed to be cherry-picked. It also has an easy change to avoid the curtain from showing when the game starts. I didn't realize it only really needed background changes. Looking at it with the background changes it is fairly complete, lacking only player name entry and win counter.

The hearts are present visually, but they never are updated. For drawing we'd need to use sprites for the hearts to change each heart individually. Using sprites does mean visual glitches would be possible, but in that position it would be very unlikely. We'll need a duplicate heart sprite to use palette color 3 instead of 2 or we can patch palette 0. The less obvious part to me is determining when to reset the win counters. If name entry UI were present, that would be a clear point.

yepyepyep4711 commented 3 years ago

@ejona86 that's excellent! I've tried a few local games and couldn't find something that didn't work. Still need to test netplay.

If I could prioritise, I'd say colours red/green for player scores according to who's leading and hearts counting and painting would take precedence over the possibility to input names. Hearts should get reset once the third one of any player turns red. After a congratulation (or highscore) screen maybe?

yepyepyep4711 commented 3 years ago

I've done some more testing, both one player modes need fixing. The statistics are broken. Take a look, you can't miss it :)

You could also just remove these modes, as this patch has a clear intended use, and that's two players against each other.

ejona86 commented 3 years ago

Yeah, a change for the tournament mode stole some graphic slots from one player mode. That was on purpose as far as "tournament mode doesn't care about one player mode." It'd actually be possible to make them work together, but I think we just don't care.

I was considering force-enabling twoplayer mode for the tournament mode, and I guess it would hide that. If we force both players to play on the same level, then we'd probably do that anyway.

yepyepyep4711 commented 3 years ago

I agree we don't care about one player mode. So forcing two player mode would be fine. I'm not sure about forcing the same level. On the one hand it makes sense in order to recreate the CTWC experience, on the other hand, why take away a function unless it improves the overall experience ?

yepyepyep4711 commented 3 years ago

Also, I was able to test netplay and it works just great. We're so close! :)

TGGC commented 3 years ago

The idea was to remove the UI option to play alone in tournament mode completly, but so far the menu system outside the game has not been reworked. I also can give the reason to force the level: it will save time when doing a tournament by automatically enforcing the rules. But there is definelty room to set up rules at the point you normally choose A/B Mode, at least Bo3/5 should be an option.

yepyepyep4711 commented 3 years ago

I never knew two player was actually intended in the original code https://youtu.be/9naf_YJtWRk . The piece stealing is fun :) And even B-mode looks fun. Also, I can report this patch works on original hardware. Sadly my hardware is PAL, so the speed is wrong. Should this work on a PAL rom? I haven't tried yet. EDIT: tried doesn't work. Will have to wait for the pal version of the tournament patch.

ejona86 commented 3 years ago

@yepyepyep4711, sorry, I missed the notifications for the discussion. PAL actually already works, I just didn't do the build for it earlier. Try this one: tournament-1.5.0-dev-pal.zip

The two player code in the original ROM did make it much easier to do the mod because the game engine was set up for two players. But two player had different timing than one player and the screen updates were too slow causing screen corruption. So the mod was reasonably involved.

yepyepyep4711 commented 3 years ago

@yepyepyep4711, sorry, I missed the notifications for the discussion. PAL actually already works, I just didn't do the build for it earlier. Try this one: tournament-1.5.0-dev-pal.zip

Excellent! It works like a charm :) And... I've finally found a bug: if the second player wins and scores a highscore, the level indicated on the screen when you enter your name (and subsequently after entering when the table is displayed when starting a new game) is wrong. It will display the highest level achieved by player one instead.

EDIT: also, is this supposed to save highscores? It doesn't.

ejona86 commented 3 years ago

@yepyepyep4711, I have fixed the level number for second player. The level number was being stored to the wrong location.

EDIT: also, is this supposed to save highscores? It doesn't.

What do you mean? "Save" like normal Tetris, or save even after power-off?

yepyepyep4711 commented 3 years ago

@yepyepyep4711, I have fixed the level number for second player. The level number was being stored to the wrong location. Cool, happy to test when there is a new version.

EDIT: also, is this supposed to save highscores? It doesn't.

What do you mean? "Save" like normal Tetris, or save even after power-off? Ah, yes, I meant save even after power off. Could the save highscore patch be applied to this?

ejona86 commented 3 years ago

Ah, yes, I meant save even after power off. Could the save highscore patch be applied to this?

Okay, that's expected. The tournament mod doesn't have any score-saving after poweroff. I've not tested save-highscores with tournament mod, but I'd expect the two to be compatible.

yepyepyep4711 commented 3 years ago

Ah, yes, I meant save even after power off. Could the save highscore patch be applied to this?

Okay, that's expected. The tournament mod doesn't have any score-saving after poweroff. I've not tested save-highscores with tournament mod, but I'd expect the two to be compatible.

Well it seems to work pretty well already. Not only will it save highscores, but if both players reach a highscore, both will be able to enter their names. The only issue I see is the wrong level for player two. Can you provide the current tournament version, so I can test with it?