nibuen / SpaceAlertMissionGenerator

Mission Generator For Space Alert Board Game On Android
https://blog.iterary.com/
MIT License
15 stars 9 forks source link

Number of data transfers in Double Action Missions #54

Open slinkymanbyday opened 1 year ago

slinkymanbyday commented 1 year ago

With double action missions, the standard constructed missions have between 1 and 3 data transfers per phase (appears to be irrespective of which phase). And a minimum of 4 data transfers in a mission (although this only happens once in the constructed missions, normally min of 5)

Current implementation appears to follow below:

private val minDataTransfer = intArrayOf(0, 1, 1)
private val maxDataTransfer = intArrayOf(1, 2, 1)
private const val minDataTransferTotal = 3

Can this be changed for double actions, maybe use same checkbox for double threats? or have the ability to set this via settings like you do for incoming data?

I haven't done much Android coding, but happy to give it a crack at some point.

slinkymanbyday commented 1 year ago

In addition to this, the Threats generator probably needs some updating for double action/double threat missions too.

I've got these settings in my build and will hopefuly be play testing them soon.

private const val minInternalThreats = 2
private const val maxInternalThreats = 5
private const val maxInternalThreatsNumber = 3 // number of internal threats max

/**
 * minimum and maximum time in which normal threats can occur
 */
private const val minTNormalExternalThreat = 1
private const val maxTNormalExternalThreat = 8

/**
 * minimum and maximum time in which serious threats can occur
 */
private const val minTSeriousExternalThreat = 2
private const val maxTSeriousExternalThreat = 8

/**
 * minimum and maximum time in which normal threats can occur
 */
private const val minTNormalInternalThreat = 2
private const val maxTNormalInternalThreat = 8

/**
 * minimum and maximum time in which serious threats can occur
 */
private const val minTSeriousInternalThreat = 3
private const val maxTSeriousInternalThreat = 7
slinkymanbyday commented 1 year ago

I have been working on this, ended up refactoring a lot of code to make double threats work a bit nicer. Still working on data transfer code, I'll pop up a PR when I'm done

raised a PR #55

nibuen commented 1 year ago

thanks for your support!

mkalus commented 1 year ago

Would this affect the Java code, too? If yes, I can have a look into the "core" library which is still based on Java.

nibuen commented 1 year ago

Would this affect the Java code, too? If yes, I can have a look into the "core" library which is still based on Java.

Yes he is touching the "core" files, maybe someday we can make a common lib but got too much going on personally right now

slinkymanbyday commented 1 year ago

Would this affect the Java code, too? If yes, I can have a look into the "core" library which is still based on Java.

Yeah. My PR does two main things.

  1. Data transfers are generated within a range, 1 is placed first phase, and the rest randomly among all three phases.
  2. Threat generation is changed a bit. a. The way I've done it is to generate internal threats first, then generate external threats. This allows the turns that internal threats appear on to occur first (as they have a narrower range they can be placed) and then external threats are placed. This means that the condition of running out of places you can put threats is reduced. b. I've also added in some extra steps to reduce the likelihood of two internal threats coming in one turn after the other. c. I've added checks in to make sure two serious threats don't come out on the same turn when double threats are enabled. d. if threat points are greater than 10, then unconfirmed value has 2 points. I've also added checks to make sure that there aren't two unconfirmed threats in the same phase. as it's possible to have 2 unconfirmed threats. e. Unconfirmed threats are chosen at random at the end of threat generation and placement. (makes it easier to ensure unconfirmed threats are only placed in one phase f. i've also added some code to make sure that the maximum amount of serious threats don't make up more than half-ish the total threats, rounded such that you can have 4/7 serious threats, but not 5/7.
nibuen commented 1 year ago

@slinkymanbyday I am not sure if you saw my tests from this https://github.com/nibuen/SpaceAlertMissionGenerator/issues/50 just FYI and that is why I have not since been able to release the build yet as there have been some generation problems around double threats as well.

Hard for me to tell if that is what you are addressing or not honestly, but I would recommend looking at my fuzzy tests and look at expanding them for coverage and we can go from there.