Farfi55 / RiskASP

Risk board game in Unity with Bot AI using Answer set programming
MIT License
9 stars 3 forks source link

2210 AD version #9

Open ggofthejungle opened 5 months ago

ggofthejungle commented 5 months ago

Is anyone interested in helping me create the 2210 ad version of this game? https://en.m.wikipedia.org/wiki/Risk_2210_A.D.

There used to be a Java version, you can find its source here, but Java security updates killed it https://github.com/avioane/InvadeEarth

I identified a couple of things that need to be done in this trello board https://trello.com/invite/b/BaUFhOdd/ATTI4fbb61320e280b269e01fe7068e9a64fC9989A48/invade-earth

If any of the developers on this project could help(even by giving guidance,like answering questions) it would be amazing. Thank you

Farfi55 commented 5 months ago

Hi @ggofthejungle, I can for sure help you out with any question you have about the project. We can discuss it via issues if you want, or even jumping on a discord call is fine by me.

I've never head of this version of Risk, so I'll have to read about the rules of the game to better understand it.

Checking out your Trello board, I've got a rough idea of the things needed to be done in this early stage, and they seem reasonable, so I'll be happy to explain the codebase and maybe also contribute to your project.

ggofthejungle commented 5 months ago

Awesome. What do you think of first using playfab for this to be played online since current game is hotseat. I started working on a login page that would need to then link to a lobby scene where people can join

Full rules of the game are here https://cdn.1j1ju.com/medias/9d/11/22-risk-2210-ad-rulebook.pdf

Farfi55 commented 5 months ago

Sadly I have no experience with multiplayer games, so I don't know wich muktiplayer framework to suggest. I'd personally focus on the core mechanics of the game first and then extend them to support multiplayer, of course you can approach it how you prefer.

Let me know if you want any clarification on the existing code or how to extend it for your needs

ggofthejungle commented 5 months ago

What do I need to do to add the new territories? I have the .svg file for the 2210 version. Other than declaring them, how do I make sure of the connections between them are correct?

Farfi55 commented 5 months ago

For territories take a look at the territory script, it has a list of the adjacent territories, the continent it is in and other usefull information like the player who currently owns it and the troops on it.

To create new territories I suggest using the prefab in 'Assets/Prefab/Territory' which has the structure already set up, drag it in the scene and give it a name, assign the right graphic sprite (not sure how it works with .svg), and generally fill out all the fields like continent ecc... To fix the Collider not updating with the sprite change you can right-click on the Polygon COllider 2d component and click Reset.

As for the connections, it's a bit tedious, you have to drag the territories into the list of neighbours inside the territory script

riskasp_neighbours

You also need to add neighbours twice, let's say there is a connection between iceland and greenland, you would have to add a connection going from iceland -> greenland and greenland -> iceland.

There used to be a helper function that (if you followed a naming convention) would set up the territory automatically. It's commented out right now, but it shouldn't take long to set up again, and would probably save you a lot of time setting up things.

To make sure the connection are correct there is another helper method which at the start of the game checks for errors like a territory not having connections or having a connection that is a one-way. Other than that, there are visual line indicators when you select a territory which shows you what is connected to that territory.

Hope this helps.

ggofthejungle commented 1 week ago

Hi @Farfi55 how do I access ExtraInfo[1] from the GameManager? I see that the GameInfo canvas object has the UIGameInfo script attached, but not the GameManager.cs script. I would like to display instructions and invalid actions to the user in the Extra Info, but I see it's only used in UIGameInfo.cs and I can't get it to work from GameManager.cs. Do I need to attach the GameManager.cs script to GameInfo canvas object so I can access those, or is there another way? Or should I create my own label? I tried: GameObject ExtraInfo1 = GameObject.Find("ExtraInfo1");

Farfi55 commented 1 week ago

GameObject ExtraInfo1 = GameObject.Find("ExtraInfo1"); doesn't work because at the start of the game, ExtraInfo1/2/3 are not active GameObjects, and GameObject.Find(x) only returns active objects

public class UIGameInfo : MonoBehaviour
{
    ...

    // add this line
    public TMP_Text[] ExtraInfoTexts => _extraInfoTexts;
    private TMP_Text[] _extraInfoTexts;
    ...
}

this would let you access the UIGameInfo.ExtraInfoTexts from the game manager, as long as you have a reference to the UIGameInfo component of course, which you can do in many ways, easiest is through the inspector.

That said, I would encourage you to change the UIGameInfo script as right now is not the best implementation.

Let me know if this fixes your issue or not