Log In  

A small simulator of Prey Vs Predator.

All creatures can only move in one of four directions: up, down, left, right.
Moving consumes an energy point.

If a prey runs out of energy, it can't move that turn.
It may choose to not move even with energy.
If any of these happen, then it gets 1 energy point.

Predators also can run out of energy. It they do, they die. To get energy, they need to eat prey. If they do, they get full energy and 2 more predators appear.

The objective of prey is to outlive the predator.
The objective of predator is to kill all prey (yes, I know that they die after that. Just ignore that for now).

If a prey is next to a predator (not diagonally), has energy and wishes to move, it will move away from the predator.
If a predator is next to a prey (not diagonally) and wishes to move, it will eat the prey, but if it had 1 energy before eating, the prey survives and the predator dies.

If none of the above are met, the creatures will move around randomly.

Pretty much everything is customisable, although it might run slower.

If you wish (or made a huge map), you can move the cam with the arrow keys.

Added prey splitting. They split every set amount of turns (configurable) and have a random chance of splitting (also configurable).

Cart #prey_vs_pred-5 | 2022-11-14 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

Doesn't need pico-8 terminal. Yay!

Without prey splitting version:

Cart #prey_vs_pred-4 | 2022-11-13 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

P#120621 2022-11-13 19:40 ( Edited 2022-11-14 19:18)

Good, @Guest122, but I would show two blocks combatting, perhaps a yellow block as well as showing in digits the life-values decreasing in both.

And congrats for getting out of writing virus-like carts.

There are also 3 programs I wrote you might find of interest, very similar to what you are doing here:

https://www.lexaloffle.com/bbs/?tid=49876
https://www.lexaloffle.com/bbs/?tid=35900
https://www.lexaloffle.com/bbs/?tid=27955

P#120637 2022-11-13 21:51 ( Edited 2022-11-13 21:56)

@dw817 the creatures don't have life values and predator always wins, although I could probably make something. Give time some time. And thanks for the cart links, although I had already seen most of these in my search for carts similar to what I did.

P#120694 2022-11-14 15:31

Energy values, I mean to say, @Guest122. You mentioned there are numbers associated with these ?

P#120727 2022-11-14 22:52

@dw817 yes, there are. They are related to a creature's movement. For prey, if it reaches 0, they can't move. For predators, they just die. Fighting doesn't decrease the energy.

P#120773 2022-11-15 21:14

Well what I am suggesting, @Guest122, is to show those numeric values about each object. Maybe have the person press 🅾️ to see each frame occur instead of auto as it is now.

Would certainly make it more interesting to me. Bonus if you can press ❎ to run the code in reverse by one step. Easiest way to do that would be record the board, objects and all, then when a rewind is issued, recall that previous snapshot of the board.

P#120776 2022-11-15 22:04

[Please log in to post a comment]