Author Topic: Any way to return the energy, strength and speed of an asteroid?  (Read 12197 times)

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Any way to return the energy, strength and speed of an asteroid?
« on: December 30, 2010, 11:07:59 AM »
Without pre-declaring the values, is it possible to detect the energy, strength and speed of an asteroid?

I want to put some stuff in my AI engine to make the AI prefer asteroids with better stats.  I also want to be able to auto-detect what the stats are, without relying on pre-defining them somehow.  This is so that the engine is easily transportable between levels.

Anyone know a way to return the stats ? :>



Something like this is what I'm looking for:
Code: [Select]
roidenergy = GetAsteroid(0).energy

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: Any way to return the energy, strength and speed of an asteroid?
« Reply #1 on: December 30, 2010, 06:25:40 PM »
Sounds about right. I'll poke.

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: Any way to return the energy, strength and speed of an asteroid?
« Reply #2 on: December 30, 2010, 06:36:19 PM »
GetAsteroid(id).CurrentEnergy     will give you the energy of the asteroid. CurrentEnergy  (NOT a function, doesn't need brackets) I think can be used for trees and seedlings, too. Will work on strength and speed.


EDIT: Doesn't look like CurrentStrength and CurrentSpeed exist. Yet.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Any way to return the energy, strength and speed of an asteroid?
« Reply #3 on: December 30, 2010, 11:51:10 PM »
I think that refers to Core Energy though, doesn't it?  I was talking about the other type of energy :P

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: Any way to return the energy, strength and speed of an asteroid?
« Reply #4 on: December 31, 2010, 04:58:28 PM »
Don't think so, it reterned some ridiculous number like 0.4398758377678595342695657659862340473560374603487348456234765087234034792307463405762407846580760834702875

which looked like the stats energy, not core.

Alex

  • Administrator
  • Ent
  • *****
  • Thank You
  • -Given: 3
  • -Receive: 14
  • Posts: 1,035
Re: Any way to return the energy, strength and speed of an asteroid?
« Reply #5 on: January 01, 2011, 01:21:59 AM »
entity.Attribs.Energy
entity.Attribs.Strength
entity.Attribs.Speed

Alex

  • Administrator
  • Ent
  • *****
  • Thank You
  • -Given: 3
  • -Receive: 14
  • Posts: 1,035
Re: Any way to return the energy, strength and speed of an asteroid?
« Reply #6 on: January 01, 2011, 01:23:06 AM »
You can actually set the attributes with that... worth experimenting to see what the effects are...

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Any way to return the energy, strength and speed of an asteroid?
« Reply #7 on: January 01, 2011, 01:32:29 AM »
Sweet, thanks! :D

pigpenguin

  • Seedling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 37
Re: Any way to return the energy, strength and speed of an asteroid?
« Reply #8 on: January 01, 2011, 05:04:17 PM »
Oh dear alex what have you done? You just gave him the ability to make an even stronger ai then the one he has currently kicking our asses D: oh well the challenge is why you play right? :P

Alex

  • Administrator
  • Ent
  • *****
  • Thank You
  • -Given: 3
  • -Receive: 14
  • Posts: 1,035
Re: Any way to return the energy, strength and speed of an asteroid?
« Reply #9 on: January 02, 2011, 07:53:55 AM »
Heh, not only that, but the ability to make the AI... CHEAT!  :o

pigpenguin

  • Seedling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 37
Re: Any way to return the energy, strength and speed of an asteroid?
« Reply #10 on: January 02, 2011, 09:07:31 AM »
I think he has always had the ability to make the ai cheat it could kinda control your units at one time :P

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Any way to return the energy, strength and speed of an asteroid?
« Reply #11 on: January 02, 2011, 03:13:15 PM »
Cheat how?  :P  Oh, I suppose the AI could artificially pump the stats on roids that it owns...

But then, I could easily program the AI engine to add seedlings when it's losing.  :>  But that wouldn't really seem fair to the player, and plus, that IS cheating.

I am secretly proud of the fact that the AI does what it does using nothing more than what players get.  Give it some starting seeds and it will play by the rules and still wipe the floor with most players (or so I'm hoping).  No seedlings artificially added, no stats pumped, no illegal seed sending...  the only "actions" that the AI is capable of carrying out is updating its metric, planting trees, and sending seedlings from one asteroid to another.

Bonobo

  • Achiever
  • Old Oak
  • ****
  • Thank You
  • -Given: 139
  • -Receive: 12
  • Posts: 670
  • Eufloria: Yes
Re: Any way to return the energy, strength and speed of an asteroid?
« Reply #12 on: January 02, 2011, 07:16:20 PM »
What about the knowledge about asteroids? Doesn’t the AI already know all stats of all asteroids from the beginning while we meek humans still have to explore?

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: Any way to return the energy, strength and speed of an asteroid?
« Reply #13 on: January 03, 2011, 01:16:08 AM »
Yes, but it doesn't use them unless it's explicitly told to. But that's always a good excuse for when the IAI beats you again.

Bonobo

  • Achiever
  • Old Oak
  • ****
  • Thank You
  • -Given: 139
  • -Receive: 12
  • Posts: 670
  • Eufloria: Yes
Re: Any way to return the energy, strength and speed of an asteroid?
« Reply #14 on: January 03, 2011, 02:27:04 AM »
[..] But that's always a good excuse for when the IAI beats you again.
Oh well :D I always tell myself that the AI is cleverer than me ;)

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Any way to return the energy, strength and speed of an asteroid?
« Reply #15 on: January 03, 2011, 02:46:03 AM »
Quote
What about the knowledge about asteroids? Doesn’t the AI already know all stats of all asteroids from the beginning while we meek humans still have to explore?

That's an excellent point.
I haven't started implementing this yet, but when I do, I will make sure that the AI can only tell what the stats of an asteroid are if the person implementing the code specifically reveals those asteroids to the AI.  If the AI doesn't know what the stats are, I guess it would judge the quality of unexplored asteroids based on their size - like human players do.

I might also implement some code that allows the AI to scout asteroids, so that it can figure out what their stats are.

The only thing the analysis of asteroid stats/size is going to affect, is which asteroids the AI chooses to colonise first.  An unfortunate side effect of this is that in maps where the stats of asteroids are not procedurally generated, but are specified manually and thus the same every time you play, the AI would always colonise them in the same order.

Currently, the AI treats all asteroids equally when choosing which to colonise first.  The only factor in its decision of the order in which to do it, is which asteroids have the least greys guarding them.  It tries to go for unguarded asteroids first.

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: Any way to return the energy, strength and speed of an asteroid?
« Reply #16 on: January 03, 2011, 03:22:43 AM »
Could you add scouting behaviour to it? Send (or sacrifice) a high energy/speed seedling (better chance of escape) out to an undiscovered roid, discover it, and then run? Or is that there already?

EDIT:

NVM, just read your post again.

Imma herpin da derp derp.
« Last Edit: January 03, 2011, 04:51:08 AM by Pilchard123 »

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Any way to return the energy, strength and speed of an asteroid?
« Reply #17 on: January 03, 2011, 04:58:43 AM »
Sending a single scout shouldn't be too hard.

Getting it to return home might be harder though.