I actually made Risk twice. The first time I made it using C# with Winforms, the second time to learn Typescript. The Typescript version had better AI, but I had multiple maps in the C# version.
Originally I cloned Risk because I love the game, and I wasn’t quite sure how you’d go about building it. Specifically, I wasn’t sure how you’d handle map creation, and I wanted to figure it out.
I opted to make maps .png files with an associated .ini file. The only requirement for the map images is that each territory must have a unique rbg color value. In order to define territories, you just provide an xy pixel coordinate for that territory in the .ini file. In practice this means that the .ini file has one line per territory, which looks something like TerritoryName = 4, 5. The game collects the colors present at each of the coordinates you specified, and uses that information to scan the .png for territory colors to figure out what territory is where.
Copyright © - Daniel J. Petersen