9 ms·
Cells. A massively multi-agent Python programming game.
- drlisp 16y agowow!
- ihodes 16y agoI got so excited for this that I actually began thinking about writing interfaces to the game for other languages. It'd be fun to compete in a Lisp vs Python—maybe one language would lend itself to a certain kind of tribe. I'll be looking at the source soon, but in the meantime I'm curious to see if other people would be interested in playing this. There could be a repository of genomes/tribes you can download and compete against, or perhaps this would be done server-side so your tribe's genome couldn't be cloned? As a side note, it seems to me that (unless cells can be aware of their comrades' positions) global position needs to be availible in order to build walls, which is damn cool. Cheers!
- phreeza 16y agoGreat, I'm glad I'm not the only one that likes the idea! Interoperability to other languages is definitely on my list for the future, and a kind of ladder-server, too, where you submit your tribe and it enters into a perpetual tournament and gets ranked.
- ihodes 16y agoI just noticed that your git repo hasn't been updated since late 2009–are their updates to this project that just haven't been posted yet? Perrrrhaps with additional comments that might make it easier if one wanted to contribute? > ladder-server, too, where you submit your tribe and it > enters into a perpetual tournament and gets ranked That would be too cool. I'd love to see this happen. I wonder what kind of market there is for something like this. EDIT: I'm going to be looking through the code more today, though right now I am going through finals at college. I don't want to promise anything, but this is something I could see myself contributing to, if you'd want (though now might not be the time so early in the process). Shoot me an email (in profile), if you'd like to be in touch.
- phreeza 16y agoThe code I have in github is pretty much identical to what I describe in the article. Documentation is nonexistent, sorry for that. That was the first thing that came to mind when I saw that this hit the front page, should have thought of that earlier. I'll go through and comment it though, this resonance has given me a big boost in motivation.
- pjdavis 16y agoWhy stop at a ladder-based tournament system? It would be awesome if we could have all submissions put into a persistant world and go on until they all die out. Kind of like a mmorpg for AI robots.
- moconnor 16y agoThis is what I thought the article was when reading the title. It totally should be; how hard could it be to hack something together and run it on appengine?
- natep 16y agoI also think this project is really interesting (which is why I'm following it and some of the forks). May I recommend Microsoft's TrueSkill algorithm for ranking genomes? There's C#[1] and Java[2] implementations available. Full disclosure, I have no association with Microsoft Research, but I am the author of JSkills. [1] github.com/moserware/skills [2] github.com/nsp/jskills
- natep 16y agoEDIT (because for some reason my only option is reply): The other cool thing about TrueSkill is that it can handle multiple players on multiple teams. So, if anyone decides to add the capability for 1v1v1, 1v2, 1v1v2, etc, TrueSkill is ready.
- philh 16y agoI'd certainly be interested in playing this, especially online. I'm envisioning a system where you upload your genome, and the system automatically puts it in battles against a random selection of others. Some sort of ranking algorithm is used to create a leaderboard. You can also choose to watch a battle between any two or more genomes you like. To avoid gaming the scoreboard that would probably need to not count towards their score, or only once a day or something. >As a side note, it seems to me that (unless cells can be aware of their comrades' positions) global position needs to be availible in order to build walls, which is damn cool. I don't think so. All global position tells you is "how far away are the boundaries of the map?" Unless there's something I'm missing, you can get everything else just by keeping track of "offset from where I started". As another side note, restricting messages to integers seems pointless, since arbitrary information can be uniquely encoded as an integer given enough ingenuity. It's a problem that would get solved once and then just irritates people instead of actually constraining solutions. (I assume python integers are only bounded by available memory space.) Limiting them to n-bit integers, where n = 4 or 8 for example, would be more pointful, but again I think it would probably only make a particular behaviour harder to implement, not significantly limit the set of behaviours that are possible to implement.
- phreeza 16y agoA way I thought might be feasible is having the actual games run on servers and then dump the game logs in a simple format, so they can be played back with either the original game or any kind of player people come up with, eg browser-based. Concerning the integer vs bit, that was what I meant, was still thinking in terms of C ints. An even more extreme version would be to force the agents to store their state in a similar manner, but I think that would be taking it too far.
- wtallis 16y agoI'd rather see communication restricted to nearby cells, but possibly a way to leave messages in place (like ants do with pheromones). This would require cells to be a bit more autonomous, and would prevent information from propagating instantaneously. As we can see from real-world ants, this doesn't preclude cooperation, but does make it a bit harder.
- stcredzero 16y agoIt'd be fun to compete in a Lisp vs Python—maybe one language would lend itself to a certain kind of tribe. Lisp vs. Python would be most interesting if cells could pass arbitrary information to each other. This would make it easy for Lisp cells to modify their own code. Cells signalling each other and querying each other's information would enable interesting interactions. Some sort of sand boxing would seem to be desirable.
- jemfinch 16y ago1. Cells can pass arbitrary information to each other. 2. Python cells could modify their own code just as easily (if not easier) than Lisp cells.
- Raphael_Amiard 16y ago> 2. Python cells could modify their own code just as easily (if not easier) than Lisp cells. I'm not expert on the topic, but what do you mean by easier ? By using eval ? Is it really easier than altering an expression tree stored in a list ?
- jemfinch 16y agoShow me how you would write self-modifying code in Lisp and I'll be happy to show you the analog. Replacing functions at runtime in Python is just as easy as replacing them at runtime in Lisp.
- ErrantX 16y agoAh, you might be setting yourself up for a fall there :) one of Lisp's key elements if the ability to be self modifying (a large amount of Lisp code you will see is self-modifying) to an extraordinary degree. Python doesn't even begin to match it's abilities in this arena. (intro: http://www.fact-index.com/s/se/self_modifying_code.html http://www.fact-index.com/s/se/self_modifying_code.html)
- deleted 16y ago[deleted]
- sidmitra 16y agoFor people who like this, i would point you to the first such game i played - http://www.corewars.org/ http://www.corewars.org/
- mustpax 16y agoReally cool. This reminds me of a different "2 algorithms enter 1 algorithm leaves" type game: http://en.wikipedia.org/wiki/Core_War http://en.wikipedia.org/wiki/Core_War . Interestingly, Core Wars is from the age of multiple threads running on a single processor, sharing memory, whereas the more recent Cells represents a share-nothing distributed system with autonomous agents.
- stcredzero 16y agoMessing around with Core Wars is a great way to ease into Assembly Language!
- steveklabnik 16y agoI had lots of fun using a variation of Core War called "FukYorBrane," which used Brainfuck with a few extra instructions. Each program's input tape is the other's output tape. Tons of fun. http://esoteric.voxelperfect.net/wiki/FukYorBrane http://esoteric.voxelperfect.net/wiki/FukYorBrane
- gometro33 16y agoSounds like a good game to test out with Intel's new "Knights Corner" chip! http://news.ycombinator.com/item?id=1395513 http://news.ycombinator.com/item?id=1395513 One cell per core? Ah, the future...
- jayro 16y agoWow, this is very similar to the game idea I describe in Techzing 40 – AppIgnite Revealed: http://techzinglive.com/?p=194 http://techzinglive.com/?p=194.
- NathanKP 16y agoI'd really like to see a video of this game in action.
- gsmaverick 16y agoJust download the repo and run it.
- phreeza 16y agoGood idea actually, I'll make one and include it with the next post. It is really quite fun to watch. In the mean time, just pull it from github and give it a spin.
- icefox 16y agohttp://www.youtube.com/watch?v=Zy_-4rRmOCc http://www.youtube.com/watch?v=Zy_-4rRmOCc
- chuhnk 16y agoI am interested in this game simply to learn python. It's always the projects that inspire and excite you in which you make the greatest gains.
- phreeza 16y agoIt would be a good way to do that, I'm sure. I actually learned some of my early programming on a programming game called AT-Bots, where you had to write some kind of assembler-like code.
- Sthorpe 16y agoI have dreamt about this for years. I want to rent out a big warehouse and get a bunch of artists and programmers together to create/play a game like this. And then everyone just watches (like a movie) at the end. I would WAY rather do this than go to a movie or play videogames. I mean think of all the programming you would learn and get good at. After playing video games I just feel tired and my fingers hurt. Let me know if anyone wants to help me organize something like this.
- CWuestefeld 16y agoA zillion years ago (in development years) when MS's .Net platform was new, there was a platform called Terrarium [1] that was a bit like this. One key difference was that there was not an explicit means of communication between bots, so developers figured out a way to semaphore messages by way of simple movement behavior. As I searched for a link, I discovered that there's a newer version out just 2 years ago. [2] [1] http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=323 http://www.devhood.com/tutorials/tutorial_details.aspx?tutor... [2] http://terrarium2.codeplex.com/ http://terrarium2.codeplex.com/
- mclin 16y agore: communicating through movement, don't ants and bees actually do this? It would be cool if you could drop pheremone trails too. I'm thinking like a programmable Sim Ant
- tel 16y agoThere are the infamous bee dances, if that counts.
- SIGSEGV 16y ago>It would be cool if you could drop pheremone trails too. I'm thinking like a programmable Sim Ant That's what ICFP 2004 was. Here's the specification, if you want ideas: http://alliance.seas.upenn.edu/~plclub/cgi-bin/contest/ants.html http://alliance.seas.upenn.edu/~plclub/cgi-bin/contest/ants.... http://alliance.seas.upenn.edu/~plclub/cgi-bin/contest/index.php http://alliance.seas.upenn.edu/~plclub/cgi-bin/contest/index...
- swolchok 16y agoLooks like very little attention has been paid to performance in favor of praying that psyco works on the player's system. I'm avoiding work and I've forked the project, so watch for a series of little perf tweaks. A few specific complaints: Why are you using accessor methods? If it's because you might want to change them later, you could just use a property if that unlikely event happens. There is a real cost to accessors in Python. They also add a lot of visual noise. Why did you make an enum class (ActionType)? That adds an extra hash table lookup for not much benefit over ACT_SPAWN, ACT_MOVE, ACT_EAT, ACT_ATTACK, ACT_LIFT, ACT_DROP = range(6) EDIT: the performance seems fine the way it is now. I made some changes but they didn't perceptibly change the way the game plays. I am grouchy today because I didn't get enough sleep. Sorry.
- phreeza 16y agoThanks a lot for your comments! Looking forward a lot to your tweeks, performance will definitely need to be optimized in the future. The problem I was trying to adress with the accessors and the whole *View concept is that there are no private members in python, and i was trying to prevent the minds/genomes from "cheating" by reading data they aren't allowed to. If you can think of a better way to do that, I'd love to hear from you.
- deleted 16y ago[deleted]
- deleted 16y ago[deleted]
- jerf 16y agoLast I knew, the official word is that there is no way to stop Python code from reading any particular value. Python can even crack into the values contained in closures if you know the right incantations. If you are looking to rigidly enforce that only accepted interfaces are being used to read data in the face of a hostile adversary writing the Python, I believe the current state-of-the-art is that it is impossible. If this is a core feature requirement, then as far as I know your only option is to change languages to something where you can rigidly sandbox. Your nearest option in programming space would be Perl and some variant of Safe (that's a CPAN module name). Otherwise, if you can live with a gentleman's agreement, you're fine. This may make the automatic-online-matchup really tricky, though.
- mquander 16y agoRecently, since SC2 beta hit, I've been mulling about the idea of a "programmable RTS" -- an RTS that allows you to preprogram unit AI in some fashion, and then plays in such a way that your programming really factors into the game. For example, maybe you have many little units, so that it's difficult to micro them separately, or maybe the battles operate very quickly, or your units have an unusually large amount of active abilities. After all, most of your APM in a game like Starcraft is going toward things that you could replace with a very small shell script. Although I can't argue with success, it's always felt silly to me that a big part of the game is just building enough intuition and reflex so that you can actually spare your mind to think about the interesting parts. If you can simplify the reflexive pieces at "game-time" while keeping them interesting in a different way, that might leave you with a game that's even deeper strategically. However, it would be a difficult exercise to make an RTS that was dynamic enough that some folks with a lot of spare time didn't just write "ultimate" AI for all the units that is close-enough-to-perfect, and distribute that to all lazy players. Perhaps one might establish limitations on the resources or length of scripts you can write, so that it's difficult to write a script that is simultaneously effective for strategy A and different strategy B, and you need to specialize your code based on your style of play.
- endgame 16y agoThis is not exactly what you're after, but it's interesting: http://code.google.com/p/bwapi/ http://code.google.com/p/bwapi/ . There's also a SC bot competition, which you can read about at http://eis.ucsc.edu/StarCraftAICompetition http://eis.ucsc.edu/StarCraftAICompetition
- JeffL 16y agoHere is a programmable RTS that is a lot of fun: http://www.hacker.org/bitbath/ http://www.hacker.org/bitbath/
- mquander 16y agoThat's really cool. Thanks.
- endtime 16y agoThis looks awesome...with the exception of "A", every single word in the title titillates me. Definitely plan to play. As an aside, to those of you who are interested in this sort of game AI, you might want to look at the growing (AI sub)field of General Game Playing. The idea is to write a basic game AI that can take in arbitrary rules, "think" about them a little, and then play the game against one or more opponents. The author of the played favored to win this year's championship, Turbo Turtle, has open-sourced his infrastructure on Google Code (ggp-base), which makes it orders of magnitude easier to participate. More info: http://games.stanford.edu http://games.stanford.edu, http://cs227b.stanford.edu http://cs227b.stanford.edu.
- gometro33 16y agoAn interesting way to keep people interested in the game (during a fight, that is) would be to allow players to update the AI on the fly. I'm thinking each player would submit an AI to start the game. At any point during the game players could "check-in" code (VCS-style) and cells created from that point on (via the splitting described in the article) would have this new code. Players would be allow, for instance, 2 check-ins per game. The upgraded cells would be represented by different shades of the player's color so that they could be kept track of. I see this being useful for times when a player drastically misuses his cells initially or for an entirely different style of play (a different bracket on the ladder server).
- gridspy 16y agoYou could try to put into the code the conditions that would cause you to change your strategy. Then when all those conditions are in place you send a signal to all cells to change strategy. Your code then looks at the strategy variable to see which code path to execute.
- JeanPierre 16y agoWell, considering the message-queue, it should be fully possible to make the cells into "animals" instead: They mate by randomly picking another cell's "genome", take 50-50 from each of the cells, and make this the basis for the new cell. It would sound like it would be smart to start off with the extremities. Say, start off with the same amount of 100% agressive and 100% defensive cells. They mate, get a 50/50-cell, which is partly both. If a combination of 10% agressive and 90% defensive is "the secret", then the cells will eventually all become that combination in the end. Now, the question's whether this is a tactical approach or not...
- jcl 16y agoIt might be fun if there were a way for humans to control a colony, so that humans could try to compete against purely algorithmic players.
- akkartik 16y agoRelated: http://github.com/ryanb/ruby-warrior http://github.com/ryanb/ruby-warrior I built a bot for it once: http://github.com/akkartik/brooks-ruby-warrior http://github.com/akkartik/brooks-ruby-warrior
- swolchok 16y agoI've developed an extremely aggressive AI that is able to wipe out mind1 in about a minute. It's based on mind2 but uses a better algorithm for exploration, and, when attacked, it calls for help rather excessively. http://github.com/swolchok/cells/blob/master/crawling_chaos.py http://github.com/swolchok/cells/blob/master/crawling_chaos.... EDIT: my fork also cleans up a couple real issues, including letting the game run properly when psyco's not installed and allowing the user to specify minds on the command-line (albeit in a hacky way).
- deleted 16y ago[deleted]
- swolchok 16y agoThe evolving chaos is able to take out the crawling chaos through improved colonization behavior and the possibility of developing several disparate strains. Haven't tried porting the fixed behaviors back to the crawling chaos and seeing if the "zerg rush" strategy is just better. http://github.com/swolchok/cells/blob/master/evolving_chaos.py http://github.com/swolchok/cells/blob/master/evolving_chaos....
- hermanthegerman 16y agoAre there python version issues ? On my 2.5, it says File "cells.py", line 205, in get_view next NameError: global name 'next' is not defined (had to patch the math.copysign() in the original version as well, as it only exists from 2.6 on) Edit: works with continue.
- swolchok 16y agoSorry, I think Perl crept into my brain.
- icefox 16y agoCouldn't resist giving it a try myself and created my own program 'ben'. It was a good excuse to learn Python. Ended up with a solution that does a good job and can usually (19/20 times) beat the ones in included in the repo. Pushed my program up on github: http://github.com/icefox/cells http://github.com/icefox/cells Here is a video (sorry using Quicktime which only grabs the whole screen and not a window) of evolving_chaos v.s. ben which is fun to watch http://www.youtube.com/watch?v=Zy_-4rRmOCc http://www.youtube.com/watch?v=Zy_-4rRmOCc
- cmelbye 16y agoHas anyone with a Mac been able to install pygame to run this? From what I'm reading, it seems like a complicated process. Could someone throw together a small guide?
- steadicat 16y agoI tried easy_install & pip, both failed. The installer from the PyGame web site is only for 10.5. Somebody should make a Homebrew recipe!
- banjiewen 16y agoTry following these instructions (if you're on Snow Leopard): http://superuser.com/questions/43531/installing-pygame-on-snow-leopards-system-python-2-6 http://superuser.com/questions/43531/installing-pygame-on-sn... Worked great for me.
- stevejohnson 16y agoI could try a pyglet port if anyone asks me really really nicely. I promise I have the chops.
- ihodes 16y agoI've spent an hour or so trying to get pygame working on OS 10.6. I'm using Python 2.6.1, though I've tried it with 2.5 and 3 as well. I've tried their binaries, their source (including using the SDL.Framework which was suggesting in the SuperUser link another commenter posted.) If someone would like to port this to something a little more usable, I'd be obliged. If not, I'll be spending a bit of late June doing that.
- cmelbye 16y agoThe superuser link worked perfectly for me. I wonder if we could do some sort of py2app type thing.
- ihodes 16y agoI'm looking into porting the whole graphically-related portion of the code into pure OpenGL, which should be just about as easy as it gets to ensure cross-platform/computer consistency.
- cakeface 16y agoWow I really like this game! My company occasionally does engineering challenges for fun and I'm going to recommend this for our next one. The last one we did was competing Robocode (http://robocode.sourceforge.net/ http://robocode.sourceforge.net/) bots. They're written in Java and the game has been around for a while. I'm thinking that this will be more fun as it is newer and so there's really room to get creative and have fun.
- dstorrs 16y agoOne suggestion: It would be great if cells could pass energy to an adjacent cell. This would make it possible to form energy pipeling / distribution systems within your team, and for teams to cooperate meaningfully instead of simply "fight / ignore". I think this would substantially enrich the game.
- ErrantX 16y agoAwesome addition; that would allow making support structures making it a lot more RTS-like!
- swolchok 16y agoIt's possible (albeit slowly and indirectly) if you have enough energy to spawn, because dead cells always drop 25 energy. (They take 50 energy from their creator and start with 25 energy, so spawning doesn't create extra.)
- SingAlong 16y agoI was wondering how the audience would take this. I'm so excited to see such a project on top of HN. I'm building a _geeky_ game too (not similar to this). What do you people think about such games being made commercially? (indie ofcourse)
- jules 16y agoRoboCom! The fun thing about RoboCom is that bots don't fight. Instead they write to each others memory, causing the other bot to run the program you want (like a virus). This results in very interesting strategies.
- prosa 16y agoPut your email in your profile! :) I bet I'm not the only one who's excited and would love to contact you about this!
- phreeza 16y agoDone! Edit: even better to contact me through github though.
- Alleyfield 16y agoSo... Basically "cells" is nothing more than a sophisticated version of John Convay's Game of Life? http://en.wikipedia.org/wiki/Conways_Game_of_Life http://en.wikipedia.org/wiki/Conways_Game_of_Life
- Alleyfield 16y agoWhy the down vote? Is someone trying to imply that Cells isn't a sophisticated version of the Game of Life? I might be blunt, but I'm not trying to be rude on purpose
- gloob 16y agoIs someone trying to imply that Cells isn't a sophisticated version of the Game of Life? Yes.
- phreeza 16y agoIt does take some inspiration from the game of life, but if you look closer, the similarity is more visual than anything else. The relation to and foraging simulations is a lot closer.
- mleonhard 16y agoThis is similar to a simulation I wrote 3 years ago, called Bluedogs. Bluedogs creates the genomes randomly. It's C++ and SDL and runs on Linux and Windows: http://tamale.net/bluedogs/ http://tamale.net/bluedogs/
- RiderOfGiraffes 16y agoSomeone could create a "King of the Hill" system, similar to the one here: http://www.gamerz.net/c++robots/ http://www.gamerz.net/c++robots/ I've got a robot "on the hill" and it's great fun.
- phreeza 16y agoI've created 2 mailing lists for people to keep in touch. http://groups.google.com/group/cells-game-users http://groups.google.com/group/cells-game-users http://groups.google.com/group/cells-game-devs http://groups.google.com/group/cells-game-devs
- jashmenn 16y agoI wonder how well this would work in real-time over the web. We could establish an API and let everyone hack in whatever language they please. Here is a short list of open-source MMO servers we could start with: http://www.reddwarfserver.org/ http://www.reddwarfserver.org/ http://opensimulator.org/wiki/Main_Page http://opensimulator.org/wiki/Main_Page http://www.next-gen.cc/ http://www.next-gen.cc/
- wilshire461 16y agoCool game but was it the intent to have an unlimited supply of food at each node? It seems like this could be abused quite badly.
- nfriedly 16y agoThis reminds me of MIT's BattleCode tournament - http://battlecode.mit.edu/ http://battlecode.mit.edu/