BoardGASM.cs

Working back on the C Sharp version of the “BoardGASM” thing.  I am now at the point where I have player and pawn generation.  Today I created the Die class and a list of Die named Dice.  No rolling functionality yet.

The dice in Graffiti Royale are based on a concept I had of increasing danger.  Ascending a 5 color spectrum (Red, Orange, Yellow, Green, Blue), each die in the series would have a single pip increase.
This means, Red has 1 face with a pip, and 5 with no pips. Orange has 2 faces with a pip and 4 with no pips.  Yellow, 3 with and 3 without, etc…
I’m attaching an image to this post to show what I mean.

To use one has some sort of increasing value that is indicated by a color.  This color corresponds to the dice taken.  You grab each dice from ROYGB in order until you have the dice pool to roll based upon the level of the color you’re dealing with.

In the case of Graffiti Royale, that means a “danger level” that both increases danger (A red would be a low level visibility area (alley, say) and blue is high level (billboard)).
So I had to create pool of five six-sided die.
I had hoped to be able to create something like an array of arrays structurally to define/instantiate them:

{{1, 0, 0 ,0 ,0 ,0}

{1, 1, 1, 1, 1, 0}}

And I’m sure there’s a way to do that, but I just ended up making an array of 6 bools (1 for each die face), and then a list of 6 (one for each dice), with a constructor that takes the dice color and a list of 6 bools for the values.  Actually I could just ignore the 6th, now that I think about it, since unless I added a purple die at some point, I’m not really using it.  There’s always a chance of failure (or in our case success, since we DO NOT want to have a “hit” (e.g. be seen by someone)).

So, I did that today.

I’m also working on a personal project to share with 4 friends for a 4 player multiplayer asteroids type game.

In the process of that (I got to basic thrust acceleration and screenwrapping — the screenwrap code I just ganked from Black Module’s Youtube Tutorial…

And the thrust code, was just part of the sample code on Unity’s site for motion and joystick input modified for my needs).

Why reinvent the wheel, ferrealz.

While doing that, I decided to fuck around a bit on making a Graffiti Royale project in Unity and laid out a basic board (not the same board I have laid out physically with my original prototype), but one that’s a bit more balanced in distribution of difficulty levels.

I have that all laid out, and I am in the process of making players pawns.

I think I’ll try to merge my unity game with my BoardGASM code.  This is going to be some major refactoring, but hopefully if I’ve separated concerns well enough (since my logic is all just in C# 7.x (or earlier, I’m not sure what the most newest feature I’m using is, really). I should (hopefully) be able to use that as the sort of server and logic end of things, and the base mechanic/UI/interaction with the game code, can be done in Unity and I’ll (hopefully) be able to make a nice little system for passing state message between server and client (haha, and here, I should probably read more but I’ll work on that when I actually deal with the server/client side of things – right now I’m building the scaffolding from each end, and once they’re ready, I’ll work on the interconnect between them.

BoardGASM.py

So I started to work on a python version of the little code I had in C#.  I ended up making a simple player class.  I learned the “extend” method of the List class.

I was testing my list of players by doing Playerlist.append(p1)

But I tried to append a list Playerlist.append(p2, p3)

No dice.  Looking up info I found that since append appends as a single object I’m not appending the 2 player objects, only appending a list as a single unitary object I imagine if one were to view diagrammatically visually it may look something like [p1, [p2, p3]] 2 object list, player object and list object as opposed to [p1, p2, p3]  3 object list, 3 individual player objects.

So learned about the “extend” method to append an actual list to a list (I’m sure it’s deeper than that, but that’s the basic use I had for it).

The fact that Python is so vastly different to C# and I’d have to learn a lot of the particularities may mean that I may not want to do it.

On the other hand, I coded a lot of what I wanted in a shorter time and in less code than it took for C#.

Then again, I had already done the hard work w/C# to figure out the basic situation.

Perhaps, the next test would be the inverse – write in Python (this time the code for dealing with Pawns and ownership of pawns and their location in the playspace), and write the C# code after the Python.  I could see if writing in Python helped the C# go quicker.

Most of the issue is that my intuition of some things in Python don’t quite fit the actual model it provides.  And that’s fine, that’s just how Python is (or any language) and you’ll always be having to rethink such things, whether it’s a programming language or a specific library.  You’re never going to know all models 100% exactly.  That’s why they’re models.  And those models/frameworks you’re working with, may have underlying patterns that act as a common language of understanding or it may be that those models are, themselves, common languages between classes of thinking/operating.

Project BoardGASM (Graffiti Royale Board GAme State Manager)

The Graffiti Royale GAme State Manager idea is now Project BoardGASM.
So far I created a C# basis with a general object manager, and simple construction of Players (with names, id/player#, color attributes set).

When logging in, I test the character to make sure they’re less than the total number of allowed characters in game and if not, sorry, lobby’s full.

I had fun making 3 different ways to create a list of players… I Have a 4th way to try (which will be just as non-useful as the 2nd method below)

1st Used a method that created each player as a new object then added them individually. :

p1(“name”, “color”) …; AddPlayer(p1);

2nd Using varargs, I passed them in at once using an array.  For a simple setup purpose this isn’t bad, but if I were to use a server system for an online method I’d be logging in one at a time, not an array, so this was a mild waste, but I did learn how to do it which was what my goal was.

AddPlayers(p1, p2, p3, p4);

3rd Used the actual method I’ll probably end up using by directly passing in the data (after sanitizing, natch) offered for Player name and color choice, as entered in a field/selected from a menu.  The “player number” at this point is just determined by ordinality of login.  That could change, but for now good enough.

AddPlayer(“name”, “color”).

The 4th method would be a blend of 2 and 3 (and hence, why I said non-useful).  Basically instead of AddPlayers(p1, p2, p3, p4), it’d be something like AddPlayers(“Name1”, “Color1”, “Name2”, “Color2”, “Name3”, “Color3”, “Name4”, “Color4”)

I decided it would be fun to do this little bit in multiple languages and decided Python would be the next one.  So I got the first method up already.  It was less headbashy in some ways (once I got the actual python tools installed in vscode – I could do it in WSL/nano/vim(blech), but VSCode did it quite well).  I did see an interesting terminal editor that has UI and themes that’s more like Sublime/VSCode, but for the commandline, so I hope to try that if it’s workable in WSL).

But while Python was less headbashy it’d been a while since I did anything in it more complex than a simple script.  So I had to relearn how classes were made, and moreso, remembering how to deal with implicit typing (since most of my coding’s been with explicit type declarations)  Well, it was slightly brainjiggering.  And I haven’t done much using “var” in C#.

It did occur to me, however, that my earliest programming experiences were based on implicitly typed languages.  BASIC and Logo (At least IIRC, the Logo we used (Color Logo) didn’t have any explicit type system)).

I guess I’ll work on finishing the python bit and creating maybe a simple JSON file to parse for feeding in as player data so I can use that with all the different implementations I use (instead of hardcoding the test values/fake players in the main code).  Good practice to get into, me thinks.

Oh – I also spent a lot of time trying to get get github going in VS.  First time using Github, had used Bitbucket, GoogleCode and one other thing before that.  And always with hg, not git.
I saw VS have git integration and was like NICE!  But getting the first thing setup because it wouldn’t let me merge due to some “future”state crap.  Even though the solution was to pull, apparently.  It wouldn’t let me.  I ended up just downloading the git Windows client and that worked like a charm.

If anyone’s curious.  Here’s the github for it…