Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1352835 Posts in 62417 Topics- by 54158 Members - Latest Member: tonym

December 17, 2018, 05:30:27 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsChess 4X [Playable HTML Build Up!]
Pages: [1]
Print
Author Topic: Chess 4X [Playable HTML Build Up!]  (Read 477 times)
Tattomoosa
Level 0
**

Making The Decision Engine


View Profile WWW
« on: June 11, 2018, 12:46:10 PM »



Chess 4X

"Chess that's not really that 4X, but it is a lot more 4X than normal chess."

HTML5 build is up!
Play it on itch.io



(Looks much smoother in real game)


Features

  • Your favorite characters from the international smash hit Chess are back!
  • You can make new pieces and choose your army composition!
  • "E'pawn'omy" - An economy based around pawns.
  • Clouds!
  • Maybe some other stuff!


How It Works

The 'economy' is that you get a new pawn every turn, so long as one of the 4 squares immediately adjacent to the king is empty (pawn is placed in first empty square clockwise from king's 'forward'). You can make new second-tier pieces (rook, bishop, knight) by arranging these pawns in the movement pattern of said piece, and you get that piece in the location that the last pawn was moved into. This is better explained with GIFs:


Rook


Knight

Bishop



I'm pretty set on keeping things deterministic, but pretty much everything else is still in flux. I have a ton simple options to set:

  • Size of board
  • Moves per turn OR 'Can move every piece'
  • Whether pieces can move more than once per turn
  • Whether pawns can move on the turn they're created
  • Whether other pieces can move on the turn they're created
  • Whether new pawns spawn if their spawn point is 'endangered' (in range of opponents piece)
  • Whether new pawns spawn if the king is in check


Which all have huge effects on the game that encourage wildly different styles of play, so finding the right mix is pretty tough. Then I'm also considering some other things, like resource tiles and what a Queen is worth - currently the only way to get a queen is to spawn one from the debug menu. Smiley

Some of these options might be in game, but I want to be careful that players can't accidentally create a game that isn't fun.


It's Not That 4X

No, it's really not. It may or may not get more 4X-y as I iron out the gameplay kinks. 4X stands for 'Explore, Expand, Exploit, Exterminate' and I really only have 'Exterminate' covered. Maybe 'Expand', if you're being generous. What I'm really saying is: "This game needs a better name."


Background

Initially, the idea was a tactics-style game where each unit had their own movement pattern and different attacks had different patterns as well. This never made it to a prototype, since just thinking about remembering those movements well enough to play it well sounds exhausting. But then it occurred to me that if I stuck with the movement patterns from Chess that everyone knew, remembering those patterns became a lot more feasible.

Separately, I became really interested in the idea of a deterministic 4X game. 4X games are so married to chance that it sounds a little odd, but I think it's possible. I was thinking that maybe if moving units had significant complexity it might work.

Those ideas smashed together like particles in a supercollider and I realized that Chess with an economy might be pretty neat.

Then I started working on The Decision Engine and realized I should actually learn C# instead of hammering it awkwardly into a Javascript-shaped box. I thought it would be good to learn it with some smaller projects so I don't wind up with massive tech debt on the game I want to be big. I feel like this was a good decision, since I've already spent nearly as much time refactoring 'Chess 4X' (to prepare for multiplayer and AI) as coding it in the first place!


What Now?

I think there's a really good game in here somewhere, but it's tough to find the right mix of elements.

My next job is making a rudimentary 'New Game' UI that will probably expose all of my options for the time being. Then I'll be able to put up a web build for people to play and hopefully weigh in on what options make for the best experience.

Then, I'll probably go ahead and work on getting online multiplayer in since that will make testing the game a lot more fun.




Thanks for reading. Here's the game on a stupid big board.



« Last Edit: June 14, 2018, 09:24:05 PM by Tattomoosa » Logged

Ordnas
Level 4
****



View Profile WWW
« Reply #1 on: June 12, 2018, 12:39:38 AM »

I am interested in any variation of chess, which recently I had the chance to try some on mobile. Your project is very interesting, congrats!  Smiley
Logged

Devlogs:

Zireael
Level 4
****


View Profile
« Reply #2 on: June 12, 2018, 01:15:15 AM »

The E'pawn'nomy alone is enough to make it really interesting.

For eXploration, maybe have the board extend in various directions and/or have special tiles that you want to take control of? (e.g. a spawning tile which would work only if you had your king next to it)? I know it'd be essentially making it closer to a 2d tiled game... but I guess it'd bring more X to your 4X.
Logged
Tattomoosa
Level 0
**

Making The Decision Engine


View Profile WWW
« Reply #3 on: June 12, 2018, 01:54:42 PM »

This is a technical post

Separating View & State

I'm a web developer so I spend a lot of time with frameworks like React or Vue. These facilitate making data-driven sites where what the user sees is adapted from a 'state' - information held about a user or what they're doing - and a back-end store of data. The pattern is valuable because it allows for a ton of re-usability even in wildly different visual contexts.

Because many games are very much driven by the view, this design pattern doesn't seem to be talked about much in game development. It's definitely used - for dialogue, inventories, etc. But I remember learning about this pattern for the first time and it opening my eyes to some new possibilities, so I thought it might be good to talk about how I'm using it in Chess4X.

Why should you separate?

So, one of the main reasons why separating view and state is valuable in games is that you can hang on to a lot more state without hanging on to a lot of complex objects. In Chess4X I only store the bare minimum to represent a state of the board:

- A 2D array of tiles
- A List of pieces

Tiles simply store a boolean value (true or false) of whether they exist, because the game fully supports 'missing' tiles.
Pieces store a few values:

- the type (pawn, king...), an Enum (basically a list of unique identifiers)
- position, an Array: [x,y]
- last turn the piece was moved, an integer
- the owner, an integer (could be a bool but in any place where it was trivial I have already added support for more players)

You'll notice I'm not storing the actual, visible model at all. Instead, I'm storing the references to the models in the class managing the representation of the board, and given it the ability to find a piece model by it's location. I then make all gameplay calculations directly to my simplified state, and tell the board to update to match. This ensures that all my models are in sync and lets me, very cheaply, hold on to the entire history of the game and represent it in any other way I want - which you can see in action here:



It also allows me to very easily make an interactive visual board preview in the new 'Game Settings' window re-using the same systems I already developed for the active game (WIP, not all functional yet):



And because this window is data-driven as well, I can add new gameplay options and they will pop up in the list for me 'all by themselves' instead of having to place each one by hand. Speaking of, can anyone recommend any of the Unity HTML/CSS UI assets? I wanted to get a handle on Unity's UI first, but writing in HTML would be so much better.

But my game's state isn't so simple!

This is probably true of most games, Chess 4X has an extremely simple state. But even if the pattern doesn't make sense for your game at large, it's worth thinking about how applying it to some of your systems could save you time and effort. Or how recording some subset of your game's state could help you debug and analyze it from different perspectives.
« Last Edit: June 14, 2018, 09:00:08 PM by Tattomoosa » Logged

Tattomoosa
Level 0
**

Making The Decision Engine


View Profile WWW
« Reply #4 on: June 14, 2018, 08:58:38 PM »

HTML5 build is up!
Play it on itch.io

Known bugs:

  • 'Check' and 'Checkmate' checking code is all gone in preparation for a more robust solution than my original weak 'good enough for real chess' one (more accurately it never got moved over to the new system)
  • No way to officially win (see above)
  • Loading a board from a previous move may let you move pieces that shouldn't be able to.
  • "Move Every Piece" option simply sets your moves to 100 instead of doing something smart. You will have to end your turn yourself if this option is enabled.
  • The camera has no limits. You can zoom through the board or scroll out to see how I made the clouds or go left forever.

You can make stupid starting positions. However, you can't start a game unless each player has a king. But the game will not warn you. Sorry about that.




So the first build I made looked like this:



Waaagh!

I've actually already fixed this but I thought I'd mention it because I feel like the Unity WebGL build should translate the C# behavior properly. If I didn't know about how Javascript works I might have had a hard time tracking this down.

Granted, all you really need to know about Javascript to catch this kind of error is this: "Javascript lets you do anything." Not in like, an 'infinite possibilities' way, though. More like a "This is a really bad idea but go ahead" kind of way.

Basically, if you're like:  Durr...?  , Javascript's like:  Beer!

The E'pawn'nomy alone is enough to make it really interesting.

For eXploration, maybe have the board extend in various directions and/or have special tiles that you want to take control of? (e.g. a spawning tile which would work only if you had your king next to it)? I know it'd be essentially making it closer to a 2d tiled game... but I guess it'd bring more X to your 4X.

Thanks! The E'pawn'omy is working well and seems pretty fun. I had considered special tiles that give you bonuses if you have pieces on them. One grants an extra pawn every turn like you described and then one that grants an extra move every turn.

Maybe one where if you manage to keep a single piece on it for several turns it pops out a queen? Unsure.

The game actually supports boards with holes in it, and I considered 'high ground' tiles as well - where pieces could attack down them but not up.

Mostly, I've played it at the traditional chess board size (8x8) because it makes for a quick confrontation which lets me check rules faster. I am actually very interested in the version of the game with more moves per turn (and starting pieces?) on a larger board, but only if it plays well.
« Last Edit: June 14, 2018, 09:40:46 PM by Tattomoosa » Logged

and
Level 6
*



View Profile WWW
« Reply #5 on: June 15, 2018, 12:46:34 AM »

I'm really interested in the systems you've got going so far, particularly the combining of pawns. Here's some of the top of my head ideas for the other Xs that might go somewhere for you (they're all semi-nabbed from a 15 minute 4x thing that I started prototyping ages ago, where the separate games carried over to the next):

eXpand was the easiest I just had any tile you touch belongs to you. If it's connected to the group that your hero unit (I guess your king for your game?), then it's classed as home territory. You can only create new units when in your territory. So, it adds more decision space (do I try to arrange to combine or do I focus on breaking their units' link to their territory and prevent them from upgrading?)

eXplore/eXploit is hard for you I guess. I had a very vague fog of war and resources that you collected depending on what the ground type was where your units ended their turn. That area turned grey when you'd collected X amount of resources from it and was considered barren from then. The idea was to use these resources to upgrade between games, but I don't think this would work for you.

Anyway, I hope that gets some ideas going for you!
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic