The Nightstar Zoo

Nightstar IRC Network - irc.nightstar.net
It is currently Wed Nov 22, 2017 3:06 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 16 posts ] 
Author Message
PostPosted: Sat Sep 10, 2005 4:29 pm 
Offline
Nightstar Graveyard Daemon
User avatar

Joined: Mon Jun 03, 2002 8:30 pm
Posts: 1071
Location: Wouldn't you rather observe my Velocity?
So I've been thinking about writing a Board Game Construction Set. It's a pretty insane idea, essentially I want to write a framework for playing board games. The graphical portion is trivial: display the tableaux and pieces, etc. Even defining where the movement squares are and where the decks and discard piles are is simple: about as complex as building an HTML image map. The insane part is coming up with a "rules language" by which a game designer can describe how a game is to be played.

I make no distinction between "card" games and "board" games; card games are simply board games where the board layout is so simple you can visualize it on a tabletop. With a properly constructed BGCS, it should be possible to create games like Monopoly, Poker, Risk, or Chess. It should even be possible to create a game like Magic: The Gathering (MTG).

My suspicion is that custom components of each game can be written in a scripting language such as Ruby, and then the rules can be written out in a general format. If a game has a custom rule, code can be written to enable that rule, then the rule language can manipulate that rule. For example, consider the notion of "tapped" cards in MTG. The MTG cards could simply have a boolean state added to them called "tapped", and the card draw code could rotate the card in position on the table whenever it is tapped. The custom code could then define a "tap" command which can be enabled by the card if it has a tap rule.

Board games have a lot of common components: pieces, cards, tokens, dice, money. Dice are pretty straightforward. Cards are pretty complicated but in the end have some common actions and collections. Cards can be played, drawn, discarded, and in some games removed from play, but in the end you really just have decks and tableaus: draw piles, discard piles, "graveyards" and "removed from play" are just decks. Hands are decks that can be viewed and sorted by a player, while other players can see only how many cards are in that hand. Tableaus are areas on the table where cards can be placed, face up or face down, and either the custom code or the rules determine how they affect play.

Board games have a lot of common rules: how many can play, how to set up, how to determine play order and who goes first, steps that must be performed during your turn, and the conditions that end the game and determine the winner.

The rules language must either be aware of the objects in the game or be able to declare them outright. For example, a checkers game the language would probably just be aware that there are black and red pieces and black and red kings, while the rules language for Monopoly might start out aware of the concept of a "player token", but extend it to create the Shoe, the Terrier, the Plane, the Car, etc.

MTG would need both. Special rules for the core game would add properties like Banding and Flying, and actions like Tap/Untap, Attack, and Interrupt. Special rules for expansions would add new abilities like Rage and Shadow. But the rules language itself would also be taxed to the limit, defining the abilities and rules associated with each card in the deck.

The problem, then, is how to specify the rules language. Ideally I'd like something that looks close enough to English to be written by non-programmers. The idea being that once rules were written for MTG, a card designer should be able to create new cards by adding the card stats (color, type, power, life, casting cost, image file, flavor text) and then adding the rules for that card. In a VERY ideal situation, the rules language for the card would actually be readable by the game players.

In my head I keep envisioning simple rules like "Tap: Do 1 damage to target creature" where the engine has been customized to understand "Tap:" enables the tap command, "target creature" starts the "select_target_creature" code, and "Do ([\d]+) damage" invokes the damage code for that creature, allows players to Interrupt the action or play an Instant, then checks the target creature for the death condition.

knows that "Tap:" means "Add the command 'Tap' to the card UI" but the sentence "Do 1 damage to target creature" ALSO gets parsed out so that "target creature" invokes the UI code to select a creature in play, and "Do 1 damage" gets parsed out by the damage code (defender allowed to play an interrupt, card must be evaluated for death condition). Or more internal rules like "Creature: on death: place card in graveyard" or "White deck: draw: place top card in hand".

The more I think about this the more I think that making a generic rule language is NP-holycrap. Perhaps I should just be content to write a framework in the code, and then code rules for that game in the code?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 10, 2005 5:13 pm 
Offline
Energizer Bunny
User avatar

Joined: Wed May 22, 2002 12:24 am
Posts: 1634
there's something out there like this: look up Zillions of Games.

Vorn


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 10, 2005 6:01 pm 
Offline
Nightstar Graveyard Daemon
User avatar

Joined: Mon Jun 03, 2002 8:30 pm
Posts: 1071
Location: Wouldn't you rather observe my Velocity?
Well, poop. Nothing kills my motivation for a new idea like knowing it ain't a new idea. :-)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 10, 2005 11:07 pm 
Vorn beat me to it.

Zillions even has an AI that can adapt to whatever ruleset a game has. The AI is really geared towards pure strategy games, though, and kinda bites at anything involving chance. It's an impressive feat nonetheless.


Top
  
 
 Post subject:
PostPosted: Sun Sep 11, 2005 9:33 am 
However, Zillions only works for board games. You could write a Card Game Construction Set and still be original. :)


Top
  
 
 Post subject:
PostPosted: Sun Sep 11, 2005 5:29 pm 
SomebodyElse wrote:
However, Zillions only works for board games. You could write a Card Game Construction Set and still be original. :)


It can work for card games too. It'd take a bit of work, but all the tools are there.


Top
  
 
PostPosted: Sun Sep 11, 2005 10:29 pm 
Offline
Entertainment
Entertainment
User avatar

Joined: Sat May 11, 2002 7:55 pm
Posts: 867
Location: 59°20'N 18°03'E
Chalain wrote:
Ideally I'd like something that looks close enough to English to be written by non-programmers.

... which would inevitably make it frustrating to programmers. See also: AppleScript.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 12, 2005 3:25 am 
Offline
Concession Worker
Concession Worker
User avatar

Joined: Tue Jul 01, 2003 5:26 pm
Posts: 1479
Location: R'lyeh
SomebodyElse wrote:
However, Zillions only works for board games. You could write a Card Game Construction Set and still be original. :)

There's supposed to be at least one of those as well (although possibly with limited functionality (like Magic-style games only or suchlike)), and I know one person who is currently making his own. :)

_________________
Living in a state free from the burdens of privacy and democracy since 2008-06-18.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 12, 2005 8:25 am 
gwalla wrote:
SomebodyElse wrote:
However, Zillions only works for board games. You could write a Card Game Construction Set and still be original. :)


It can work for card games too. It'd take a bit of work, but all the tools are there.


Wikipedia wrote:
Zillions Of Games is designed to play perfect information games exclusively. This renders it of little or no use in fairly playing imperfect or hidden information games, such as card games. Instead, the program will automatically use all information available to itself, including the cards in the deck and the cards in the hands of all other players.


The Wikipedia article didn't mention this, but it is trivially easy for human players to get the above information as well.


Top
  
 
 Post subject:
PostPosted: Thu Oct 13, 2005 10:30 pm 
Offline
Intern
Intern
User avatar

Joined: Sun May 12, 2002 12:18 am
Posts: 1134
Location: Idaho
There are many solitaire games that allow the user to create new games as well as edit the ones already set up.

Games with lots of rules and modifiers can be a quite a pain. The biggest thing I've ever done was a character generator for a Marvel Superheroes RPG in TI Extended BASIC, sometime in the early 1990's. It wasn't especially hard, just very tedious. But it sure saved time generating characters! It could spit out the stats to screen as fast as the Enter key could be hit. (Of course printing took longer...)

_________________
Fandemonium!
August 1st, 2nd, 3rd, 2014

"I am a machine. I am a weapon of war. I am a destroyer of life in the service of life, the sword and shield of my human creators." Bolo Invincibilus, Mark XXIII, Model B (Experimental) 0075-NKE "Nike".


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 19, 2005 2:14 pm 
Offline
Nightstar Graveyard Daemon
User avatar

Joined: Mon Jun 03, 2002 8:30 pm
Posts: 1071
Location: Wouldn't you rather observe my Velocity?
bizzybody wrote:
TI Extended BASIC, sometime in the early 1990's.


Oh MAN, that takes me back. My first computer was a TI-99/4A. I remember BEGGING my parents for it because IT HAS BASIC BUILT IN!!!!

Ohhhh, the memories.
Code:
100 REM THIS MEANS I HAD THE EXPANDED BASIC CARTRIDGE YES OH YES
110 REM $DYNAMIC

I spent dozens of hours just playing with "beat frequencies" with the 4-voice FM chip. I'd play one tone at 100Hz and another at 101Hz and listen to it go waaaAAAaaaAAAaaaAAAaaah....

If you played 100, 101, and -1, it sounded like spaceship engines. (Frequencies -1 through -4 were "white noise" sounds.)

* dodders off, happily lost in thought...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 19, 2005 9:04 pm 
Chalain wrote:
I spent dozens of hours just playing with "beat frequencies" with the 4-voice FM chip. I'd play one tone at 100Hz and another at 101Hz and listen to it go waaaAAAaaaAAAaaaAAAaaah....

If you played 100, 101, and -1, it sounded like spaceship engines. (Frequencies -1 through -4 were "white noise" sounds.)

* dodders off, happily lost in thought...


It's pretty easy to play with the sound on Linux, it's just a file.

eg for while noise: "cat /dev/urandom > /dev/dsp".

Turn down the volume before you do this.

At some point they added support for multiple voices, not sure if the kernel mixes the streams or if it's done in hardware... but I don't really care.


Top
  
 
 Post subject:
PostPosted: Fri Oct 21, 2005 10:36 am 
Offline
Safari Exhibit
Safari Exhibit
User avatar

Joined: Mon Feb 07, 2005 3:48 am
Posts: 151
Location: Durban, South Africa
Chalain wrote:
I spent dozens of hours just playing with "beat frequencies" with the 4-voice FM chip. I'd play one tone at 100Hz and another at 101Hz and listen to it go waaaAAAaaaAAAaaaAAAaaah....

If you played 100, 101, and -1, it sounded like spaceship engines. (Frequencies -1 through -4 were "white noise" sounds.)

* dodders off, happily lost in thought...


I did something similar on my old C64. Then I discovered a synthesiser listing in an old magazine and messed with that. It allowed you to specify attack, decay, sustain and release for the waveform so you could get all sorts of different "instruments".

Fun stuff, that.

anthonyr wrote:
At some point they added support for multiple voices, not sure if the kernel mixes the streams or if it's done in hardware... but I don't really care.


Since you don't care, I'll answer you. AFAICT, ALSA has always supported multiple streams when the hardware did. Recently, though, it also supports driver-level mixing by default. I know this because I was finally able to bury esound at a crossroads with a stake through its heart.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 21, 2005 10:48 am 
jerith wrote:
I spent dozens of hours just playing with "beat Since you don't care, I'll answer you. AFAICT, ALSA has always supported multiple streams when the hardware did. Recently, though, it also supports driver-level mixing by default. I know this because I was finally able to bury esound at a crossroads with a stake through its heart.


Well, whatever it is it started working without me doing anything in particular. I discovered it completely by accident. AC97 doesn't support multiple voices?

Not really surprising, that...


Last edited by anthonyr on Fri Oct 21, 2005 12:20 pm, edited 1 time in total.

Top
  
 
 Post subject:
PostPosted: Fri Oct 21, 2005 10:58 am 
Offline
Safari Exhibit
Safari Exhibit
User avatar

Joined: Mon Feb 07, 2005 3:48 am
Posts: 151
Location: Durban, South Africa
anthonyr wrote:
Well, whatever it is it started working without me doing anything in particular. I discovered it completely by accident. AC97 doesn't support multiple voices?

Not really surprising, that...


Apparently so. I recall a box with a proper sound card (SB PCI128) working fine but AC97 threw a "can't open audio device" error. Perhaps the problem's in the AC97 drivers? IIRC they're reverse-engineered due to lack of specs, as with so much hardware these days.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 21, 2005 12:28 pm 
jerith wrote:
Apparently so. I recall a box with a proper sound card (SB PCI128) working fine but AC97 threw a "can't open audio device" error. Perhaps the problem's in the AC97 drivers? IIRC they're reverse-engineered due to lack of specs, as with so much hardware these days.


Isn't AC97 a standard that many vendors implement?

Well, however they did it I only care that it works. I guess driver-level mixing will take a bit more CPU, but artsd takes CPU as well and has a lot more overhead. And it's an Athlon64, they don't make Athlon64s slow enough for it to matter...


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group