00:00
00:00
Newgrounds Background Image Theme

Static73 just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

++ As Wars 2007

24,492 Views | 502 Replies
New Topic Respond to this Topic

++ As Wars 2007 2007-01-03 11:41:28


AS Wars 2007

Game Description:
You have 72 hours or so to create an autonomous (automatically moving and functioning movieclip), which must destroy the other movieclips on stage using movement, shooting, healing, mining, and reloading functions. The code is actually very simple to code since the backend is all done, so if you are a beginning actionscripter, you can easily participate. However, if you are a long time developer, you’ll also have an interesting time creating a clip that can fight in the AS Arena and hopefully win the 2007 AS Wars Battle #1.

If you have participated in the previous AS Wars last year, this game is similar. Check the rules for more info. As you may already know, I am a compulsive writer, so I hope I can cover most of the rules here. Don't be scared of the large amounts of code, take a look at the template file and see how simple it is.

Deadline:
11:59 PM EST Friday, January 5. Your bot must be tested and functional by this date, no exceptions.

Submission:
Email me the FLA (NOT SWF!!!) of your bot. jmtb02@gmail.com. PM works too.

Prize:
I will ship a NG Tshirt to the winner.

Gameplay:
Four bots will compete during each competition, starting out at each of the four corners of the arena. Every frame, your bot will have an option for what it wants to execute. It may only execute a single (ONE) action every frame (don't confuse this with lines of code, it may take several lines of code to execute the action you like). The five actions you may execute are:

Move (option = 1)
Shoot (option = )
Reload (option = 3)
Heal (option = 4)
Mine (option = 5)

To tell the file that you are going to be using one of these commands, you must set the option variable of your bot to that number. For example:

option = 1;

Bots Design
Each player will design their own bot. Each bot must follow these guidelines:
*Size: 30x30 pixels exactly, square.
*Coloring: You must draw a unique style on your bot in order to compete. Get a good artist to draw something awesome if you can, because we know that Actionscripters can’t draw worth shit.
*Symbol Type: Movieclip with the name of your screen name. No more than 10 characters, letter and numbers only, no spaces. InstanceName must be the same as the symbol name.
*Arena: The arena is 600x600 pixels, and is completely empty except for the bots that are competing. The actual movie stage size is 700x600, so using Stage.width is not advised.
*Battle Style: Free-for-all, every bot will be fighting each other. No allies.
*Weapons: Weapons are generated for you. You get 20 bullets and 4 mines. You can reload bullets but not mines.

Template Files
Flash 8 | Flash 7
Please look at the tutorial file. A lot of this will make sense once you take a look at the code. This template may be updated if errors are found, so stick around the thread for few days. You MUST use the template file.

Quick Script Reference
This reference was built in case you want to just get right to building, the longer rules are expanded in the Expanded Reference Guide (below).

----Variables you can reference but not modify
_root.bullets[] = An array containing all the live bullets.
_root.livebots[] = An array containing all the live bots.
_root.mines[] = An array containing all the mines, both active and not.
life = A Number for the amount of life you have left.
mines = A Number for the amount of mines left
shots = A Number for the amount of shots you have left

----Variables you can alter
option = A Number specifying what action you will take this frame
moveX = A range of -2 to 2 that you can move in the X direction if you choose to move
moveY = A range of -2 to 2 that you can move in the Y direction if you choose to move
shotAngle = The angle, in degrees, you shoot if you choose to shoot

----Options
option = 1; //Move
option = 2; //Shoot
option = 3; //Reload
option = 4; //Heal
option = 5; //Mine

----Symbol Naming Scheme
Bullets = All named "bullet"+bulletNumber.
Bots = All named as loaded on screen.
Mines = All named "mine"+mineNumber.

Expanded Reference Guide
This guide is to further explain all these variables and options you may use in battle.

*Movement:
option = 1;

The movement option will move your bot around the arena. You may move anywhere within the 600x600 fighting area, and if you try to move off, you will automatically be blocked. You can set how far your clip will move with these two variables:

moveX = 2;
move Y = -2;

The range of both of these values is between 2 and -2. You can use decimals if you like, but be warned that your movement option will not execute if your value is outside of the range of 2 to -2.

*Shooting:
option = 2;

The shoot option will shoot a bullet (10 px long) at a velocity of 8 px a frame, and will last 80 frames or so. A player has 20 shots before having to reload. If a bullet hits a player, it will be removed from the game and will cause the player 5 damage (player has a 100). If a bullet is shot but the player has no more shots, the shot will not execute and the player will lose their action for the frame. To set the angle of the shot, use:

shotAngle = 250; //in degrees

*Reload:
option = 3;

The reload option will recover 1 bullet. If the player is at 20 shots, the player will not recover anymore and their action will be lost for the frame.

*Healing:
option = 4;

The heal option will recover 1 point of damage. If the player is at 100 life, it will not increase.

*Mine:
option = 5;

The mine option will lay a mine on the stage. A player gets 4 mines per game, and may not recover them. The mine is inactive for 50 frames, and then can cause damage to any player, including the player that placed it. A mine causes 25 damage.

Variable Descriptions/Reservations:
There are several important codes you may or may not use in your bot development.

*Bot Variables
These are variables reserved for your own bot. You cannot edit them, but you can use them to determine important information.
life = the number of life points you have left. At 0 life, your bot will be removed from the game. The maximum is 100.
mines = the number of mines you have left.
shots = the number of shots you have left. You get a maximum of 20 in stock before reloading.

These you can edit, however...
moveX = the distance X you will be moving if you use the move option.
moveY = the distance Y you will be moving if you use the move option.
option = the number specifing what action you will take.

*Bullet Names
Every bullet in the game will be named "bullet"+bulletNumber. For example...
bullet0
bullet1
bullet59
bullet120

The maximum bullet number at any given time will be 200. Every bullet that exists will be stored in the array _root.bullets[]. For example...
_root.bullets[0,1,59,120];

Once a bullet is removed, it's name become's available for the next bullet to be loaded. Each bot shares the same array and names of bullets, and are all located on the stage. The way bullets are loaded are complex and silly to try to make you better utilize the array and not individually code bullet checking one-by-one.

*Bot Names
Each bot is automatically added when it appears on the stage, and is stored in the array liveBots. For example, when the game loads, if there are four bots...

liveBots[botnum1, botbot2, botsome3, bot4].

When a bot dies, the name will be removed from the array.

*Mine Names
Mines exist like the bullet system, "mine" + mineNumber. For example..

mine0
mine1

All mines are stored within the _root.mines[] array, as...

_root.mines[0,1].


Hi there!

BBS Signature

Response to ++ As Wars 2007 2007-01-03 11:41:49


Special Coding Rules
*The following are allowed:
-if, for, while, and other loop statements. As long as they are not stupidly process intensive. If I find some neverending for loop, I will return your bot to you with a sad face :(.
-Your own variables. Make sure they are not _root. and exist on your own bot.

*The following are restricted:
-random() or Math.random() codes. The entire swf file, when exported, should result in the same battle every time. Any code that will somehow change the outcome between battles will result in your bot being returned.
-_root or _parent variables. Do not use variables outside what is on your clip. Do not modify other people's bot's variables as well.
-Modifying any variable you did not create. If you modify this code, you will have your bot returned.
-Modifying any function you did not create. If you modify this code, you will have your bot returned.
-Modifying anything you did not create. If you modify anything such as other bots, arena, etc., your bot will be returned.
-Triggering options without using the option variable.
-Modifying name, rotation, graphics of your or any bot on the stage.
-Loading anything onto the stage via attachMovie();
-Using any API drawing tools to draw on the stage.
-Animating your movieclip. Your clip should be a single frame that constrains to the 30x30 pixel area.
-Removing or deleting the contents of any movieclips.

Rankings and Tournament Ladders:
Every battle will be a free-for-all, with four bots per battle. The last two bots left from each battle will be allowed to move on to the next round. The final battle will result in the last four bots left, resulting in one final bot remaining the winner. The winner will win the final prize.

FAQ's:

Q: Where are the bots, bullets, and everything else in the game going to be located?
A: They are all on the stage. Yes, they are on the _root. level. So if you reference them in your code as bullet0._x instead of _root.bullet0._x, you are going to be in trouble.

Q: Can I move at increments that are not whole numbers (aka, movement(1.5,-1.222))?
A: If you really want, but remember, your movement must between 2 and -2 in either the x or y direction.

Q: What if my bot hits another bot?
A: They will run over each other, unless you code it otherwise. It's hard to determine who gets to push who or who gets to move first in the execution of frame codes, so I didn't want to have pushing or stopping rules for bots. So there might be some bot-on-bot action.

Q: How will I know what corner I'm starting in?
A: You will start in a random corner each round, which I will situate randomly before each code battle starts.

Q: Can I work with another developer?
A: If you really want to, but it might be more fun to just develop on your own.

Q: Can I submit more than one bot?
A: No. I can't let people submit multiple bots for multiple changes to win.

Q: What if there are multiple bots left on the stage, running stupid codes that never determine a winner?
A: If there are 2 or less, it won't really make a difference, unless its the final match. If there are 3 or more, the bots will be situated in different corners and ran again. We'll keep going until someone wins.

Q: What if my bot does not meet the rules?
A: Your bot will be returned to you with an explanation as to why it's not going to fly.

Q: Can I change my bot after the deadline or between games?
A: Nope. Your bot will be the same bot for every single match.

Q: How will our first matches be determined?
A: Randomly outside the system. I'll basically generate a random match for everyone.

Q: I want to be with my friend in the first match. Can you do that for me?
A: No, because it might result in people specifcally targetting friend's bots, or helping each other to win. Sorry.

Q: Will there be a single megamatch like last year, with every single bot present?
A: Sure, why not. Look for it after the final match.

Q: When will the first match happen?
A: Monday, January 8. All the first matches will happen this day. The second round matches start the next day, and will continue on until there is a winner.

Q: Can I submit this game as a submission on Newgrounds?
A: No, it's not going to be submitted as submissions on Newgrounds.

Q: I sense cheating. How do I report?
A: Email me at jmtb02@gmail.com, or PM me at jmtb02.

Q: Why so many rules?
A: So I don't have to answer a bunch of questions. With a 72 hour deadline, I don't want people feeling bad with unanswered questions. But if you do have some questions, post them here or contact me personally by PM, at jmtb02.

Any questions?


Hi there!

BBS Signature

Response to ++ As Wars 2007 2007-01-03 11:42:46


They're here!!! I'm in!

I#ll go read what its all about now.

Response to ++ As Wars 2007 2007-01-03 11:54:22


At 1/3/07 11:46 AM, BritishMoose wrote: I wish I could AS...coders really do have the most fun.

Od...all this text and rules makes me happy I'm not a coder


BBS Signature

Response to ++ As Wars 2007 2007-01-03 12:00:08


Could someone please convert the .fla to a file readable by flash mx please.


...

Response to ++ As Wars 2007 2007-01-03 12:01:59


I've read most of it and it looks good. But 3 days seems a bit soon. I suppose i'll manage though.

Also, you said we can only execute one action per frame. Can we at all execute others just for effect (it wont benefit at all) like change the colour randomly or make it temporary blur when it shoots a bullet? But it wont actually effect the game play. Also, i'm a bit confused about the bullets array. Is it just like:
[1, 1, 1, 1, 1, 1]
which would symbolise 6 bullets? Or is it like:
[34, 23, 67, 12];
which shows how many bullets each player has?

And also, can we only detect if there is a player there? Is there anyway of detecting how many bullets they have, what direction they're moving in, whether they're firing at you and their health?

ie. can you do:
_root[_root.livebots[2]].shots?

And also can you see yourself on the list of the liveBots or is it just the others? And is there anyway of working out which one you are without comparing names?

Response to ++ As Wars 2007 2007-01-03 12:15:12


At 1/3/07 12:01 PM, Cybex wrote: Also, you said we can only execute one action per frame. Can we at all execute others just for effect (it wont benefit at all) like change the colour randomly or make it temporary blur when it shoots a bullet? But it wont actually effect the game play.

No, because color effects and that kind of shit is going to cause a lot of lag. There will already be about 200 bullets flying around the screen at once, and effects probably wouldn't be the best idea. Nice idea, but I don't think the flash can handle it.

Also, i'm a bit confused about the bullets array. Is it just like:

[1, 1, 1, 1, 1, 1]

Each bullet gets a number when loaded, which is attach to "bullet". So each bullet is bullet3, bullet132, bullet4, etc. Then, each bullet number is dumped into a global array, _root.bullets, which stores all the bullet's numbers in the array. So if...

bullet0
bullet1
bullet2
bullet4

Then the array _root.bullets would look like...
[0,1,2,4]

Each bot doesnt get their own bullet array. They share a common bullet array.

And also, can we only detect if there is a player there? Is there anyway of detecting how many bullets they have, what direction they're moving in, whether they're firing at you and their health?

yeah, just hit their _root.botName.shots, _root.botName.life, and other variables.

ie. can you do:
_root[_root.livebots[2]].shots?

Exactly.

And also can you see yourself on the list of the liveBots or is it just the others? And is there anyway of working out which one you are without comparing names?

Yes, you can see yourself. No, you must compare using yourBotName._name to compare to the array.


Hi there!

BBS Signature

Response to ++ As Wars 2007 2007-01-03 12:19:31


Me too! X)


BBS Signature

Response to ++ As Wars 2007 2007-01-03 12:37:29


I can't open the flash 7 file, it keeps giving me the 'unexpected file format'.

flash mx 2004 BTW

Response to ++ As Wars 2007 2007-01-03 12:41:26


Save a space for me! I wanna get in on this hot, AI action.


BBS Signature

Response to ++ As Wars 2007 2007-01-03 12:48:42


Also, wouldn't it be better to have the angle you set in radians considering all the trig functions work in radians?

Response to ++ As Wars 2007 2007-01-03 12:59:03


I'm thinking it would be easier making a system that n00bs could participate in. Degrees are simpler and less stressful for people making simple bots.

Last Year's Battles
Courtesy of AB, <3. Hopefully you guys can get a clue as to how people souped up their bots for last years comp.

Battle 1 | Battle 2 | Final Battle | Battle Royal


Hi there!

BBS Signature

Response to ++ As Wars 2007 2007-01-03 13:04:07


At 1/3/07 12:59 PM, jmtb02 wrote: I'm thinking it would be easier making a system that n00bs could participate in. Degrees are simpler and less stressful for people making simple bots.

having to make the conversion to radians for trig functions would, however, be stressful.
id flip it over to radians, just to be consistent with the flash trig functions.

---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------

ill be back this year, kids, and with liam gone, ill be shutting you guys out hardcore. anyone wanting to give it a shot, challenging my bot, is free to try, but im afraid im going to make that even harder this year. be prepared for some pseudo-sentient programming.

hope you kids brought the lubricant, because youre getting a cock in your ass either way.


BBS Signature

Response to ++ As Wars 2007 2007-01-03 13:04:41


At 1/3/07 12:57 PM, West-End-Pro wrote: Are we allowed to create our own functions

Of course. Put the function in the onClipEvent(load). This can be done simply with...

onClipEvent(load) {
function cat() {
}
...
}

the bot still fires in the same direction. Is there any reason for this? Or am I just being a bit dim =O

That should work. I just tested it and its okay. I also just noticed that it detects 0 degrees as straight up. Should be interesting, eh? I won't change it.


Hi there!

BBS Signature

Response to ++ As Wars 2007 2007-01-03 13:12:40


In the load it says we can't modify anything, but it also says we can create our own variables, would we be aloud to only add new variables to the load or somethin?

Response to ++ As Wars 2007 2007-01-03 13:12:46


At 1/3/07 01:04 PM, jmtb02 wrote: Of course. Put the function in the onClipEvent(load). This can be done simply with...

We're allowed to se the onClipEvent(load)? I've been spending ages thinking up an ingeneous plan to get flash to detect whethor or not it's the first plan, inside an enterFrame.

Response to ++ As Wars 2007 2007-01-03 13:15:28


At 1/3/07 01:12 PM, FrostedMuffins wrote: In the load it says we can't modify anything, but it also says we can create our own variables, would we be aloud to only add new variables to the load or somethin?

Yes, you can mod the load, just don't mod the variables or functions already in there. Don't set life = 40000, so to speak. Sorry that was so confusing, I tried to make an extra line of // to indicate that.


Hi there!

BBS Signature

Response to ++ As Wars 2007 2007-01-03 13:19:20


At 1/3/07 01:15 PM, jmtb02 wrote:
At 1/3/07 01:12 PM, FrostedMuffins wrote:
Yes, you can mod the load, just don't mod the variables or functions already in there. Don't set life = 40000, so to speak. Sorry that was so confusing, I tried to make an extra line of // to indicate that.

Ah I see, and I sincerely appologize.
AB, I challenge you!

Response to ++ As Wars 2007 2007-01-03 13:20:54


At 1/3/07 01:12 PM, FrostedMuffins wrote: In the load it says we can't modify anything, but it also says we can create our own variables, would we be aloud to only add new variables to the load or somethin?

It says we can't add anything to the variables defined below the code hint. I think we can still add our own load things.

Otherwise, we'd just end up doing stuff like if(variable == undefined){var variable = ... in the enterFrame part.

Also, is there really a need to strictly define a variable every time we alter it? I've always just used strict data typing when something was initially defined :S


BBS Signature

Response to ++ As Wars 2007 2007-01-03 13:37:26


Can we have time to make some adjustments inbetween rounds? For example if we see someone hiding in the corner the whole game, we can adjust ours to take out the corners first.

Response to ++ As Wars 2007 2007-01-03 13:38:00


At 1/3/07 01:37 PM, Cybex wrote: Can we have time to make some adjustments inbetween rounds? For example if we see someone hiding in the corner the whole game, we can adjust ours to take out the corners first.

That would be cheating, Cybex :P


BBS Signature

Response to ++ As Wars 2007 2007-01-03 13:42:37


At 1/3/07 01:38 PM, Paranoia wrote: That would be cheating, Cybex :P

They allow it on Robot wars :D

Response to ++ As Wars 2007 2007-01-03 13:46:03


Well I'm in, even if school starts tommorow (-_-).

I've started on mine right now =P.

Response to ++ As Wars 2007 2007-01-03 13:50:00


At 1/3/07 11:41 AM, jmtb02 wrote:

:....

okey i wuld want to be in but i dont know actionscript can you please tell me what tophics in
as main to read so i will understand what the hell i am douing ??? if not that's okey
i know you are busy


BBS Signature

Response to ++ As Wars 2007 2007-01-03 13:50:48


No adjustments between rounds. It kills the consistency and the timeframes for developers.


Hi there!

BBS Signature

Response to ++ As Wars 2007 2007-01-03 14:04:18


Hows it going for you guys? So far i've just got it to detect a few things. Haven't got on to telling it when to do actions though. It'll be hard telling it when to do what.

Response to ++ As Wars 2007 2007-01-03 14:05:04


Hey, ill join.

I noticed that on the enterframe handler u declared variables. thats pretty dumb since u will waste memory re-declaring. It would be more efficient if u do it like...

onClipEvent(enterFrame) {
moveX = 2;
}
onClipEvent(load) {
var moveX:Number;
}


*User Page under construction*

BBS Signature

Response to ++ As Wars 2007 2007-01-03 14:06:32


I'll give this a go. I've never really done this sort of AI programming, so it'll be great to give it a shot. I should be making my game, but what the hell, it'll be good practice :).

Now to read your post fully :P.

Are you planning to submit the final version? Or is it forum exclusive?

BBS Signature

Response to ++ As Wars 2007 2007-01-03 14:15:05


At 1/3/07 02:05 PM, JD77 wrote: I noticed that on the enterframe handler u declared variables. thats pretty dumb since u will waste memory re-declaring. It would be more efficient if u do it like...

People may not necessarily use the moveX or moveY when the code starts, and DELta determined its speedier to declare the variable types instead of just going straight to assigning values to variables. But yes, it is a bit redundant if you are going to be declaring on the first onEnterFrame. But im not too worried about 8 lines of extra code.


Hi there!

BBS Signature

Response to ++ As Wars 2007 2007-01-03 14:30:14


Okay, so just to check:

- we can declare functions in the movie clip code.
- we can change the moveX, moveY and angleShoot variables with conditions.
- we don't just have to use the 'if (count == x) {' to use options (so we can use things like if (life <= x) {).

---

Also, I don't know if it's my script, or if some of the things I try don't work (angleShoot can't change from the integer it was loaded as, a function i tried wouldn't work entirely).

I'll figure it out when I have more time :).