New Game: COMPLICA DX

image image
image image
image image
  • Play COMPLICA, the most exciting variant of classic CONNECT-4!
  • Some of the best graphics and songs for the ZX-Spectrum ever! Amazing visual design by Dave "R-Tape" Hughes! Awesome soundtrack by Yerzmyey!
  • Customized version of BIFROST* ENGINE powering graphics and animations in multicolor 8x1, compatible with all official ZX-Spectrum models!
  • Huge game content for a ZX-Spectrum game (packing 12K of 100% Assembly code, 61K of standard and multicolor graphics, 12K of AY music) in 48K only!
  • The smartest computer opponent ever! Play against BRAINIAC (TM), an Artificial Intelligence algorithm implemented as recursive Minimax strategy with alpha-beta pruning, highly optimized for Z80 registers allocation, using heuristic evaluation and arbitrary recursion depth, multi-tasked in background from machine state controlled multicolor animated graphics... Yes, the A.I. really is as strong as it sounds!
  • Full source code available!
  • Countless hours of entertainment!
  • Download it now from here and have fun!
image
Creator of ZXDB, BIFROST/NIRVANA, ZX7/RCS, etc. I don't frequent this forum anymore, please look for me elsewhere.
Thanked by 1R-Tape
«1

Comments

  • edited June 2015
    What an extremely frustrating game

    Great work Einar and Dave.

    Thanks also for posting the source code
    always interesting to have a play with.

    Regards,
    Derek.
    Post edited by dbolli on
    1985: ZX Spectrum+ 48K Interface 1 ZX81 16KB ASZMIC/SP ROM Philips 12" B/W TV Epson Dot Matrix Printer ZX Printer Now: Late 2015 iMac 5K 27" 4GHz i7 32GB RAM macOS 10.15.6 1TB Ext SSD USB C Drive Ext 4TB 3TB and 2TB USB 3 Hard Disks Ext USB 3 Blu-Ray iPad R7 32GB iPhone 6s 64GB iOS 13.6 Apple TV Gen 2
  • You are welcome!

    I will post "playing tips" in a couple days, but let's give players a chance to play it by themselves first!
    Creator of ZXDB, BIFROST/NIRVANA, ZX7/RCS, etc. I don't frequent this forum anymore, please look for me elsewhere.
  • edited June 2015

    I occasionally beat level 4, but it's never a given that I'll be able to progress 1,2,3 every time.  Simply astonishing Ai, I look forward to the playing tips.

    The smartest computer opponent ever! Play against BRAINIAC (TM), an Artificial Intelligence algorithm implemented as recursive Minimax strategy with alpha-beta pruning, highly optimized for Z80 registers allocation, using heuristic evaluation and arbitrary recursion depth, multi-tasked in background from machine state controlled multicolor animated graphics... Yes, the A.I. really is as strong as it sounds!



    image

    Post edited by R-Tape on
  • Very impressive. A lot of skillful work must go into engine,graphics and music.

    The gameplay is fresh and original too.

    And another thing that I have to compliment - it doesn't suffer from this eye hurt problem that all these earlier multicolour logical games did.

    Okay, so what are the rules, when you win or lose? :)

    And is computer beatable at all at later levels?

  • edited June 2015
    Yup, I agree with Ralf, it does not create any problems with the eyes this time. 

    Great game, music and graphics - impressive. 

    Wasn't expecting the computer to cheat by pushing the blocks down though!

    Just noticed the Vega on the inlay.......
    Post edited by MatGubbins on
    I am from that generation, when Pluto was still a planet, and the Earth is round.

    Bomb Munchies on WOS thread
    Bomb Munchies Ver1930 17th Nov 2017 (look for the blue download box ) If you get a time-out message and live in the UK then try after 9pm-3am.
    Send me a PM and I can email it to you too. Kent, UK
  • edited June 2015
    Ralf said:

    Very impressive. A lot of skillful work must go into engine,graphics and music.

    The gameplay is fresh and original too.

    And another thing that I have to compliment - it doesn't suffer from this eye hurt problem that all these earlier multicolour logical games did.

    Thanks for the compliments!

    Ralf said:

    Okay, so what are the rules, when you win or lose? :)

    Only one player must align 4 pieces in horizontal, vertical or diagonal to win.

    If both players have aligned pieces at the same time, the game continues.

    If you place a new piece on a column that is already full, it will push down all other pieces, so the game only finishes when there's a winner.

    Ralf said:

    And is computer beatable at all at later levels?

    Yes, but it's very difficult. BRAINIAC "thinks" 1 move ahead in level 1, 2 moves ahead in level 2, and so on... 
    Post edited by Einar Saukas on
    Creator of ZXDB, BIFROST/NIRVANA, ZX7/RCS, etc. I don't frequent this forum anymore, please look for me elsewhere.
  • edited June 2015
    Yup, I agree with Ralf, it does not create any problems with the eyes this time. 

    Great game, music and graphics - impressive. 
    Thanks!

    Wasn't expecting the computer to cheat by pushing the blocks down though!
    You can do the same!

    Just noticed the Vega on the inlay.......


    Yes, this game will be distributed with Vega also :)

    We are giving Vega our full support (despite I don't fully agree with some of their choices) for reasons I already explained here.
    Post edited by Einar Saukas on
    Creator of ZXDB, BIFROST/NIRVANA, ZX7/RCS, etc. I don't frequent this forum anymore, please look for me elsewhere.
  • edited June 2015
    > Only one player must align 4 pieces in horizontal, vertical or diagonal to win.
    > If both players have aligned pieces at the same time, the game continues.

    Well, it's a surprise and very unorthodox. I expected it to be like chess or tic-tac-toe or most other games - if you make a winning move then the opponent loses and doesn't make his own move,

    So in all levels it isn't about having more "activated pieces" by some number, it's always about making an winning move while opponent can't do it in the same turn, right?

    Out of curiosity, how is the AI implemented? Is it Minimax algorithm or something else?
    Post edited by Ralf on
  • Ralf said:
    > Only one player must align 4 pieces in horizontal, vertical or diagonal to win.
    > If both players have aligned pieces at the same time, the game continues.

    Well, it's a surprise and very unorthodox. I expected it to be like chess or tic-tac-toe or most other games - if you make a winning move then the opponent loses and doesn't make his own move,

    So in all levels it isn't about having more "activated pieces" by some number, it's always about making an winning move while opponent can't do it in the same turn, right?
    No, that's not it. If you make a winning move, the game immediately finishes, just like chess or tic-tac-toe.

    Take a look at this game:

    image

    If player #1 chooses column 2, the new piece will push the entire column down, so a single move will create a 4 pieces alignment for player #1 at the bottom, and another 4 pieces alignment for player #2 immediately above, at the same time:

    image

    Afterwards, if player #1 keeps choosing column 2, a pair of identical pieces will eventually reach the bottom and create a 4 pieces alignment for player #1 only, thus player #1 will finally win!

    image
    Ralf said:
    Out of curiosity, how is the AI implemented? Is it Minimax algorithm or something else?
    Yes, it's a Minimax algorithm with heuristics, but improved by a technique called alpha-beta pruning. Except I modified these ideas so they would be more efficient when implementing them in Z80 Assembly.

    Also the entire game is implemented in such a way that the computer can "think" in background, at the same time it's moving things on screen, just like a human player does. That's the reason the computer can choose its moves instantly in most levels, despite the fact that multicolor and animations consume so much CPU that there's not much left for A.I.
    Creator of ZXDB, BIFROST/NIRVANA, ZX7/RCS, etc. I don't frequent this forum anymore, please look for me elsewhere.
  • great game!!!!!!!!
    Find my (mostly unfinished) games here
    https://www.facebook.com/groups/1694367894143130/
  • Thank you! :)
    Creator of ZXDB, BIFROST/NIRVANA, ZX7/RCS, etc. I don't frequent this forum anymore, please look for me elsewhere.

  • We are giving Vega our full support (despite I don't fully agree with some of their choices) for reasons I already explained here.

    I agreed with Einar on this.
    With all the well-known reservations, 'though.
    ZX81/ZX Spectrum/Amiga/Atari music: http://yerzmyey.i-demo.pl/
  • The link doesn't work - it's missing a 't'.  Here we go:

    http://www.indieretronews.com/2015/06/complica-dx-fantastic-connect-4-for-zx.html

    By the way - a Ctrl+Alt+Printscr screengrab would show the graphics properly.

  • great graphics and wicked tunes especially the one on the intro page. always been utterly pants at connect 4 though, lol
  • Ralf said:

    And is computer beatable at all at later levels?



    I've just beat level 7 in practice (I'm ashamed to say I didn't play it very much while I was doing the graphics), though still can't string 4 consecutive wins together.

    I was surprised to have finished 7 with relative ease, perhaps I just got lucky.  Is it possible though that it's too clever for it's own good?  By anticipating the many potential good moves that can be made, it fails to spot some slightly wonky moves a lesser player (i.e me) might make?

  • Neil79 said:

    Short review done


    I didn't expect so much praise for this game, thank you very much!!!

    Creator of ZXDB, BIFROST/NIRVANA, ZX7/RCS, etc. I don't frequent this forum anymore, please look for me elsewhere.
  • R-Tape said:

    I've just beat level 7 in practice

    I'm very impressed!
    R-Tape said:

    I was surprised to have finished 7 with relative ease, perhaps I just got lucky.  Is it possible though that it's too clever for it's own good?  By anticipating the many potential good moves that can be made, it fails to spot some slightly wonky moves a lesser player (i.e me) might make?


    No, that's not possible. In level 7, BRAINIAC will analyze and calculate heuristics to every possible board arrangement 7 moves ahead (technically it doesn't really need to look at so many combinations since alpha-beta pruning allows proving mathematically that certain combinations will be disfavorable with 100% certainty). Although heuristics provide only an estimated evaluation, BRAINIAC looks at 7 moves in advance before calculating heuristics, so it will know the sequence of moves you have in mind long before it happens.

    The only way to beat level 7 is planning your strategy many moves in advance, and getting very lucky that BRAINIAC won't have any possible way to prevent it. Doing so is quite an achievement, I was never able to beat level 7 myself!
    Creator of ZXDB, BIFROST/NIRVANA, ZX7/RCS, etc. I don't frequent this forum anymore, please look for me elsewhere.
  • And how does alpha-beta pruning work in this case?

    I have some experience with minimax+alpha-beta pruning used in chess engine on PC. The important thing in algorithm is a function which evaluates current position. If position after some move is worse than already stored best result then the whole branch of moves isn't investigated further.

    In chess you can have a simple evaluation function by comparing values of your and opponent pieces (and giving King some crazy high value). Then you can improve it by including control of some important fields, pawn structure and so on.

    But here? Do you also use an evaluation function Einar? And how it decides which position is good and which is bad?
  • Had a strange level 2 game where the computer decided to let me win by pushing a stack down. Wish I had played the game on EmuZwin so I could've rolled back and watched why it the computer took that choice.
    I am from that generation, when Pluto was still a planet, and the Earth is round.

    Bomb Munchies on WOS thread
    Bomb Munchies Ver1930 17th Nov 2017 (look for the blue download box ) If you get a time-out message and live in the UK then try after 9pm-3am.
    Send me a PM and I can email it to you too. Kent, UK
  • Awesome game guys! How many levels are there? Only managed to get to level 3 so far.
  • Ralf said:

    And how does alpha-beta pruning work in this case?

    I have some experience with minimax+alpha-beta pruning used in chess engine on PC. The important thing in algorithm is a function which evaluates current position. If position after some move is worse than already stored best result then the whole branch of moves isn't investigated further.


    Yes, it's exactly the same in Complica DX, except customized to work more efficiently on average cases (although sacrificing efficiency on special cases), taking into account the very limited CPU left for processing AI in this game.
    Ralf said:

    In chess you can have a simple evaluation function by comparing values of your and opponent pieces (and giving King some crazy high value). Then you can improve it by including control of some important fields, pawn structure and so on.

    But here? Do you also use an evaluation function Einar? And how it decides which position is good and which is bad?


    The evaluation function in defined in file "brainiac.asm", it's documented as follows:


    ; -----------------------------------------------------------------------------
    ; Calculate evaluated score for specified player at current recursion depth.
    ; The player score is calculated basically counting aligned pieces for this
    ; player, in all directions from every board position.
    ;
    ; Parameters:
    ; A: player (1 or 2)
    ;
    ; Returns:
    ; A: score(player) = 96+depth if specified player has 4 aligned pieces,
    ; score(player) < 96 otherwise
    ; A': player (1 or 2)
    ;
    ; Uses:
    ; ai_depth: current recursion depth
    ;
    ; Destroys:
    ; F, BC, DE, HL, F'
    ; -----------------------------------------------------------------------------


    The released source code is fully documented and it provides detailed explanations about all these details.
    Creator of ZXDB, BIFROST/NIRVANA, ZX7/RCS, etc. I don't frequent this forum anymore, please look for me elsewhere.
  • Had a strange level 2 game where the computer decided to let me win by pushing a stack down. Wish I had played the game on EmuZwin so I could've rolled back and watched why it the computer took that choice.

    It could happen if every other possible computer move would also make you win.

    If it happens again, please take a screenshot of the board, so I can take a look!
    Creator of ZXDB, BIFROST/NIRVANA, ZX7/RCS, etc. I don't frequent this forum anymore, please look for me elsewhere.
  • Daren said:

    Awesome game guys!

    Thanks!
        
    Daren said:

    How many levels are there? Only managed to get to level 3 so far.

    There are 7 levels. You can directly try any of them by choosing "Practice" in the main menu, although you won't see the game finale unless you choose "Play!" to win all of them in the right sequence.
    Creator of ZXDB, BIFROST/NIRVANA, ZX7/RCS, etc. I don't frequent this forum anymore, please look for me elsewhere.
  • edited July 2015
    Stumbling onto level 6.... those pesky catapillars and their 5 second thinking time.
    The green grubs look as if they want to throw up but keep swallowing down the vomit!
    Post edited by MatGubbins on
    I am from that generation, when Pluto was still a planet, and the Earth is round.

    Bomb Munchies on WOS thread
    Bomb Munchies Ver1930 17th Nov 2017 (look for the blue download box ) If you get a time-out message and live in the UK then try after 9pm-3am.
    Send me a PM and I can email it to you too. Kent, UK
  • edited July 2015
    This is a good game, but I think it would be much better if you added a mode where it played according to Think!'s rules (or remade the game slightly, with Think's rules, and released it as a different game, say "Complica-Tx".

    Basically, Think! is connect 4, but with three big differences;

    1. Not only can you insert a counter from the top, but you can instead insert it from one side.

    2. The counter does not drop (or move vertically, if you put it in the side), it goes into the first part of the grid where you put it in (and, like Complica-Dx does now) and if any counters are below it then they all move down one square. Of course, if you put a counter in at the side, then the counters on that row all move vertically one square.

    3. Empty squares are included in the movement of an entire row or column, so a gap is never closed.

    Actually, it would be easier for you to download and play Think!, as the rules are easier to observe and pick-up than to learn them from reading about the game.

    BTW, Think! is easier on it's hardest skill setting (7, IIRC, I've not played it in a while, but I think it's skill settings are 1 to 7) rather than it's middle skill setting (4, I think)!
    Post edited by ewgf on
  • Damn, this thing is clever!
    Joefish
    - IONIAN-GAMES.com -
  • ewgf said:

    This is a good game, but I think it would be much better if you added a mode where it played according to Think!'s rules (or remade the game slightly, with Think's rules, and released it as a different game, say "Complica-Tx".

    Basically, Think! is connect 4, but with three big differences;

    1. Not only can you insert a counter from the top, but you can instead insert it from one side.

    2. The counter does not drop (or move vertically, if you put it in the side), it goes into the first part of the grid where you put it in (and, like Complica-Dx does now) and if any counters are below it then they all move down one square. Of course, if you put a counter in at the side, then the counters on that row all move vertically one square.

    3. Empty squares are included in the movement of an entire row or column, so a gap is never closed.

    Actually, it would be easier for you to download and play Think!, as the rules are easier to observe and pick-up than to learn them from reading about the game.

    BTW, Think! is easier on it's hardest skill setting (7, IIRC, I've not played it in a while, but I think it's skill settings are 1 to 7) rather than it's middle skill setting (4, I think)!

    Err... do you mean this?
    Creator of ZXDB, BIFROST/NIRVANA, ZX7/RCS, etc. I don't frequent this forum anymore, please look for me elsewhere.
  • edited July 2015
    joefish said:

    Damn, this thing is clever!

    Thanks! It's the best compliment any A.I. could get! :)
    Post edited by Einar Saukas on
    Creator of ZXDB, BIFROST/NIRVANA, ZX7/RCS, etc. I don't frequent this forum anymore, please look for me elsewhere.
  • ewgf said:

    This is a good game, but I think it would be much better if you added a mode where it played according to Think!'s rules (or remade the game slightly, with Think's rules, and released it as a different game, say "Complica-Tx".

    Right now, BRAINIAC is extremely optimized for COMPLICA. Adapting it to play a different game is certainly possible, but it's not such an easy task.

    The truth is, I originally considered implementing BRAINIAC as a generic A.I. library capable of playing any game. It's the reason I even gave it a name. But I decided to postpone this decision for 2 main reasons:

    1. There are a few, very specific A.I. optimizations that depend on certain characteristics of a game. For instance, in COMPLICA there are only 4 possible moves, so the chances of eliminating an entire branch by alpha-beta pruning are smaller than usual. Therefore my top priority was implementing a Minimax algorithm capable of traversing the search tree as quickly as possible, and trying to eliminate branches as a secondary priority only. In comparison, in THINK! there are always 12 possible moves, so it's worth it to spend more effort on initial analysis (such as applying heuristic evaluation on initial nodes to determine traversal order) in order to eliminate as many branches as possible. Also, fewer choices in COMPLICA increase the chance of repeating the same moves, so I spent more effort to randomize A.I. choices whenever there's no better option than others. Since I wanted COMPLICA DX to have the best fastest A.I. possible, I prefered to implement these very specific optimizations instead of providing a generic solution.

    2. Programmers love to reinvent their own wheels, which means nobody else would use my A.I. library anyway. How many developers have even considered using PATHFINDER, DEFKEY, or JOY?

    There are a few board games I invented myself, so I'm planning to eventually release a standalone BRAINIAC that I can use afterwards to implement these games for the Speccy. But since board games are not extremely popular nowadays, I want to release some of my other unfinished games first.
    Creator of ZXDB, BIFROST/NIRVANA, ZX7/RCS, etc. I don't frequent this forum anymore, please look for me elsewhere.
Sign In or Register to comment.