Author Topic: LambdaHack  (Read 43730 times)

tuturto

  • Rogueliker
  • ***
  • Posts: 259
  • Karma: +0/-0
    • View Profile
    • pyherc
Re: LambdaHack
« Reply #45 on: December 15, 2014, 08:02:42 AM »
:D luckily not. That's just output of the data the program is validating and finding problems.

The actual code is more like:

Code: [Select]
-- | Basic players definitions.
module Content.ModeKindPlayer
  ( playerHero, playerMerchant, playerChaos, playerTechCult, playerHorror, playerSpawn
  ) where

import qualified Data.EnumMap.Strict as EM

import Game.LambdaHack.Common.Ability
import Game.LambdaHack.Common.Dice
import Game.LambdaHack.Common.Misc
import Game.LambdaHack.Content.ModeKind

playerHero, playerMerchant, playerChaos, playerHorror, playerTechCult, playerSpawn :: Player Dice

playerHero = Player
  { fname = "Space Privateers"
  , fgroup = "hero"
  , fskillsOther = allSkills
  , fcanEscape = True
  , fneverEmpty = True
  , fhasNumbers = True
  , fhasGender = True
  , ftactic = TFollow
  , fentryLevel = -1
  , finitialActors = 3
  , fleaderMode = LeaderUI $ AutoLeader False False
  , fhasUI = True
  }

playerMerchant = Player
  { fname = "Merchant Mariners"
  , fgroup = "merchant"
  , fskillsOther = meleeAdjacent
  , fcanEscape = False
  , fneverEmpty = False
  , fhasNumbers = False
  , fhasGender = True
  , ftactic = TPatrol
  , fentryLevel = -1
  , finitialActors = 3
  , fleaderMode = LeaderAI $ AutoLeader True False
  , fhasUI = False
  }

playerChaos = Player
  { fname = "Forces of Chaos"
  , fgroup = "chaos"
  , fskillsOther = _meleeAndRanged
  , fcanEscape = False
  , fneverEmpty = False
  , fhasNumbers = False
  , fhasGender = True
  , ftactic = TExplore
  , fentryLevel = -1
  , finitialActors = 3
  , fleaderMode = LeaderAI $ AutoLeader True False
  , fhasUI = False
  }

playerSpawn = Player
  { fname = "Spawns of Warp"
  , fgroup = "spawn"
  , fskillsOther = animalSkills
  , fcanEscape = False
  , fneverEmpty = False
  , fhasNumbers = False
  , fhasGender = False
  , ftactic = TRoam
  , fentryLevel = -2
  , finitialActors = 3
  , fleaderMode = LeaderAI $ AutoLeader True False
  , fhasUI = False
  }

playerTechCult = Player
  { fname = "Tech Cult"
  , fgroup = "tech"
  , fskillsOther = techSkills
  , fcanEscape = False
  , fneverEmpty = True
  , fhasNumbers = False
  , fhasGender = False
  , ftactic = TFollow
  , fentryLevel = -2
  , finitialActors = 4
  , fleaderMode = LeaderAI $ AutoLeader True False
  , fhasUI = False
  } -- TODO: change fleaderMode = LeaderAI $ AutoLeader False True

-- | A special player, for summoned actors that don't belong to any
-- of the main players of a given game. E.g., animals summoned during
-- a duel game between two hero players land in the horror faction.
-- In every game, either all factions for which summoning items exist
-- should be present or a horror player should be added to host them.
-- Actors that can be summoned should have "horror" in their @ifreq@ set.
playerHorror = Player
  { fname = "Horrors of Warp"
  , fgroup = "horror"
  , fskillsOther = unitSkills
  , fcanEscape = False
  , fneverEmpty = False
  , fhasNumbers = False
  , fhasGender = False
  , ftactic = TPatrol
  , fentryLevel = -3
  , finitialActors = 0
  , fleaderMode = LeaderNull
  , fhasUI = False
  }

minusHundred, meleeAdjacent, _meleeAndRanged, animalSkills, techSkills, allSkills :: Skills

-- To make sure weak items can't override move-only-leader, etc.
minusHundred = EM.fromList $ zip [minBound..maxBound] [-100, -100..]

meleeAdjacent = addSkills minusHundred
                $ EM.fromList $ zip [AbWait, AbMelee] [101, 101..]

-- Melee and reaction fire.
_meleeAndRanged = addSkills minusHundred
                  $ EM.fromList $ zip [AbWait, AbMelee, AbProject] [101, 101..]

animalSkills = addSkills minusHundred
               $ EM.fromList $ zip [AbMove, AbMelee, AbAlter, AbWait, AbTrigger] [101, 101..]

techSkills = addSkills minusHundred
             $ EM.fromList $ zip [AbMove, AbMelee, AbProject, AbAlter, AbWait] [101, 101..]

allSkills = addSkills minusHundred
            $ EM.fromList $ zip [AbMove, AbMelee, AbProject, AbAlter, AbWait, AbTrigger] [101, 101..]

I'm probably having some really simple problem that I'm too blind to spot.
Everyone you will ever meet knows something you don't.
 - Bill Nye

Man of Letters

  • Rogueliker
  • ***
  • Posts: 68
  • Karma: +0/-0
    • View Profile
    • Email
Re: LambdaHack
« Reply #46 on: December 15, 2014, 12:40:35 PM »
tuturto, congratulations, you discovered the first bug in the new release of the engine. ;)

Took me quite some minutes to diagnose, because the code in question is obfuscated by my efforts to remain backward-compatible. Also, you didn't get the line number of the failure, because optimized libraries don't provide that (use 'cabal install LambdaHack -f-release' to get libs for development).

I'm afraid you have to put

Code: [Select]
   , mfreq    = [("campaign", 1), ("starting", 1)]
in GameDefinition/Content/ModeKind.hs. The good part is I'm now able to remove the backward-compatibility cruft, by assuming there's always a "starting" game mode defined in the content. :)

If you instead insert

Code: [Select]
screensaver = campaign
  { mname   = "campaign screensaver"
  , mfreq   = [ ("starting", 1)]
  , mroster = rosterCampaign
      { rosterList = (head (rosterList rosterCampaign))
                       {fleaderMode = LeaderAI $ AutoLeader False False }
                     : tail (rosterList rosterCampaign)
      }
  }

and add "screensaver" to the 2 lists where currently only "campaign" stands, the executable will by default run in screensaver mode (AI vs AI, you need to remove your save files to see it initially). See if you like it better.

Edit: actually, that you needed 'cabal install LambdaHack -f-release' was a bug. I've just fixed it. But in this case what would really help was a stack trace. For that you need `make install-debug` and then `make xcplay`.
« Last Edit: December 15, 2014, 06:47:03 PM by Mikon »

tuturto

  • Rogueliker
  • ***
  • Posts: 259
  • Karma: +0/-0
    • View Profile
    • pyherc
Re: LambdaHack
« Reply #47 on: December 15, 2014, 07:34:06 PM »
Thanks, now it works. I played just briefly, so I didn't test everything, but everything so far works. Now I can start tinkering with the new features and see what kinds of things I can do with them. I'm going to add that screen saver mode back in too, should be helpful for testing. And it's fun to watch the game to play itself sometimes :)
Everyone you will ever meet knows something you don't.
 - Bill Nye