Procedural music generation? - procedural-music

Anyone have good book / article recommendation for procedural generation of background music? (No vocals, just instruments).
I'm not interested in:
How do I generate the sound of a particular note on a particular instrument
I'm interested in:
How do I generate the melody / score for the music.
Thanks!
EDIT:
Thanks for the reference to Brian Eno. I'm definitely looking into the ambient/user can ignore type of music. I.e. think the background music of a game. It's there to provide some basic mood, but the focus is the game.

Sometime ago I ran into ChucK, which is a programming-language to generate music/sound/audio:
ChucK presents a new time-based, concurrent programming model that's highly precise and expressive (we call this strongly-timed), as well as dynamic control rates, and the ability to add and modify code on-the-fly. In addition, ChucK supports MIDI, OSC, HID device, and multi-channel audio. It's fun and easy to learn, and offers composers, researchers, and performers a powerful programming tool for building and experimenting with complex audio synthesis/analysis programs, and real-time interactive control.
I believe the end result can be converted into MIDI, which can then be converted into a score or sheet notation.
I don't know if this is what you're looking for. Hope this helps!
EDIT
After thinking about this a little longer, I think what you can possibly do (and this sounds a bit crazy) is write code that generates ChucK code. So define a set of rules for your music/score generation and then use that to create valid ChucK code. After you run the ChucK code, you can get a MIDI file which you can then convert into score/sheet-music.

The book "Computer Models of Musical Creativity" by David Cope should help you along with the theoretical side of computer-assisted composition, though you might want some music theory under your belt before you dive in.

If you are interested in procedural music check out the Condition30 site -- condition30.com
This music is all procedural.

If you're interested in an implementation of procedural music based on cellular automata in C#, you could grab the source code from http://proceduralmidi.codeplex.com/. A binary is also available.

Related

How can I implement an AI-driven conversation system?

I want to implement a conversation system into my RPG (trying to get advanced AI as possible). Conversation as in, the player types:
"Hi, I would like a beer"
and the bartender would respond with
"Coming right up"
and then hand the player a beer.
I've got some ideas and some things I'd like to try, but first I would like to look at what's already been done. But extensive Googling does not turn up anything, so I'm wondering: has this been done or is there research being done in it? (I know this is very complicated, but I'm willing to give it a shot.)
Sure it has. Have a look at the "Eliza" program and its descendants. There's also a Wiki article on chatterbots that might interest you. Have a look at AIML as a way to represent the rules you might use.
For an advanced design, look up the game "Façade". The game's site describes the technologies used and gives links to relevant papers. There was also recently an extensive article in Gamasutra about this, called Beyond Façade: Pattern Matching for Natural Language Applications.
You may also want to look into the Turing Test and it's relevant scientific following/conferences/publications to see what has been done in the humanizing of AI speech.

How to imitate a player in an online game

I'd like to write an application, which would imitate a player in an online game.
About the game: it is a strategy, where you can:
train your army (you have to have enough resources, then click on a unit, click train)
build buildings (mines, armories, houses,...)
attack enemies (select a unit, select an enemy, click attack)
transport resources between buildings
make researches (economics, military, technologic,...)
This is a simplified list and is just an example. Main thing is, that you have to do a lot of clicking, if you want to advance...
I allready have the 'navigational' part of the application (I used Watin library - http://watin.sourceforge.net/). That means, that I can use high level objects and manipulate them, for example:
Soldiers soldiers = Navigator.GetAllSoldiers();
soldiers.Move(someLocation);
Now I'd like to take the next step - write a kind of AI, which would simulate my gaming style. For this I have two ideas (and I don't like either of them):
login to the game and then follow a bunch of if statements in a loop (check if someone is attacking me, check if I can build something, check if I can attack somebody, loop)
design a kind of scripting language and write a compiler for it. This way I could write simple scripts and run them (Login(); CheckForAnAttack(); BuildSomething(); ...)
Any other ideas?
PS: some might take this as cheating and it probably is, but I look on this as a learning project and it will never be published or reselled.
A bunch of if statements is the best option if the strategy is not too complicated. However, this solution does not scale very well.
Making a scripting language (or, domain specific language as one would call that nowadays) does not buy you much. You are not going to have other people create AI agents are you? You can better use your programming language for that.
If the strategy gets more involved, you may want to look at Bayesian Belief Networks or Decision Graphs. These are good at looking for the best action in an uncertain environment in a structured and explicit way. If you google on these terms you'll find plenty of information and libraries to use.
Sounds like you want a finite state machine. I've used them to various degrees of success in coding bots. Depending on the game you're botting you could be better off coding an AI that learns, but it sounds like yours is simple enough not to need that complexity.
Don't make a new language, just make a library of functions you can call from your state machine.
Most strategy game AIs use a "hierarchical" approach, much in the same way you've already described: define relatively separate domains of action (i.e. deciding what to research is mostly independent from pathfinding), and then create an AI layer to handle just that domain. Then have a "top-level" AI layer that directs the intermediate layers to perform tasks.
How each of those intermediate layers work (and how your "general" layer works) can each determined separately. You might come up with something rather rigid and straightforward for the "What To Research" layer (based on your preferences), but you may need a more complicated approach for the "General" layer (which is likely directing and responding to inputs of the other layers).
Do you have the sourcecode behind the game? If not, it's going to be kind of hard tracing the positions of each CPU you're (your computer in your case) is battling against. You'll have to develop some sort of plugin that can do it because from the sound of it, you're dealing with some sort of RTS of some sort; That requires the evaluation of a lot of different position scenarios between a lot of different CPUs.
If you want to simulate your movements, you could trace your mouse using some WinAPI quite easily. You can also record your screen as you play (which probably won't help much, but might be of assistance if you're determined enough.).
To be brutally honest, what you're trying to do is damn near impossible for the type of game you're playing with. You didn't seem to think this through yet. Programming is a useful skill, but it's not magic.
Check out some stuff (if you can find any) on MIT Battlecode. It might be up your alley in terms of programming for this sort of thing.
First of all I must point out that this project(which only serves educational purposes), is too large for a single person to complete within a reasonable amount of time. But if you want the AI to imitate your personal playing style, another alternative that comes to mind are neural networks: You play the game a lot(really a lot) and record all moves you make and feed that data to such a network, and if all goes well, the AI should play roughly the same as you do. But I'm afraid this is just a third idea you won't like, because it would take a tremendeous amount of time to get it perfect.

Flexible library or server for board games (chess or others)?

I'm looking for a program or library that I could use for experimenting with board games (chess mostly, but not necessarily -- other similarly complex board games
are OK too). I'll test different game-playing algorithms.
This is what I need:
I'd like, if possible, to make my program play against
players like gnuchess and crafty, but also against itself
and against a human player;
It's OK if my player-program can communicate with the
"server" via TCP, but it would be even nicer if it had
a C interface (not C++, because then I'd have to write
a wrapper);
I may want to change the game rules (initial position of
pieces, number of pieces, and even movement rules);
Flexible (it's OK if the library/server validates
chess moves, for example, but I'd like such feature to be
optional because I will want to turn it off for some
experiments);
Free (I may want to get into the source code and maybe
change a few bits).
I'd be grateful if anyone could point me to such a library/server...
Thanks a lot!
P.S.: I wanted to include a "board-games" tag, but it seems that I'd need more reputation for that...
P.S. 2: I'd like to accept two answers (they're complementary). It's a pity StackOverflow doesn't allow that.
VASSAL is a cross-platform engine for playing board and card games over the internet. It is designed for allowing humans to play each other, but it is extensible enough you could add an AI player.
It is open-source and extremely customizable, people have created original games using it.
The XBoard protocol is the standard used between chess engines and graphic board front ends. It is plain text: as far as I can say there is no library.
Although seems complicated, the implementation is quite straightforward: a really small subset is needed in order to develop an usable application. The doc usually refers to the chess engine, but the same applies to the client side (reversing the side).
Hypothetically you can have the same connectivity of XBoard/Winboard, depending on how much protocol has been implemented. If you need some code to inspect, other than the classic Eboard and Xboard, there are a lot of examples around the web, and I mean really a lot of (it is a list of chess engines, but someone of them, such as babychess, is also a GUI frontend).
I'm not sure something like that exists yet.. by the way most of these topics are quite easy to develop by yourself:
vs player: just implement imput (you can use something simple like ncurses)
vs CPU: these games are called perfect information games and you can easily structure an AI with simple algorithms like minmax trees or negmax
to allow changing of rules it's more simple to hard code them (since every game could have its really different rules
for TCP support you should need to codify moves and separate GUI part from server part
If you are not going to test it with a large amount of different games projecting something really extendible (like an engine) will be a waste of time. Just concentrate on modifiable parts and program them wisely..
Actually some parts don't need to be generic: plan a good game protocol and then just care about events like unallowed move and similars..

Fuzzy logic membership function in C

I'm trying to implement a fuzzy logic membership function in C for a hobby robotics project but I'm not quite sure how to start.
I have inputs about objects near a point, such as distance or which directions are clear/obstructed, and I want to map how strongly these inputs belong to sets like very near, near, far, very far. Does anyone have a tip on how to start? Thanks.
Disclaimer: I've never implemented a fuzzy controller (I've only ever used PI or PID in real-life) and control class was 10 years ago.
Here's an presentation demonstrating moving towards a target using distance and angle for inputs and power as the output. FuzzyTech's Example positioning a crane
This just presents the topic and theory i.e. no code.
Best source is probably one of the robotics groups
e.g Seattle Robotic Society fuzzy logic tutorial it is technical ... and long.
if you can access technical journals then search Google scholar for "fuzzy logic" "path planning" robotics
if you're looking for some ideas on how to implement fuzzy logic then perhaps a Application Note from one of the microchip manufactures will get you started e.g Microchip's paper on Airflow control or servo control. I know it's not Arduino but Microchips papers are usually very clearly presented.
And finally an example in c++ its probably more complex than you're looking for. Free fuzzy logic library
Good luck.
I'm not expert with fuzzy logic, but according to my basic understanding, you could start by deciding what distances would constitute near (say 10 cm) far (say 1m), then you use probabilities to fill in the range in between (so 55cm might be 50% near, 50% far). Then you do something similar for your other properties, and combine the probabilities associated with each property with more probabilities.
Do you have a good reference for designing fuzzy controls?
I suppose you could start here. I think they at least describe simple fuzzification and defuzzification routines.
The guys at MakeProto have created an automatic code generator for Fuzzy Systems that outputs C code from Matlab fuzzy systems, or by a hand-defined fuzzy system.
Might be worth taking a look at.
http://makeproto.com/blog/?p=35
Fuzzy inference system can be implemented in both C and C++. Learn How to frame fuzzy logic in c

Best programming based games [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
Back when I was at school, I remember tinkering with a Mac game where you programmed little robots in a sort of pseudo-assembler language which could then battle each other. They could move themselves around the arena, look for opponents in different directions, and fire some sort of weapon. Pretty basic stuff, but I remember it quite fondly, even if I can't remember the name.
Are there any good modern day equivalents?
I used to have a lot of fun coding my own robot with Robocode in college.
It is Java based, the API is detailled and it's pretty easy to get a challenging robot up and running.
Here is an example :
public class MyFirstRobot extends Robot {
public void run() {
while (true) {
ahead(100);
turnGunRight(360);
back(100);
turnGunRight(360);
}
}
public void onScannedRobot(ScannedRobotEvent e) {
fire(1);
}
}
Just found Light Bot. Program your robot to move around and perform tasks to complete a puzzle. Even includes subroutines. Program the bot by dragging tiles into slots. The game is very polished.
Update Lightbot is now the most recent version of the game, and has versions specifically designed for kids ages 4-8 or ages 9+ (with no upper limit) and also features kind of an if
screen of lightbot 1 http://www.lostateminor.com/wp-content/uploads/2008/10/light-bot.jpg
I think the original game was called Core Wars (this Wikipedia article contains a lot of interesting links); there still seem to be programs and competitions around, for example at corewars.org. I never had the time to look into these games, but they seem like great fun.
In the flash game Manufactoria you "program" a factory by laying out the conveyor belts and switches in a way that's very similar to a FSM, but more powerful. This game is really great. Give it a try, especially if you're into formal languages and automata!
Manufactoria screen shot http://www.tomdalling.com/wp-content/uploads/manufactoria-bubble-sort.png
A game in which you have to graphically construct and train artificial neural networks in order to control a bug is Bug Brain.
Bug Brain screen shot http://www.infionline.net/~wtnewton/oldcomp/bugbrain.jpg
The game in question was definitely Robowar for the Mac. My son had a lot of fun with it and went on to program real robots.
As mentioned earlier by Proud, there is a wiki page for it:
http://en.wikipedia.org/wiki/RoboWar
Although there has not been a lot of activity surrounding the game over the last few years, there was a tournament held recently, and there is a yahoo email group.
If you want to step away from your keyboard, Wizards of the Coast relased a game called RoboRally that is a combative programming board game.
http://www.wizards.com/roborally/
http://www.pythonchallenge.com/
highly addictive, and a great way to learn python
I'm surprised that Space Chem isn't mentioned yet. Programming with symbols, but programming nevertheless.
http://spacechemthegame.com/
Another good one is CEEBot. It teaches C / Java style programming in a fun, robot-programming kind of game. It is aimed at 10-15 year olds, but it is a good one.
Colobot
It's usually easy for new programmers to pick up on languages like C++ when you have a strong understanding of Java basics. Colobot allows you to program automated craft using a language almost identical to Java and to move, sense, and manipulate their environment in order to accomplish missions on a dangerous planet.
I was also keen on these kind of games. One modern example which I have used is http://www.robotbattle.com/. There are various others - for example the ones listed at http://www.google.com/Top/Games/Video_Games/Simulation/Programming_Games/Robotics/
Core Wars is the classic, of course. But Rocky's Boots is another one. Imagine! There was a time (1982) when you could sell a commercial game based on logic gates!
If you are willing to look at single player games like Light Bot and Manufactoria then I highly recommend RoboZZle. It has conditional commands which include function calls. This allows for complex stack manipulation. There are thousands of user created puzzles from pathetically obvious to mind blowing enigmas. They have recently added support for smartphones.
I also think The Codex of Alchemical Engineering is worth a look.
I think .NET Terrarium is one of the best 'learn-to-program' games for the .NET platform.
I like Ruby Warrior. It is still somewhat under development, but it is a great game with a clever interface.
Core Wars
There's also mySQLgame, I found it pretty amusing (shortly after finding out I suck).
Here's what Casual Gameplay has to say about it.
Kara is about programming a bug(!) coming up in various versions, e.g. Finite State Machine, Java, Turing Machine, Multithreading
Kara http://www.swisseduc.ch/compscience/karatojava/kara/icons/kara-worldeditor.gif
Planetwars is a game specifically written for Google Ai Contest, bots are controlling fleets for conquering planets, they support many languages
I'd say the most famous programming game there has been is the core wars. I don't know if you can still find active "rings" although there was a lot when I tried it some time ago (4 or 5 years).
I've never heard or Core Wars before, but it looks interesting. I do have to vouch for RoboCode, though. That's fun and challenging, especially if you have a group of people competing against either other.
http://en.wikipedia.org/wiki/Hacker_(computer_game)
http://en.wikipedia.org/wiki/Hacker_2
There is also a great hacking game the name of which I simply cannot remember. Hrm.
Matt, I think the game you're referring to is CRobots (or one of its clones, perhaps -- my first contact was with PRobots, in Pascal, if I remember correctly). It was a lot of fun.
While it was more logic than programming per se, one I really enjoyed back in elementary school was Rocky's Boots. It had sensors, AND gates, OR gates, NOT gates, wires, timers, and all sorts of other stuff. Fantastic program for teaching a kid logic.
Go to the link and you can still play it!
Carnage Heart for PlayStation was fun. It would let you program little mechs to do battle using a flow diagram.
I have to give a shout out to RobotWar which was the first programming "game" that I played way back in the Apple II days. It was written by Silas Warner of Castle Wolfenstein fame.
I got myself addicted to uplink a few months ago. It's not really coding based, more hacking. It's still fun and super geeky.
Although not strictly programming-based, I enjoyed a lot Robot Odyssey, a game where you wired logic gates to sensors and motors in a robot, to make it move and react to environment, to get out of a city, escaping obstacles. I played in on Apple //e, it was one of the best games on this computer (with Lode Runner! :-)).
You must be thinking of RoboWar. Oh how lovely it is.
Still exists, though the community is slowly dying.
http://robowar.sourceforge.net/RoboWar5/index.html
http://tech.groups.yahoo.com/group/robowar/

Resources