Tuesday, July 13, 2004

[Ant Attack] Commenting on Comments

Woo! I've had comments. I wasn't sure if I should reply to them in the comments section or mention something here, so I'll go with here.

*

First off I was really please to get a comment from Jean-Yves, the guy behind Multi-User Lords of Midnight a game I loved when it first came out. Jean-Yves is doing great things with it. I bought a copy of RetroGamer 5 as there's a whole big thing about Ant Attack in there (oh if only I'd finished this a couple of months ago!) Lords of Midnight was written up too, I initially scanned the article planning on going back to read it later, but the phrase "Multi-Player" jumped out at me and I though "That's a really cool idea!". A couple of days later Jean-Yves is commenting in my Blog, how very cool. Now if only I has some free time!

*

Iain of the fully paid up game forum Slate State mentioned a little about the game running too fast and needing some Frame Limiting. Just when I though I did have Frame Limiting. This means either one of two things, my Frame Limiting code isn't working, which is quite probable, or, Iain is getting to old and can't handle the speedy gameplay anymore ;) as 80fps is the speed I'm shooting for!

*

Seems like I'm about to induce an epileptic fit in Jo with the screen flashing red when you get bitten! Sorry to say the flashing isn't going away any time soon. Although due to tuning two things were going on, the "Bite Delay" for each ant was set to only 200 milliseconds, so they cam rather thick and fast. And the ants didn't stop for a short pause after biting you, which they should have done. I've re-tweeked these things now so the bites don't come quite so thick and fast.

Why flash the screen red? Well in the original it'd pause a little while and say "Bitten!" at the bottom of the screen. Now-a-days(tm) I wanted to keep the action moving along without the pause so I needed some other way to signal the bite. The red flash comes from the Alfred Hitchcock film "Spellbound" where a couple of the frames of the otherwise black and white film tinted red, by hand I assume. Which, I imagine would have taken some people by surprise, just because you can only film in black and white doesn't mean the print can't have colour on it. As I've been aiming to keep AA black and white to I though the first splash of red would be kinda dramatic!

*

Right, enough rattling on the for moment, back to coding.





7 Comments:

At 15 July 2004 09:21, Anonymous Anonymous said...

Well just to make things weirder... I wrote that article in Retro Gamer 4 & 5! Jean Yves alerted "us" to your prescence.

Nice work on the remake.

Chris Wild
www.icemark.com

 
At 15 July 2004 12:56, Blogger Iain said...

It's *State* not *Slate*... but I'll forgive you that slip of the keyboard because you're doing such a fine job. :-) (And also because no-one can actually get onto the forum at the moment, but that's another story...)

You're *aiming* for 80fps? That seems pretty high to me, but then I am old and crumbly, as the writers from Crash! would put it. (28, for the record :-)

When you're getting surrounded by ants at such a high frame rate, it really makes things pretty impossible. (especially without ammo!) I must admit I've not tried the first person mode yet, so maybe that'll make it a bit more playable. I'll play a bit more and get back to you.

To Jean-Yves: I'll have to have a look at the Multi-User LOM, as it was my favourite graphical adventure as a kid - I even used the naming convention of the Lords (Lord 'X' of 'X') as part of my online forum/MSN nick!

 
At 16 July 2004 08:33, Blogger Modesty B Catt said...

Iain,

If the codes working correctly the 80fps just means that the movement of the ants is smoother not faster. i.e. they'll cover the same distance in 1 second, if it was running at 3fps then you'd see them do 3 "jumps" to cover the distance, at 80fps there'll be 80 far smaller jumps between the two points.

Having said that the code may be broken and they do move faster at higher frame rates. I'll have to look into it.

Having said *that* :) The game is just a little too hard at the moment, because you don't have any ammo, but I think that means the balance is just about right.

Time and tweaking will tell.

Thanks for playing with it the feedback it v.useful!

 
At 16 July 2004 09:52, Blogger Iain said...

The ants do seem to move faster than I remember them doing in the original game, but then the last time I played the original was at Game On a year or two back.

Just out of (professional) interest (being a code monkey by trade) - what are you coding the game in?

My experience with games suggests that faster frame rates does equate to faster animation (i.e. playing speed) - try playing 3D Deathchase at 300% speed on an emulator, and you'll see what I mean; smooth as hell, but practically impossible to get beyond Level 5 - I'm very interested to find out how you plan to make the animation that smooth yet still keep the movement rate down.

 
At 16 July 2004 20:31, Blogger Modesty B Catt said...

Hi Iain,

In the original the ants moved at the same speed as the player, in this version they move slightly faster. There's a good(ish) reason for this, in the original if you were a couple of steps ahead of an ant it would never catch up to you, so you could easily get the girl and run away without being bitten, *unless* you made a mistake while turning and so on, in which case the ant would catch up and bite you.

So you were being punished for making a mistake, which in game terms is quite correct and proper. However the controls were so hard to use, that in reality the difficulty of the game was really being set by the difficulty of the controls.

In the new version, which is much easier to control, it's no problem at all to keep ahead of the ant if you both travel at the same speed. The difficulty set by the controls is gone, so it has to come from somewhere else, I've done this by increasing the speed and number of ants.

As a player you have the advantage of being intelligent (we hope), being able to use the landscape to your advantage and have an offensives in the form of grenades and jumping on an ant to stun it.

The ants in their favor have speed and numbers. Once the grenades are in then the game balance can be tinkered with until it's about right.

At the moment, without grenades, I can complete a 10 out of 10 rescue about 1 game in 7. So I don't think the balance is too far off.

*

The game is being coded in Blitz3D. I originally used it thinking it would be good to prototype map/reading rendering, and then rewrite in C. But it seems to run pretty well that I don't think any speed increase is really worth the time of trying to deal with DirectX more directly!

*

As for limiting the speed on faster machines, well it works like this. Each ant has a Think() and Move() function. Pretend that there are 20 Ants and your running at 80fps, in other words the PC is fast enough to cycle through a game loop and render the display 80 times a second. In each loop I make one single and Think(), the next loop the next and will Think() and then the next one, so in the above case each ant will Think() 4 times a second.

A Think() consists of working out if the player is within the field of view, if not then which is the strongest player "smell" it can see, thus which way to turn, how much to turn, if it should slow down or speed up. An ant slows down the more it needs to turn to decrease it's turning circle. A think doesn't cause an ant to move or turn though, just where the ant wants to be in one seconds time.

A game running at 80fps has a cycle every 12.5 milliseconds. However the ants are only set to update their Move() every 20 milliseconds, so if less than 20ms has passed since the last time they moved, then they just continue on their path.

In old games an enemy would moved say 5 units per game cycle. So if a game ran at 40 cycles per seconds then an enemy would move a total of 200 units. If you run the game at 300% speed, or 120 cycles per seconds, then the enemy would move 60 units, so yes the game runs faster.

But where I'm doing here is setting the velocity of the Ant, so it moves 2.45 units per second. So if your game ran at 40 cycles per second, each cycle would move the ant by 0.06125 units. 120 cycles per seconds the ant would move 0.02042 units per cycle. Running very slow at 5 cycles per the ant would move 0.49 units per cycle.

But whatever the speed the ant would only move 24.5 units every 10 seconds.

What *is* happening though is the faster the machine the more often the ants get to Think(). So if the game was running at 160fps each ant would Think() 8 times a second. Or we could have 80 ants all thinking 2 times a second.

Flip this the other way, if you have 20 ants and the game only runs at 5fps, each ant only think once every 4 seconds! It'll see where the player is on one Think() and start to turn and move towards the player, and then not update it's turning amount and speed for another 4 seconds.

So really as a PC gets faster, say twice the speed, you could have the ants updating their brains twice as fast and acting smarter, or have twice as many ants being just as smart.

You can try this out by editing level1.bmp in the maps\antescher folder. If you ant 4 times as many ants you notice two things. One your frame rate drops as the game tries to Render more ants and two, the movement of the ants change, they'll tend to run in a far more "curved" path and will often miss you, they get dummer! Reduce the ants and they'll be smarter and go more directly for you.

*

I need to double check my code as it's possible that the Move() function is being called too often, but I'm pretty sure it's all in the right place. You may just being having trouble because the ants are set to be faster than you and at 80fps you've got pretty smart ants running around!! :)

Mod

 
At 19 July 2004 08:31, Blogger Iain said...

Wow - I had no idea such a simple game could be *so* complicated. It sounds like you've really got the maths sorted out though, so as long as you've not got any recursive procedure calls invoking procedures from within themselves (I've had this happen to me a few times in Visual Basic and C - a real headache and very hard to spot) it looks like you're got everything in hand.

Once you're done, it might be worth pitching the game in the direction of PC Gamer for distribution. This is just the kind of thing that they'd stick on their coverdisk, and they might even want to do an article on the process of how you made it. I have a few contacts at PCG if you're interested and want to make it happen. :-)

 
At 13 March 2007 03:20, Anonymous Anonymous said...

BUY CHEAP CIALIS
CIALIS - THE BEST TREATMENT IMPOTENCE
WHAT IS VIAGRA
BUY LOW-COST VIAGRA ONLINE & SAVE

 

Post a Comment

<< Home