Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: shmibs on July 03, 2012, 01:09:53 pm

Title: tanks and AI
Post by: shmibs on July 03, 2012, 01:09:53 pm
it's a bit late to enter the contest, but i felt like making something related to the topic anyways, and have been playing a lot of Steel Storm (http://steel-storm.com) recently, so here's the beginnings of a tank fighting game of some sort. adding in smooth scrolling maps + bullets + collision detection will add a HUGE amount of overhead, but this is running with 11 AI's and at 6MHz, so i think it might be doable with 2-3 AI's at a time and at 15MHz, with some optimisation.
Title: Re: tanks and AI
Post by: aeTIos on July 03, 2012, 01:19:10 pm
Oh wow this is cool :D by the way we should get more ppl into playing.
Title: Re: tanks and AI
Post by: blue_bear_94 on July 03, 2012, 01:29:37 pm
It's a lot late. Only 5 days left.
Title: Re: tanks and AI
Post by: cyanophycean314 on July 03, 2012, 02:36:24 pm
Not really, it's just procrastination at it's finest. I could still write an ok entry in five days if I threw most my time on it. :)
Title: Re: tanks and AI
Post by: parserp on July 03, 2012, 02:43:44 pm
Not really, it's just procrastination at it's finest. I could still write an ok entry in five days if I threw most my time on it. :)
Couldn't have said it better myself. ._.
Title: Re: tanks and AI
Post by: Builderboy on July 03, 2012, 10:32:04 pm
oooh shiny!  What kind of rules to the AI's follow?
Title: Re: tanks and AI
Post by: shmibs on July 04, 2012, 12:42:23 am
it's rather simple, actually. right now, they just have a 2/3 chance of accelerating forward, 1/3 backward, turn towards the player, and stop moving forward within a certain distance. i'm going to add in side to side motion as well and have them slide a bit ambiently and have a chance of swerving when the player fires his weapon/they hit a wall.

EDIT: builder, what do you recommend for a map setting?/me is worried that smooth scrolling would be too sluggish with this much going on, but that anything else would feel too crampt.

DOUBLE EDIT: what should i do for collision detection? is there a better method than progressional pixel testing?
Title: Re: tanks and AI
Post by: TIfanx1999 on July 04, 2012, 02:46:36 am
It looks pretty cool, but the sprites remind me of race cars from some old video game instead of tanks. XD
Title: Re: tanks and AI
Post by: Sorunome on July 04, 2012, 08:25:45 am
It's looking nice so far!
Keep it going! :)
Title: Re: tanks and AI
Post by: lkj on July 04, 2012, 09:09:48 am
Cool! I considered doing something similar for the nspire, but changed my mind.
Title: Re: tanks and AI
Post by: squidgetx on July 04, 2012, 11:03:16 am
DOUBLE EDIT: what should i do for collision detection? is there a better method than progressional pixel testing?
I use a hackish radial-distance method for collisions in Embers - I pretend every enemy and item exists within a diamond given by distance=distancex+distancey, which is basically a optimal corruption of pythagorean distance=root(dx^2+dy^2). It's not as graphically perfect as using pixel masks but it sure is a hell of a lot faster.
Title: Re: tanks and AI
Post by: aeTIos on July 04, 2012, 11:18:09 am
That sounds like a pretty neat idea ...Tho it indeed sounds like an epic corruption O.o
Title: Re: tanks and AI
Post by: Stefan Bauwens on July 04, 2012, 01:56:46 pm
it's a bit late to enter the contest, but i felt like making something related to the topic anyways, and have been playing a lot of Steel Storm (http://steel-storm.com) recently, so here's the beginnings of a tank fighting game of some sort. adding in smooth scrolling maps + bullets + collision detection will add a HUGE amount of overhead, but this is running with 11 AI's and at 6MHz, so i think it might be doable with 2-3 AI's at a time and at 15MHz, with some optimisation.
Looks awesome.
Title: Re: tanks and AI
Post by: shmibs on July 26, 2012, 01:13:15 am
i doubt i'm every going to do anything with this, but here's the latest version of it, if anyone feels like playing around.
A is the executable, ACC and TANKS the source, and the arrows move you in directions relative to the tank, while 2nd and mode turn.
Title: Re: tanks and AI
Post by: Stefan Bauwens on July 26, 2012, 03:28:56 am
Looks  fun. Looks like a good start for a game. :)
Title: Re: Re: tanks and AI
Post by: stevon8ter on July 26, 2012, 08:32:19 pm
DOUBLE EDIT: what should i do for collision detection? is there a better method than progressional pixel testing?
I use a hackish radial-distance method for collisions in Embers - I pretend every enemy and item exists within a diamond given by distance=distancex+distancey, which is basically a optimal corruption of pythagorean distance=root(dx^2+dy^2). It's not as graphically perfect as using pixel masks but it sure is a hell of a lot faster.

Ok, in basic if i want to do that, i just do:

:root(abs(A-X)^2 + abs(B-Y)^2 -> C
:if C=1 or C=root(2
:then
:commands
:end

Where A and B are the coordinates of the (point or object) thats it collided with
And X and Y are the 'players' coordinates
Checking for root(2 is for diagonal collision and checkig the 1 is for checking for horizontal or vertical collision

This methode is just for 1 pixel colliding with 1 pixel, so much more checks would be nescessary for larger objects, i know this is an axe-topic but maybe you now have a simple idea of pythagoras?

Edit: this was meant for shmibs, not for squidget, the quote was just to tell that squidget is right about this being a good way

Edit2: ps: correct me if i'm wrong ;)
Title: Re: tanks and AI
Post by: DJ Omnimaga on July 26, 2012, 09:00:08 pm
Wow seems pretty fun. You should at least add dying and make it some sort of survival game. :D
Title: Re: tanks and AI
Post by: Hayleia on July 27, 2012, 01:33:27 am
Ok, in basic if i want to do that, i just do:

:root(abs(A-X)^2 + abs(B-Y)^2 -> C
:if C=1 or C=root(2
:then
:commands
:end
I don't get the utility of the "abs()" right before the "^2" ;)
Also, we are here talking about Axe, not basic. So root(2) is equal to 1, which means that the second line has something redundant and that all your method loses precision. Instead of working with the distance, what you can do is working with the square of the distance, that you compare to 1 and to 2
Title: Re: tanks and AI
Post by: stevon8ter on July 27, 2012, 03:32:28 am
Ok, in basic if i want to do that, i just do:

:root(abs(A-X)^2 + abs(B-Y)^2 -> C
:if C=1 or C=root(2
:then
:commands
:end
I don't get the utility of the "abs()" right before the "^2" ;)
Also, we are here talking about Axe, not basic. So root(2) is equal to 1, which means that the second line has something redundant and that all your method loses precision. Instead of working with the distance, what you can do is working with the square of the distance, that you compare to 1 and to 2

Like i said, i don't know much about axe

And indeed, that abs( thing was stupid of me that i didn't saw that