top of page

For now I'm going with making a larger-scale game. I ported over some old code for downloading content from spreadsheets, and I'll be using that for card texts and numbers. I'm not going to have the spreadsheets do the card instructions though, since I plan on the cards having a variety of triggers and abilities that would be completely infeasible as spreadsheets. And like before, the spreadsheets will handle translations too.


Most of this week was spent figuring out how to do the log. The log has multiple issues I had to address. The first is that the current way I do log messages is messy. I create a new object for every single message and there's no way that's any good. The reason was because each log message needed to draw a yellow line underneath it in case you can click it for an undo (and undo multiple steps at once), and I didn't see any other way to do that other than having each log message technically be a button. For now I decided to give up on that, and just have it be that the undo button undos your most recent decision and that's it.


Then I had to figure out how else I could do the log. I created a 2nd Unity project just to experiment, and I eventually got something I liked. There are just 4 text objects, except that only 2 are on at once. There's one for: all messages from the past; all messages for the current turn; the most important messages from the past; and the most important messages for the current turn. When a log message is added, the text gets added to all messages from this turn (and if it's tagged as important, it also gets added to most important messages for this turn). Also when you do an undo, it just deletes the most recent line from the text object.


Adding messages to the log is also tricky though. The log has to be recreated for when you reconnect; some log messages have to be different for other players due to publicity (for you it says "draws [card name]" but for other players that card has to be hidden) and translation (in case they're playing with a different language than you). My eventual solution is to send over the text to translate and any variables, and the game goes from there. There is also a check for if it needs to be translated differently for other players. Explaining the full solution here is a bit complicated, but the spreadsheet helps here by having different elements for if information needs to be displayed differently for other players.


Finally when making cards, I realized I needed a way to differentiate the cards that get played into the different areas. I didn't want all cards to be able to do anything, it just seemed like "what area card does this card get played into" is arbitrarily chosen. My solution was to have an ability pie, like in Randomly Generated RPG. The 4 areas are themed: cards that get played to the Coast can make money and move cards; the Village makes money and makes boxes; the City makes money and removes boxes; and the Woods can do everything but make money. I enjoy it when games split up what things can do what, and this division seems solid to me.

Progress for this week went well. I got in a bunch of the things I wanted to work on for the new online system, and I think the code is better than ever. You can now draw cards, undo stuff, and confirm when everyone has finished and the game can move onto the next action in the game rules. One optimization is I split up the code more into different scripts, and now the scripts are at more reasonable lengths (it used to be, 2 scripts would go over 1000 lines, now the lengthiest ones are about 500 lines).


I think the only major weakness is that if you disconnect in the middle of your turn and reconnect, you have to click through all your previous decisions again. I think I know a fix for this (it's to keep a track of your decisions with a number, and if you reconnect the game replays the turn for you by applying your past decisions), but I'm putting it off for now as it's not too mandatory.


One new feature is I added a little chat area. It's kind of like a 2nd log, except that the only things that get posted are: notifications for when players join/disconnect/reconnect, and anything that players type into chat. I don't know why I never did this before as it's really easy. I guess I just assumed anyone playing my online games would be in a voice call with anyone they're playing. But putting notifications for if something goes wrong has been useful for me when testing the new system, and it should still be useful to have it in the game.


I still haven't figured out what a simple game could be. Which means maybe I just immediately dive in and make a larger game that uses all of this new code. My choices are either the Pacific-like game, or the 2-player fighting game. Again the first one seems like an easier project.

Some things I've been trying out for the new online game, that I still haven't figured out the actual gameplay of. One way to get the game to remember what things you had when you reconnect is to save it to the room. Rooms and players have custom properties that can be stored for a certain period of time. That means everything data that a player or a card has can be put there.


This works fine for something that's just a number, like how much money a player has. This gets harder for something like what exact cards a player has, because room properties can't store game objects. My first solution was to keep everything in arrays of integers, where the integers are the card's photon ID. The problem is that arrays are annoying to use, especially if has to constantly change (which will happen in a card game). My current workaround is to get the array, convert it into a list, modify the list, turn that list back into an array, and save that.


Then there's the question of sending information to other players. When you apply a room property, it automatically applies to all other players. Which in some situations I do not want, like in game with simultaneous turns (what they do on their turn should be hidden until everyone is done). Currently my solution is, the game keeps track of what properties you have changed during your turn, and only officially saves them to the room properties when your turn is done.


Most of this so far has just been brainstorming, most of it hasn't been implemented yet and combined with all my other systems (like undos). I think most of the hardest part of the brainstorming is done though.


I can also talk about how over the past 2 days I had to deal with a very odd bug. When creating an object, it would sometimes just disappear immediately for no reason. And it would only happen in the offline mode, if it's online the objects are created without issue. Eventually I found a workaround, which is to delay the creation of the object by a fraction of a second. I don't know why this solved it, considering I had never encountered this issue before in any project, but I guess this is what I have to do.

Thomas Tang (DZ)

tt2195@nyu.edu

+1 (646) 236-5503

Redmond, WA

©2025 by Thomas Tang

bottom of page