ah, now this is what the game is really all about. the vast majority of your time with Carnage Heart will be spent writing/testing/tweaking your programs.

note: there is an 'auto' button that will have the game write the programs for you but a) why are you playing this game if not to program your mechs? b) the programs the game gives you are quite weak. you'll probably get through Europa with them. Ganymede can be done if you're a good strategist, but you can forget about Callisto.

High Level Theory

programming is icon based. each icon represents one command(such as 'move forward', 'check ammo level', 'fire weapon' etc). the game calls these 'chips'. depending on which cpu you equip your mech with, you will have a different limit to the number of chips you can use. the first cpu's you start with allow an 8 x 8 square grid for chip placement, limiting you to smaller less complicated programs. as you progress through the R&D tree(see Carnage Heart OKE and Equipment Specifications) you will eventually have up to a 14 x 14 grid cpu available.

the logic flow through the program is determined by the arrows on the chip borders. all chips should have a green arrow that states what chip will be executed directly after it. if the chip is a conditional test, there will be a red arrow in addition to the green arrow. the red arrow is followed if the condition is true, the green followed if false. all programs begin in the upper left corner.

all chips have customisable settings. this includes things like what direction the flow arrows go, what distance to scan for missles in, what radius to scan and the like.

care must be taken to allow action time to execute within your program. if an action from a previous chip has not finished when a new action is called from a chip, the new action will be ignored depending on chip priority (low to high priority: movement - attack - jump - stop).

Chip Functions (40 total)

Movement Chips (13 types)
Direct Movement (6 types): move forward, back, turn right, turn left, strafe right, strafe left (strafe cannot be used by tank OKE's)
Indirect Movement (5 types): jump forward, back, left, right and jump straight up (indirect movement can only be used by 2 and 4 legged OKE's)
Change Altitude (2 types): ascend and descend (can only be used by flying OKE's. can be used at the same time as Direct Movement chips)

Search Chips (6 types)
Search for enemies
Search for allies
Search for obsticales
Search for projectiles
Search for missles
Search for explosives

Attack Chips (3 types)
Fire primary weapon
Fire secondary weapon
Engage in hand-to-hand combat (can only be used by 2 and 4 legged OKE's)

Status Check Chips (5 types)
Check amount of fuel remaining
Check amount of damage to OKE
Check temperature of OKE
Check amount of ammunition remaining in primary weapon
Check amount of ammunition remaining in secondary weapon

Special Chips (9 types)
Duck (can only be used by 2 and 4 legged OKE's)
Jam missles (must have missle jamming hardware equipped)
Stop command currently in execution
Halt program processing until next action available
Self destruct
Do nothing
Random branch
Time check
Check number of allied OKE's remaining

Channel Check Chips (2 types)
Send signal
Receive signal

Counter Check Chips (2 types)
Conduct arithmetic operation and store value in variable
Branch to specific path when variable greater than/less than certain value


by: El Nada i've tried this email and it is no longer valid
found online at http://db.gamefaqs.com/console/psx/file/carnage_heart_a.txt

Evaluation : Extremely agile OKE capable of dodging anything. Accurate firing
and obstacle/friend avoidance. Using only 2-legged OKEs, this program beat
Europa and Gannymede without adding or upgrading any production lines. Beat
Callisto using 2-legged OKEs and Manticores with this program, with a few line

Body       : Any 2-legged OKE, can also be used in 4-legged OKEs
Engine     : Any
Main weapon: Any Laser
Sub weapon : Any Missile or Large Missile
CPU        : any 144NC or higher (CP-588FX is available at start)
Fuel tank  : Any
Armor      : Any
Option     : Any (space for jammer at B4)

This format was created by Arne Michaelsen (arne@cco.net).
*note that this email is also no longer valid* - cody

Chip sides with green arrows are open because they show the normal program
flow. Red arrows pass through closed chip-sides, since they represent a

      +  /\  +                +==/\==+
                              |      |
      <      > Chip with      <      > Chip with
               all green      |      | all red
      +  \/  + arrows         +==\/==+ arrows

Chips are read in the same way they are in the game.

         Red arrow

           Scan E|  < -- Scan for enemy
   Green  < 120m |  < -- At a range of 120m
   arrow   90 180|  < -- Bearing 90 (right), 180 degree arc

Scan codes are as follows:
     E=Enemy         F=Ally
     P=Projectile    M=Missile
     N=Mine          O=Obstacle

Note on headings in Scan chips: 9o=-90 (-90 wouldn’t fit)

     A      B      C      D      E      F      G      H      I      J
  +  \/  +======+======+  /\  +==/\==+======+======+======+======+======+
  |  If   Scan F|Scan F| Count| Move |000000|000000|000000|000000|000000|
 1|  A=2 > 300m > 300m >  A+1 | Back |000000|000000|000000|000000|000000| 1
  |       90 180|9o 180|      |      |000000|000000|000000|000000|000000|
  +==\/==+  \/  +  \/  +  /\  +  /\  +======+======+======+======+======+
  |      | Jump   Jump        |      |000000|000000|000000|000000|000000|
 2|  --  |Right > Left > Wait | Grap |000000|000000|000000|000000|000000| 2
  |      |                    |      |000000|000000|000000|000000|000000|
  +  \/  +======+======+======+==/\==+======+======+======+======+======+
  |       Scan M        Scan P Scan E|000000|               Move |       
 3|  --  >  50m >  --  >  50m >  30m |000000|  --  >  --  > Left |  --  > 3
  |        0 354         0 354  0 135|000000|                    |       
  +  /\  +==\/==+  /\  +==\/==+  \/  +======+==/\==+==/\==+======+======+
  |      |             |      |Scan E| Ammo  Scan O Scan F  Fire         
 4|  --  | Jam  >  --  | STOP | 100m > Sub  > 100m > 100m > Sub 1>  --  > 4
  |      |             |      | 0 33 |  <1    0 39   0 39   0 39         
  +  /\  +======+  /\  +  \/  +  \/  +==\/==+==/\==+==/\==+======+======+
  |        Jump |      |Scan P|Scan E| Ammo  Scan O Scan F| Fire         
 5|  --  < Left | Duck <  20m | 200m > Main > 200m > 200m | Main >  --  > 5
  |             |      | 0 354| 0 33 |  <1    0 39   0 39 | 0 39         
  +  /\  +==/\==+======+  \/  +  \/  +==\/==+======+  \/  +  /\  +======+
  |      | Rand        |Scan P|      |      |      | Heat        |000000|
 6|  --  | 1/2  <  --  <  50m |  --  |  --  |  --  < > 70 >  --  |000000| 6
  |      |             | 0 90 |      |      |      |             |000000|
  +  /\  +  \/  +  /\  +  \/  +  \/  +  \/  +  \/  +======+======+======+
  |        Jump |      |Scan P|Scan E| Move        |000000|000000|000000|
 7|  --  < Right|  --  <  50m | 300m > Fwd  >  --  |000000|000000|000000| 7
  |             |      |180 90| 0 33 |             |000000|000000|000000|
  +  /\  +======+======+  \/  +  \/  +======+  \/  +======+======+======+
  |        Jump |      |Scan P|Scan E| Turn        |000000|000000|000000|
 8|  --  < Back |  --  <  50m | 300m > Right>  --  |000000|000000|000000| 8
  |             |      | 90 90|90 180|             |000000|000000|000000|
  +  /\  +  /\  +  \/  +  \/  +  \/  +======+  \/  +======+======+======+
  | Jump | Rand        |Scan P|Scan E| Turn        |000000|000000|000000|
 9| Fwd  < 1/5  <  --  <  50m | 300m > Left >  --  |000000|000000|000000| 9
  |      |             | 9o 90|9o 180|             |000000|000000|000000|
  +======+======+======+  \/  +  \/  +======+  \/  +======+======+======+
  |000000|000000|000000|      | Move |000000|      |000000|000000|000000|
10|000000|000000|000000|  --  | Fwd  |000000|  --  |000000|000000|000000|
  |000000|000000|000000|      |      |000000|      |000000|000000|000000| 10
  |000000|000000|000000|      |      |000000|      |000000|000000|000000|
  +======+======+======+  \/  +  \/  +======+  \/  +======+======+======+
     A      B      C      D      E      F      G      H      I      J

Hardware Decisions:

--Putting this in a Prowler will let it take on tanks or 2/4-legged OKEs without
trouble, but it may be wounded after 1 battle and having it fight 2 or 3 in a
row is risky. Putting it in a JuJuman will let it fight 2 or more fights without
worry. Putting it in a Vipor will make it nearly invincible.
When I played the last map on Gannymede, none of my Vipors got damaged at all.

--If you put this program in a 4-legged OKE, change all the projectile and
missile checks to 60 or 70 meters (Ducking at 25) to compensate for their slower

--4-legged OKEs fire more shots quicker than 2-legged OKEs, but they have a
harder time dodging. Experiment and see what kind of OKE is best for you.

--Giving this OKE a missile jammer really helps. With one, this OKe can dodge
anything. If you really don't care if a few of them get blown up, give it an
Armor Repair Device. It will quickly eliminate what little damage this OKE

Software Decisions:

--"Wasted Spaces" and "Wasted Time" are irrelevant. With a medium speed chip,
the OKE dodges almost immediately and tells it to dodge 3+ times while it is
already dodging.

--Dodge First, Fire Later.

--Change the Enemy, Obstacle, and Friend Detection range (E4, G4, H4) for the
sub weapon firing to suit your choice of sub weapon.

--Change the heat check at H6 to suit your OKE's weapon

Explanation of Program:

At the start, the OKE jumps right twice if there are no friends on the right,
left twice if there are no friends on the left, or it stays put if it is
surrounded by friends. This results in a more spread out fighting formation.
Change the number in A1 if you want to change the number of times it jumps. Once
it is done with this, that piece of code is never executed again. Next, It
detects if there are any missiles near and jams them. Notice how after jamming
that the code flow continues after the missile detection and not before it, so
the OKE does not sit in one place and jam missiles while they are near. If it
detects projectiles near, it stops whatever it is doing and avoids fire. If
projectiles are very close, it ducks. If projectiles are coming from the front
or back, it jumps left or right. If projectiles are coming from the sides, it
jumps forward or back. Notice how the probability of jumping forward is 1/5.
This helps avoid the OKE jumping toward an enemy that it is facing. If no
projectiles are coming, the OKE immediately checks for an opportunity to
grapple. Notice the Move Back chip right after the grapple. Normally it does
nothing, but if the target is about to explode, the grapple is not executed and
the OKE backs off to a distance of 30m. The OKE then checks to see if an enemy
is in front of it at a distance of 100m for the sub weapon and 200m for the main
weapon. If it is out of sub weapon ammo it automatically diverts to main weapon
firing instead of moving forward (grappling is much more risky than just firing
the main weapon). If it detects an obstacle or friend in the way when firing it
diverts to sub weapon firing checks. This can result in sub weapon firing at
long ranges, but if you have missiles or large missiles it isn't a problem. If
it detects obstacles or friends in both instances it makes the OKE move left.
Having it randomly chose to move left or right would just cause it to rapidly
switch between right and left movement, accomplishing nothing. You could edit
the program to have it randomly jump left or right, but in my experience this
causes the OKE to jump into mines and enemy OKEs too often to be worth it. A
heat check stops the OKE from firing if it is too hot. This isn't a problem fora
Prowler, JuJuman, Livewire, or Rouge, but it should be set at 70 or 75 for a
Vypor and 60 or 65 for a Manticore. 

If no enemies are within range in front of it, it starts searching. If an enemy
is in front but just too far ahead, it walks forward. If an enemy is to the left
or right, it turns left or right. If it can't find an enemy anywhere, it walks
forward. The only weakness in this program is that it has no chips for avoiding
mines. I left it out even though I could have fit it in because it would cut off
the heat detection chips. If you want it to avoid mines, have the "Move forward"
at F7 changed to "no action", have the "no action" at G7 pointing left to a
"Scan mine" chip set to scan for mines right in front of it with red arrow up
and green arrow right. Above it place a "move right", and to the right of that
place "no instruction" chips leading to the edge of the board. To the right of
the "Scan mine" chip place a "move forward" chip with "no instruction" chips to
it's right leading to the board's edge. This cuts off the heat detection chips,
change the firing chips so it goes directly to firing the main weapon.

How to beat the game with this program:

--Mass produce OKEs. They are cheap compared to other costs.
--Have wounded units retreat to a base to recover.
--Send the stupid OKEs you start off with to an enemy base and swarm it. It will
easily fall. If you can give yourself a maufacturing advantage early on in the
battle, you can easily win.
--Play defensively untill you have enough OKEs to attack. This is extremely
important in Callisto and maps like the last one on Gannymede. Once you have a
manufacturing advantage, you can go on the defensive and not worry about a horde
of enemy OKEs coming up.
--Research The JuJuman and Manticore ASAP. They are much better than Prowlers
and other 4-legged OKEs. A mixed group of JuJumen and Manticores make a very
good team.
--The Vypor is probably the best OKE. It is very fast and fires triple shots.

Just for Fun: The  Manticore has a VERY powerful physical attack, so give a
Manticore this program and replace the main weapon and sub weapon firing chips
with move forward chips. It will advance towards the enemy and smash it to

Author: Arne Michaelsen
Email : arne@cco.net
i've tried contacting this email and it is no longer valid

Any two-leg OKE body 
Rocket launcher (Snake, Hercules, or Panther)  
Missile interferance device 
9x9 CPU 
(With some tinkering, this also works for OKE's with lasers and large 
missiles, and also multi-leg OKE's.  See my notes below).

+  \/  +------+------+------+------+------+------+------+------+
|Scan P|Scan P  Count  Count Scan P|Scan P Scan P Random| Jump |
|  60  >  20  >   A  >  A+1 >  35  >  35  >  35  >      >      |
|0  360|0  360   < -1        A > 15|-90 90 90  90  1/2  | Right|
+  \/  +--\/--+------+  /\  +  \/  +--\/--+--\/--+  \/  +  \/  +
|             |      |Scan M Count?|        Jump | Jump |      |
|  --  < Duck | Jam  < 100  <      |  --  >      |      |  --  |
|             |      |0  360 A > 15|        Ahead| Left |      |
+  \/  +------+  \/  +------+--\/--+------+  \/  +  \/  +  \/  +
| Time                             |                            
|  < 4 >  --  >  --  <  --  <  --  |  --  >  --  >  --  >  --
|                                  |       
+--\/--+------+  \/  +------+------+  /\  +------+--/\--+------+
|Scan F|Scan F|Scan E|                    |      | Temp   Fire
| 300  > 300  >  30  > Grap >  --  >  --  |      |   >  > Main >
|90 180|-90 180 0  90|                    |      |  80%
+  \/  +  \/  +  \/  +------+------+------+------+--/\--+------+
 Scan F|      |Scan E| Ammo |Count               |Count?  Fire
< 300  |  --  |  75  > Main >  A   >  --  >  --  | A=1  > Sub  >
-90 180|      | 0  90|  >1  | < -1               |          1
+--\/--+  \/  +  \/  +  \/  +------+------+  \/  +  /\  +------+
  Move |      |       Scan E| Ammo |Count  Scan F Scan O|
< Right|  --  |  --  > 110  > Sub  >  A   >  40  >  20  |
       |      |        0  90| > 1  | < -2   0 90   0 90 |
+------+  \/  +------+  \/  +  \/  +------+--\/--+--\/--+------+
  Move        |                    |      |       Random  Jump
< Left <  --  |  --  <  --  <  --  |      |  --  > 1/2  > Rght >
              |                    |      |
+------+------+  \/  +------+------+      +------+--\/--+------+
  Turn  Scan E Scan E|                           | Jump
< Left < 300  < 300  |                           | Left >  --  >
        90 90   0 90 |                           |
+------+--\/--+--\/--+                           +------+------+
       | Turn | Move |
       | Right| Ahead|
       |      |      |
       +  \/  +  \/  +

What's it do?  Well, first off for the first four seconds of combat, it looks 
left and right for friendly units.  If there is an ally on one side, it'll 
sidestep away.  If there is one on either side, it'll go right into the 
search and destroy part of the code.  If there are no allies present, it will 
sit there and do nothing but dodge incoming fire for four seconds.  I could 
try to make it go into search mode, but I havn't planned on how to do that 
et unless I went to a larger CPU.  Plus I almost exclusivly use this program 
in groups anyway.

Once the timer goes above four, it will never execute that part of the code 
again.  From then on it consists purely of fire avoidance, and seek & destroy 
code.  The loop in the projectile code helps avoid missiles that the jamming 
device doesn't stop.  The entrance to the loop looks in a 60 meter range, 
and then it waits for either the projectile to get closer (35 meters) before 
jumping, or exits the loop if the projectile doesn't get close within 15 
cycles.  The 60 meter start is so the OKE can get into a state of "jump 
readiness" and not get caught firing weapons.  Then it waits until the 35 
meter mark which is usually close enough that missiles that are tracking you 
can't quite turn fast enough to catch you.  If the fire is coming from the 
left or right it jumps forward.  From the front or back it will jump 

The Search part is really simple, just looks ahead and walks forward.  If 
the enemy isn't in front, it checks to the right.  If they aren't there it 
turns left and starts again. 

The weapon firing I made simple too.  But instead of seperate firing routines 
I made one that fires either weapon depending on the status of the A counter. 
That way I can put my friend and obstacle checking in only once, and have 
one section to fire the weapons after that. 

This code works best on a Vyper with a shotgun and rockets.  It can work on 
any 2-legged OKE though, I just like the Vyper because it fires double 
rounds.  It will also work on multi-legged OKE's, but I suggest raising the 
projectile scan chips by 5 or 10 meters, and widening the enemy and weapon 
scan widths to take advantage of wide fields of fire. 

I personnaly have used this program very succesfully with shotgun armed 
Jujuman OKE's combined with a laser (and large missile) armed Manticore for 
support.  Later I used all Vyper OKE's for the group.  Just remember to 
raise the weapon scan ranges for the laser armed OKE's, and lower the temp 
check (a laser armed Manticore cannot fire at anything above 65% or it will 
take some damage from heat). 
Multileg OKE's: Raise projectile detection ranges by 5 or 10 meters 
                Widen enemy scanning and weapon firing arcs to 180 degrees 
Laser OKE's: Raise main weapon range to 150 meters 
             Raise sub-weapon range to 200 (for large, long-range missiles) 
             Raise temperature check if it fires more than single shots 
               (Double shots should be about 70%, triple at 65% and quad at 
               60%, roughly.  Thick armor makes you lose heat slower so you 
               may have to adjust). 

so, you have a general idea of what the programming is all about, you've seen a couple examples, but you still don't think you'll be able to do anything wacky and exciting with the Carnage Heart Programming Language. something maybe like....Calculate the value of Pi!?

yes, it has been done (http://www.frc.ri.cmu.edu/~mcm/pi.html for all the fun details)

actually, i just got permission from the author to add his method to this node! whee! so here goes:

Calculating Pi In Carnage Heart
courtesy of Martin C. Martin martin@metahuman.org

So yesterday (Weds) there was too much hail and ice to ride my motorcycle to school, so I walked in. On the way home, I got to thinking. That's the problem with walking: you're left alone with your thoughts. Anyways, I was thinking about the Carnage Heart video game (that's the one that lets you program Mechs for battle). I was thinking about it's computation engine, and whether you could do some traditional programming tasks on it, like computing Pi. After all, it's Turing complete. So I started thinking about how I would do it. You have registers, which hold (I later found out) 3 decimal digits, and a sign. But, the only operations you have are add a constant, subtract a constant, multiply by a constant, divide by a constant, assign from a constant, and compare to a constant. The constants must be in the range 1 to 100 (inclusive), and there are no operations that involve two registers.
                Now, there's a really simple formula for Pi:

Pi/4 = 1 - 1/3 + 1/5 - 1/7 + ...

                A couple things crossed my mind. First, I only had 5 registers, so I could only compute a few digits of Pi. But wait! I have 3 mechs! And they can communicate! There are 5 different channels (1-5), each of which can send or recieve 5 messages (named after 5 colours). It wouldn't be hard to use a single channel and transmit a number in base 5. So, that's 15 registers at my disposal.
                But a bigger problem is that there's no (direct) way to take a reciprical. There isn't even a direct way to add two registers. But this is where my theory of computing classes come in. If you want to add register B to register A, you can do (assuming B > 0):

foo: A = A + 1
     B = B - 1
     if B > 0 then goto foo

                Of course, this destroys B, but you can make a copy of it before hand:

Copy B to C and D, destroying B
     C = 0
     D = 0
bar: C = C + 1
     D = D + 1
     B = B - 1
     if B > 0 then goto bar

                Now that you can add (or subtract) two numbers, you can compare them by subtracting the two and seeing if the result is positive, negative or zero. Or, equivalently, you can subtract 1 from each, and whichever gets to zero first is the smallest.
                Then, you can do division by repeated subtraction:

Calculate A / B, quotient in C, remainder in A
     C = 0
baz: if A < B then end in practice, goto the first statement of the next step
     A = A - B
     C = C + 1
     goto baz

                If you expand everything out, you can combine many steps. For example, the copy and subtract can be combined like this:

A = A - B; C = B; B = 0
      C = 0
phat: A = A - 1
      B = B - 1
      C = C + 1
      if B > 0 then goto phat

                There are some other speedups you can do too. Instead of subtracting 1 all the time, you can do:

A = A - B; B = 0
phat1: if B < 100 then goto phat2
       A = A - 100
       B = B - 100
       goto phat1
phat2: if B < 10 then goto phat3
       A = A - 10
       B = B - 10
       goto phat2
phat3: if B < 1 then end
       A = A - 1
       B = B - 1
       goto phat3

                The ultimate in this vain would be a binary thing: compare to 512, 256, 128, 64, ..., 1. You don't even need the loop, since you only need to subtract each number at most once. (Actually, it's hard to compare to numbers bigger than 100, since it can't be done directly. Probably best to have a loop to get it under 100, then do the binary thing.)
                Also, for division, you could do "if A > 10*B then A = A - 10*B, C = C + 10". Multiplying by 10 is built in, and you need to make a copy of B anyways.
                Well, I wrote the program out on paper. It's only for a single mech, and while I combined as many steps as I could, it doesn't have any of the other optimizations. It should compute the first 2 or 3 decimal places of Pi (that is, 3.141 or pretty close). Who would have thought those theory of computation constructions could actually be used?? I haven't implemented it yet, I'm waiting until I get the "best" CPU (fastest and largest program storage). Then I'll try it. I'll be curious to see how far it gets in the 150 second time limit. (Too bad I can't let it run all night!) That series converges really slowly, especially if your variables only ever go up or down by 1 at each timestep!

                I'm such a nerd.


                P.S. The next step would be a multi precision, parallel communicating version. Because the above formula converges so slow, it would have to be based on the Taylor series for arctan...

good luck and happy programming!

Log in or register to write something here or to contact authors.