Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Ant Colony Simulator (not really a game)  (Read 6947 times)
0 Members and 1 Guest are viewing this topic.
Offline KevinWorkman

JGO Wizard


Medals: 58
Projects: 11
Exp: 12 years


klaatu barada nikto


« Posted 2011-12-14 13:13:14 »

Here's the link, check it out if you feel like it: http://code.kevinworkman.com/Ants/

As a final project in my AI class, I developed a program that hopefully introduces non-programmers to the artificial intelligence principle of emergence in ant colony optimization.

Basically, the program models how real-life ants cooperate to find food. Even though each individual ant is pretty dumb, the colony as a whole shows intelligent behavior. Through pheromones and some very simple rules, ants work together to respond to dynamic environments (which you can change on the fly).



The program's source is available, and it might serve as a base for another programmer to implement something more game-like. This could be the beginnings of a tower defense game, or just a better version of the open environment I've started here.

I'm submitting this later today, so any feedback on stuff that isn't obvious is appreciated. Also, if anybody using a mac could do a quick "this works", I'd appreciate it. My professor uses a mac, but I don't have one to test on.

I've also posted this here and here.

Static Void Games - Play indie games, learn game programming, upload your own games!
Offline Nate

JGO Kernel


Medals: 145
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #1 - Posted 2011-12-14 19:35:29 »

Can we see an applet? Smiley Nevermind, found it on the right.

Offline KevinWorkman

JGO Wizard


Medals: 58
Projects: 11
Exp: 12 years


klaatu barada nikto


« Reply #2 - Posted 2011-12-14 19:38:59 »

Can we see an applet? Smiley Nevermind, found it on the right.

I've been trying to figure out a clean, obvious way to indicate that a user on my site should click one of those options to run the programs. Really obvious things are usually ugly, and really nice-looking things are hard to notice. Putting them on the right is the best I could come up with, but I'm very open to suggestions!

Static Void Games - Play indie games, learn game programming, upload your own games!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline theagentd
« Reply #3 - Posted 2011-12-14 20:02:18 »

My first thought was "Meh." but after watching it for a few minutes, I realized how awesome it is. I've always been fascinated by games that play themselves. Why not evolve it a little to make the food resources limited, allow ants to reproduce into more of themselves and add random map generation? You could even make different ant factions that can fight against each others and make the ants leave pheromone trails of danger, e.t.c. You also need better graphics. >_> It's very hard to see the flow of the "game" when the ants teleport between tiles. A smooth movement from tile A to tile B would make a huge difference!

Myomyomyo.
Offline sproingie

JGO Kernel


Medals: 202



« Reply #4 - Posted 2011-12-14 20:07:04 »

Wasn't too hard to find.  I really like the "require all" trick for finding a hamilton circuit.

While they do converge on a path eventually,  I do find that that individual ants still tend to move a little more erratically than other ant simulators I've seen.  Before weighting for trails, do you have them moving in a completely random direction each turn, or do you have them favor moving forward?
Offline KevinWorkman

JGO Wizard


Medals: 58
Projects: 11
Exp: 12 years


klaatu barada nikto


« Reply #5 - Posted 2011-12-15 00:48:08 »

My first thought was "Meh." but after watching it for a few minutes, I realized how awesome it is. I've always been fascinated by games that play themselves. Why not evolve it a little to make the food resources limited, allow ants to reproduce into more of themselves and add random map generation? You could even make different ant factions that can fight against each others and make the ants leave pheromone trails of danger, e.t.c. You also need better graphics. >_> It's very hard to see the flow of the "game" when the ants teleport between tiles. A smooth movement from tile A to tile B would make a huge difference!

Thanks! The original purpose of this was not to be a game, but to serve as a final project for school, so I shied away from / didn't have time for game-type stuff. Same excuse for graphics and smoother animations. Smiley

However, one of my goals was to build up a code base that I or somebody else could build on to implement something like a game, or to go the opposite direction and implement a more scientific version of this. I went for the middle ground so that it was usable for as many people as possible. I actually seriously consider the fact that you stayed interested for a couple minutes and then thought "now what if this was added..." a great success.

Static Void Games - Play indie games, learn game programming, upload your own games!
Offline KevinWorkman

JGO Wizard


Medals: 58
Projects: 11
Exp: 12 years


klaatu barada nikto


« Reply #6 - Posted 2011-12-15 00:52:36 »

Wasn't too hard to find.  I really like the "require all" trick for finding a hamilton circuit.

While they do converge on a path eventually,  I do find that that individual ants still tend to move a little more erratically than other ant simulators I've seen.  Before weighting for trails, do you have them moving in a completely random direction each turn, or do you have them favor moving forward?


The "require all" option was initially a stab at modelling the traveling salesperson problem. It's not strict in that it doesn't enforce the rule that ants can't travel through the same food twice, but I think they come up with some interesting solutions. They also come up with some ridiculous solutions, but that's part of the fun, right?

And yeah, good observation on the ants' movement. They move completely randomly until they find a pheromone, at which point they either weigh them or choose the best option (depending on the trail strength). I considered having them prefer forward movement (or even making their direction preference be an adjustable parameter), but I decided against it.

Static Void Games - Play indie games, learn game programming, upload your own games!
Offline ra4king

JGO Kernel


Medals: 345
Projects: 2
Exp: 5 years


I'm the King!


« Reply #7 - Posted 2011-12-15 04:11:29 »

Wow I almost did not see the time fly by! I kept playing around with it and making many different paths Tongue
Great job!

Offline theagentd
« Reply #8 - Posted 2011-12-15 09:27:24 »

One of the ultimate games I want to create is an MMORPG game where all content is generated and controlled by an AI similar to this. Think about it; a game where towns and cities are naturally formed around places with lots of people and travelers; a game where towns need resources to survive and can actually disappear if they are destroyed or they become too unpopular, e.t.c. Players take the role of a single person in this world, and can do whatever they want to try to become successful, or ruin other peoples work. I tried to experiment with a very simple AI for a small community which built houses for people to live in, gathered wood for house construction and gathered food for keeping the population alive. I had a very hard time getting it balanced. It always massed a single resource too much or built too many houses, and then I realized it was because they were communists! I realized the problem was that a central AI controlled how many people to assign to resource gathering and how many houses to build, and it's very hard for "the state" to determine optimal numbers for this! A swarm approach (AKA ant colonies) is MUCH more effective at adapting to changes and other stuff than a supermind overviewing everything, because it is simply put to difficult to determine an optimal strategy. Let the drones do the work and it should be able to adapt to anything in a much more realistic and simple way!

Gah! You're distracting me with insanely interesting ideas!!! T___T

Myomyomyo.
Offline Fokusas

Senior Member


Medals: 3
Projects: 1



« Reply #9 - Posted 2011-12-15 10:04:16 »

Very nice idea
both of you  Grin
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline KevinWorkman

JGO Wizard


Medals: 58
Projects: 11
Exp: 12 years


klaatu barada nikto


« Reply #10 - Posted 2011-12-15 13:37:57 »

Wow I almost did not see the time fly by! I kept playing around with it and making many different paths Tongue
Great job!

Thank you! Anything that wastes other people's time is a great success, haha.

Static Void Games - Play indie games, learn game programming, upload your own games!
Offline KevinWorkman

JGO Wizard


Medals: 58
Projects: 11
Exp: 12 years


klaatu barada nikto


« Reply #11 - Posted 2011-12-15 13:38:38 »

One of the ultimate games I want to create is an MMORPG game where all content is generated and controlled by an AI similar to this. Think about it; a game where towns and cities are naturally formed around places with lots of people and travelers; a game where towns need resources to survive and can actually disappear if they are destroyed or they become too unpopular, e.t.c. Players take the role of a single person in this world, and can do whatever they want to try to become successful, or ruin other peoples work. I tried to experiment with a very simple AI for a small community which built houses for people to live in, gathered wood for house construction and gathered food for keeping the population alive. I had a very hard time getting it balanced. It always massed a single resource too much or built too many houses, and then I realized it was because they were communists! I realized the problem was that a central AI controlled how many people to assign to resource gathering and how many houses to build, and it's very hard for "the state" to determine optimal numbers for this! A swarm approach (AKA ant colonies) is MUCH more effective at adapting to changes and other stuff than a supermind overviewing everything, because it is simply put to difficult to determine an optimal strategy. Let the drones do the work and it should be able to adapt to anything in a much more realistic and simple way!

Gah! You're distracting me with insanely interesting ideas!!! T___T

Wow, that definitely sounds fascinating. I'd love to hear more about it if you get something workable going.

Static Void Games - Play indie games, learn game programming, upload your own games!
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #12 - Posted 2011-12-15 13:41:16 »

One of the ultimate games I want to create is an MMORPG game where all content is generated and controlled by an AI similar to this. Think about it; a game where towns and cities are naturally formed around places with lots of people and travelers; a game where towns need resources to survive and can actually disappear if they are destroyed or they become too unpopular, e.t.c. Players take the role of a single person in this world, and can do whatever they want to try to become successful, or ruin other peoples work.

Eve.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline theagentd
« Reply #13 - Posted 2011-12-15 14:16:42 »

One of the ultimate games I want to create is an MMORPG game where all content is generated and controlled by an AI similar to this. Think about it; a game where towns and cities are naturally formed around places with lots of people and travelers; a game where towns need resources to survive and can actually disappear if they are destroyed or they become too unpopular, e.t.c. Players take the role of a single person in this world, and can do whatever they want to try to become successful, or ruin other peoples work.

Eve.
Never played it. I'm a cheapskate.

Myomyomyo.
Offline sproingie

JGO Kernel


Medals: 202



« Reply #14 - Posted 2011-12-16 00:03:43 »

One of the ultimate games I want to create is an MMORPG game where all content is generated and controlled by an AI similar to this. Think about it; a game where towns and cities are naturally formed around places with lots of people and travelers; a game where towns need resources to survive and can actually disappear if they are destroyed or they become too unpopular, e.t.c.

This is probably where Dwarf Fortress's Adventure Mode is heading in, oh, another 20 years.  I only ever play Fortress Mode myself, and it also has some pretty interesting emergent behaviors, though not a lot of direct interaction between dwarfs except when they're killing each other...

Offline asphaltgalaxy

Junior Member


Medals: 1



« Reply #15 - Posted 2011-12-29 14:09:46 »

Nice simulator, great job! Tried several maze construction strategies... Smiley And yes, they're still searching for food Smiley
Offline asphaltgalaxy

Junior Member


Medals: 1



« Reply #16 - Posted 2011-12-29 14:14:39 »

One of the ultimate games I want to create is an MMORPG game where all content is generated and controlled by an AI similar to this. Think about it; a game where towns and cities are naturally formed around places with lots of people and travelers; a game where towns need resources to survive and can actually disappear if they are destroyed or they become too unpopular, e.t.c.

This is probably where Dwarf Fortress's Adventure Mode is heading in, oh, another 20 years.  I only ever play Fortress Mode myself, and it also has some pretty interesting emergent behaviors, though not a lot of direct interaction between dwarfs except when they're killing each other...


And it's little bit like Majesty (at least older one). You can stimulate heroes by money (not always), and you never know, will reach your mage level 7 or not Smiley
Offline KevinWorkman

JGO Wizard


Medals: 58
Projects: 11
Exp: 12 years


klaatu barada nikto


« Reply #17 - Posted 2011-12-29 18:57:45 »

Nice simulator, great job! Tried several maze construction strategies... Smiley And yes, they're still searching for food Smiley

Thanks! If you feel like it, you might try playing with the simulation parameters to encourage them to solve a maze. Something like setting the max pheromone slider to a high value and the dropoff and evaporation sliders really low might help them solve it better.

Static Void Games - Play indie games, learn game programming, upload your own games!
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

TehJavaDev (16 views)
2014-08-28 18:26:30

CopyableCougar4 (25 views)
2014-08-22 19:31:30

atombrot (38 views)
2014-08-19 09:29:53

Tekkerue (35 views)
2014-08-16 06:45:27

Tekkerue (32 views)
2014-08-16 06:22:17

Tekkerue (20 views)
2014-08-16 06:20:21

Tekkerue (31 views)
2014-08-16 06:12:11

Rayexar (66 views)
2014-08-11 02:49:23

BurntPizza (44 views)
2014-08-09 21:09:32

BurntPizza (34 views)
2014-08-08 02:01:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!