FoonLudum Dare ExplorerLD56 → Ant war!

Ant war!

By nikor

View on ldjam.com

CategoryRankScoreCount
Overall6643.4223
Fun6363.2823
Innovation194.2823
Theme2983.9523
Graphics9641.9223
Audio6801.2017
Humor6852.7621
Mood9622.8722

Comments

victor-reiner 2024-10-08 15:50

This must have been really hard to program, right? It took me a while to figure it out, but it was a lot of fun afterwards!

yodog 2024-10-08 15:56

Having no experience with JS, I actually had quite a bit of fun trying to figure this out. I managed to get through level 4. Level 5 stumped me, but I bet I can figure it out with some time. There are a few typos in your text, and I would have loved to see more visuals, but the simplicity of the graphics was charming. Nice work.

guiik 2024-10-08 17:20

Love the concept, very fun ! You should spell check your text though :grimacing:

nikor 2024-10-13 20:03

@victor-reiner Yeah the programming a bit to long, so the rest had to suffer.

utopia 2024-10-13 20:04

I have the same idea at first glance of the topic lmao. You did a great job making this.

nikor 2024-10-13 20:05

@yodog I'm glad you had fun! And yeah I messed up my time table so the levels was made last minute :)

nikor 2024-10-13 20:05

@guiik Thank you! I will do better with the spelling next time :)

nikor 2024-10-13 20:47

@utopia Thank you :)

scrumblob 2024-10-13 20:47

I'm a Javascript noob, but I enjoyed this game! I couldn't beat level 5, but overall one of my favorite games this jam. Reminds me of Bitburner

gilgadev 2024-10-13 21:47

Really enjoyed the game! Very fun to see what is possible with the simplest graphics. Must have been crazy hard to code, though.

Great Job!

atmospherium 2024-10-14 01:35

I love seeing entries like this in Ludum Dare where there's a ton of ambition that wasn't able to be fully realized. There's a lot of complexity in getting these systems to work right, so I'm thoroughly impressed in how complete you DID make the game. I beat each of the individual levels (I think I used an unintended strat for the last one, but I'm fine with it). Great work.

ratly 2024-10-14 02:28

Cool idea, this must have been tough to make. This would be a fun way to teach programming.

soul-grinder 2024-10-14 08:07

I've never tried JavaScript before this, just C#, C++ and a bit of BASIC but this was fun and refreshing to see this type of game on a game jam. The only thing I would change is I'd add some graphics and sound to give it more character and atmosphere. Nice work, hope I see more games like this in future jams.

tharinda-kodikara 2024-10-14 14:45

Innovative idea

radjax 2024-10-15 05:01

Super awesome idea! I loved tinkering with the different levels to figure out the way through, and I've always wanted to do a javascript game in the vein of screeps. Very well designed and well explained, loved it!

zubspace 2024-10-15 21:01

I like the concept and how you introduce more and more mechanics up to level 5. Really cool!

But the jump from level 5 to Free Play feels huge. First I thought, I'm clever and just transition through the level like this: ``` (mind, sense) => { if (mind == undefined) { mind = ["up", 0];

for (var i = 0; i < sense.stop.friends.length; i++) { sense.stop.friends[i] = ["up", (i+1) * 2]; } }

let dir = mind[0];

if (mind[1] > 0) { mind[1] -= 1; return [dir, true, mind]; }

if (dir == "up") { dir = "right"; } else { dir = "up"; mind[1] = 1; } mind[0] = dir; return [dir, true, mind]; } ```

But that doesn't work, because you actually need to pickup food and bring it back to the base to increase your ant army!

So after lots of trial and error, I managed to come up with this: ``` (mind, sense) => { if (mind == undefined) { mind = [false, 0, 0];

for (var i = 0; i < sense.stop.friends.length; i++) { if (sense.stop.friends[i] == undefined) { sense.stop.friends[i] = [false, 0, 0]; } } } let dir = ''; if (mind[0] == true) { if (mind[1] == 0 && mind[2] == 0) { mind[0] = false; } else if (mind[1] > 0) { dir = 'left'; mind[1] -= 1; } else if (mind[1] < 0) { dir = 'right'; mind[1] += 1; } else if (mind[2] > 0) { dir = 'down'; mind[2] -= 1; } else if (mind[2] < 0) { dir = 'up'; mind[2] += 1; } } if (dir == '') { if (sense.up.enemies > 0) { dir = 'up'; mind[2] += 1; } else if (sense.down.enemies > 0) { dir = 'down'; mind[2] -= 1; } else if (sense.left.enemies > 0) { dir = 'left'; mind[1] -= 1; } else if (sense.right.enemies > 0) { dir = 'right'; mind[1] += 1; } else if (sense.up.food > 0) { dir = 'up'; mind[0] = true; mind[2] += 1; } else if (sense.down.food > 0) { dir = 'down'; mind[0] = true; mind[2] -= 1; } else if (sense.left.food > 0) { dir = 'left'; mind[0] = true; mind[1] -= 1; } else if (sense.right.food > 0) { dir = 'right'; mind[0] = true; mind[1] += 1; } else { let rnd = Math.random(); if (rnd < 0.25) { dir = 'up'; mind[2] += 1; } else if (rnd < 0.5) { dir = 'right'; mind[1] += 1; } else if (rnd < 0.75) { dir = 'down'; mind[2] -= 1; } else { dir = 'left'; mind[1] -= 1; } } } return [dir, true, mind]; } ```

The mind store 3 components in an array: * mind[0] is a bool, which says if the ant currently has food * mind[1] contains the x-offset to base (right of base is positive) * mind[2] contains the y-offset to base (up of base is positive)

As soon as the ant finds some food it will return to the base immediately.

It takes ages to run the simulation, but I think, that the algorithm should work quite well in the long run. Here's how my army looks like after 5 minutes in "mostly random" mode:

Ant.png

But maybe there are other tricks to optimize it?

Anyway... Had lots of fun!

turquoise-moon 2024-10-15 21:32

I really enjoyed this! It was a fun idea! I wish there was a grid though. It was hard to tell how many spaces an ant should move in the earlier levels.

weird-orb 2024-10-17 02:59

I love that this is almost educational and lets people experiment with JS a bit, a really interesting game!