BulletScript: a scripting language for bullets, beams, bombs

A place for people with an interest in developing new shmups.
Post Reply
Odessi
Posts: 4
Joined: Sun Jan 10, 2010 9:10 pm

BulletScript: a scripting language for bullets, beams, bombs

Post by Odessi »

Hi all, I've posted a couple times around here but I thought I'd write something up about a scripting language I've developed aimed at shmup bullet patterns. You may have seen it at shmup-dev. It's written in C++, and you can get it here.

First off, have some videos: http://www.youtube.com/watch?v=2-aEbAYI4lE http://www.youtube.com/watch?v=GC8dGIxt0ZU

The language has been designed specifically with shmups in mind, and some of its features include:
- emitters can have several states, which they can move between. Each state can be used to represent a particular pattern.
- emitters can be grouped together by a controller and animated, turned on and off, etc, to model complex boss patterns easily.
- controllers can handle events passed to them by game code. This allows communication from the game to the bullet system.
- you can emit anything, it doesn't have to be bullets. Sound effects, beam weapons, enemies can all be emitted just as easily.
- once emitted, bullets can be controlled in a variety of ways, or you can control them entirely yourself, it's up to you.

Here's an example script:

Code: Select all

emitter Pattern
{
	// member variables
	totalTime = 0;

	// functions, used to control emitted bullets
	spin = function(time)
	{
		$angle += {90, time}; 	// increase angle by 90 over <time> seconds
		wait(time);		// wait for <time> seconds
		$speed -= {20, time - 1};	// decelerate
		wait(time - 1);
		
		// emit two more bullets from this bullet
		emitA bullet($angle + 30, $speed);
		emitA bullet($angle - 30, $speed);
	}

	// initial state
	stage1 = state
	{
		i = 0;
		while (i < 360) {
			emitA bullet(i, 100) : spin(2); // emit bullets using spin() to control
			i += 10;
		}

		wait(0.5);
		totalTime += 0.5;

		// go to next state after 10 seconds
		if (totalTime > 10) {
			totaltime = 0;
			goto stage2;
		}
	}

	stage2 = state
	{
		// fire a bullet at the player
		emitT bullet(Player_X, Player_Y, 300);
		
		wait(0.25);
		totalTime += 0.25;

		// go to next state after 10 seconds
		if (totalTime > 10) {
			totaltime = 0;
			goto stage1;
		}
	}
}
There's a lot more that can be done of course. I hope people find it useful!
Kaspal
Posts: 820
Joined: Tue Mar 01, 2005 2:53 pm
Location: Bogota, Colombia

Re: BulletScript: a scripting language for bullets, beams, bombs

Post by Kaspal »

thank you man!... love those videos... right now, i dont have enough time to try it out, but in a couple mnths, when i happen to finish the semester, i'm definitively gonna try it out, and see what i can come up with.
SuperPang wrote:Where DOJ rapes you, DFK grabs your boob then runs away.
Post Reply