Author Topic: Rogmind - 7drl2016 - finished  (Read 13921 times)

Hi

  • 7DRL Reviewer
  • Rogueliker
  • *
  • Posts: 154
  • Karma: +0/-0
    • View Profile
    • Email
Rogmind - 7drl2016 - finished
« on: March 05, 2016, 07:52:25 PM »
You program a golem and it plays the game for you.

May be too ambitious.

Declaration of pre-existing material:
built off the bones of my previous 7drl Hexxus-Quest
« Last Edit: March 13, 2016, 10:11:39 PM by Hi »

Hi

  • 7DRL Reviewer
  • Rogueliker
  • *
  • Posts: 154
  • Karma: +0/-0
    • View Profile
    • Email
Re: anima
« Reply #1 on: March 07, 2016, 12:25:26 AM »
the scripting language to control the golem with is half implemented

this is a visualization of the output of "distance walkable"
which for each walkable location outputs the distance from you.

Hi

  • 7DRL Reviewer
  • Rogueliker
  • *
  • Posts: 154
  • Karma: +0/-0
    • View Profile
    • Email
Re: anima
« Reply #2 on: March 08, 2016, 03:28:37 AM »
The command language for defining actions is structured like this

increase <action> by <expression> <quantifiers>
the quantifiers restrict the expression so it only operates on the specified inputs

for example to make the golem follow walls you could enter this program.
At each step the golem performs the action with the most weight

Code: [Select]
increase forward by 10
increase right by 5
increase left by 15 wall behindLeft

left is only given a weight of 15 when the tile behind and to the left of the golem is a wall. Otherwise it is left unchanged

Hi

  • 7DRL Reviewer
  • Rogueliker
  • *
  • Posts: 154
  • Karma: +0/-0
    • View Profile
    • Email
Re: Rogmind
« Reply #3 on: March 13, 2016, 08:56:49 PM »

Xecutor

  • 7DRL Reviewer
  • Rogueliker
  • *
  • Posts: 263
  • Karma: +0/-0
    • View Profile
Re: Rogmind - 7drl2016 - finished
« Reply #4 on: March 27, 2016, 01:38:45 PM »
If you want someone to even try your game, you better post more information about this language.
All directions, all conditions, more information about how this even works.
I tried it and have no clue what's going on.
I tried to edit my program, but all of sudden it changed to this:
Code: [Select]
notWalkable is not walkable
to wallFollow
increase moveRight by 5
increase moveLeft by 5
increase moveForward by 10
increase moveRight by 10 ( notWalkable back ) or ( notWalkable forward ) right
increase moveLeft by 10 ( notWalkable back ) or ( notWalkable forward ) left
increase moveForward by 5 ( notWalkable left ) or ( notWalkable right ) forward

I changed the program to this:
Code: [Select]
to walk
increase moveforward by 10
but golem still wanders around randomly, while supposed to move straight forward.

Hi

  • 7DRL Reviewer
  • Rogueliker
  • *
  • Posts: 154
  • Karma: +0/-0
    • View Profile
    • Email
Re: Rogmind - 7drl2016 - finished
« Reply #5 on: October 30, 2018, 12:10:06 AM »
Ok, here's the documentation

Each turn your golem votes on what action to perform and once impossible actions (like walking through a wall) are removed, the remaining action with the highest votes is chosen and executed (if multiple actions have the same amount of vote a random one is chosen).
Currently the only available action is moving in the eight cardinal directions:
movenorth
movenortheast
moveeast
movesoutheast
movesouth
movesouthwest
movewest
movenorthwest

And moving in the eight relative directions:
moveforward
moveforwardright
moveright
movebackright
moveback
movebackleft
moveleft
moveforwardleft

A vote on an action looks like this
increase <action> by <amount> <predicate>
or
decrease <action> by <amount> <predicate>

when the <predicate> is true the vote on <action> is increased or decreased by <amount>

For example to make the golem follow walls, you can give it this program

increase moveForward by 10
increase moveRight by 5
increase moveRight by 10 ( not walkable back ) or ( not walkable forward ) right
increase moveForward by 5 ( not walkable left ) or ( not walkable right ) forward

In an open space it moves forwards because forward has the highest vote.
When this is impossible it turns and moves right because right has the second highest vote.
The predicate ( not walkable left ) or ( not walkable right ) forward checks to see if the tile to the forward left is blocked or the tile to the forward right is blocked.
If moving right would leave it touching a wall (because either the forward right or backwards right tile is not walkable) then the vote on going right is increased to 15.
If moving forward would leave it touching a wall the the vote on going forward is increased to 15.
This means that it goes whichever way leaves it touching a wall.
And finally if all these directions are blocked the the golem goes in a random unblocked direction.

We don't have to stick with primitive actions, new actions that can be voted on are defined by
to <action name>
[<vote>]
so from then on you can increase of decrease <action name>
This multiplies all the votes in <action name>'s body by e to the amount of vote <action name> got.
This means you can choose to view the program as a kind of hand crafted neural network.

You can also use macros to reduce typing a little bit <macro name> is <macro body> replaces the macro name with its body within the rest of the program.


List of functions
Numeric

age : how long since you saw that location
distanceTo
- : negative
sign: sign of number
max
min
+ : add
- : subtraction
* : multiply
/ : divide
health
maxHealth
damage
speed

Boolean

immediately visible: only those tiles that are visible this turn
walkable: can you walk there
flyable
destructable: can the terrain be destroyed
opaque: can you not see through it
swimmable
named <name>: is there a creature plant item or terrain named <name> at that location
not
or
and
> : greaterThan
>= : greaterThanEqual
< : lessThan
<= : lessThanEqual
= : equal
!= : notEqual
hostile
friendly
neutral
walker
swimmer
flier

Directions

north
east
south
west
forward
right
back
left