CRPL-Controlled units?

Started by thepenguin, May 26, 2013, 03:12:36 PM

Previous topic - Next topic

thepenguin

I was wondering if it would be possible for you to add some new commands to the CRPL Tower:

1. Move Player Unit to new location
2. Target Aircraft
3. Control GUI checkboxes for each unit (the ones you see when you click on it)
4. Create unit build marker, but require network to send packets to construct unit.
5. Forge Controls (Upgrades and black holes)
6. Drop Down Command Node

Pretty much anything you would need to create a CRPL script to play the game like a player.  (Yes, I am hoping I can write an AI to play CW3).


We have become the creeper...

Molay

#1
I'd like to add some requests, too:

1) Read the energy stored by player
2) Read the energy production rate by player
3) Read the energy drain rate by player
4) Read the ore stored by player
5) Read the ore production rate by player
6) Read the ore drain rate by player
7) Read the technyte amount stored by player
8) Read the amount of totems powered by player
9) Read the tech level of specific upgrades
10) Read the amount of units of a specific type on map (which I guess would be faster than checking all units and sorting myself?)


Idea behind those commands is to make the script behave a certain way depending on what the player does. Giving it a chance to out-strategize the player and be, to a certain extent, reactive on a larger scale.

J

Quote from: Molay on May 29, 2013, 03:53:06 PM
I'd like to add some requests, too:

1) Read the energy stored by player
2) Read the energy production rate by player
3) Read the energy drain rate by player
4) Read the ore stored by player
5) Read the ore production rate by player
6) Read the ore drain rate by player
7) Read the technyte amount stored by player
8) Read the amount of totems powered by player
9) Read the tech level of specific upgrades
10) Read the amount of units of a specific type on map (which I guess would be faster than checking all units and sorting myself?)


Idea behind those commands is to make the script behave a certain way depending on what the player does. Giving it a chance to out-strategize the player and be, to a certain extent, reactive on a larger scale.
8. Already possible, look at my 'The Totem' map.
2. You can estaminate it by counting the number of reactor * 0.5 and the number of collectors *0.2 for flat terrain and *0.1 for rough terrain
5. Count the number of ore mines on the map, pretty accurate.
10. Already 100% possible, look at V's script for story mission #1. Also possible for pre-built structures (totems, emitters).

For the rest, you might have to wait till an update after the game is released.

ShadowDragon7015

I want to be able to code whether or not a Command node will accept ore or put out AC,Ammo,or Build packets.
Hiding the golden creeper for years to come.

Molay

Quote from: J on May 29, 2013, 05:25:24 PM
Quote from: Molay on May 29, 2013, 03:53:06 PM
I'd like to add some requests, too:

1) Read the energy stored by player
2) Read the energy production rate by player
3) Read the energy drain rate by player
4) Read the ore stored by player
5) Read the ore production rate by player
6) Read the ore drain rate by player
7) Read the technyte amount stored by player
8) Read the amount of totems powered by player
9) Read the tech level of specific upgrades
10) Read the amount of units of a specific type on map (which I guess would be faster than checking all units and sorting myself?)


Idea behind those commands is to make the script behave a certain way depending on what the player does. Giving it a chance to out-strategize the player and be, to a certain extent, reactive on a larger scale.
8. Already possible, look at my 'The Totem' map.
2. You can estaminate it by counting the number of reactor * 0.5 and the number of collectors *0.2 for flat terrain and *0.1 for rough terrain
5. Count the number of ore mines on the map, pretty accurate.
10. Already 100% possible, look at V's script for story mission #1. Also possible for pre-built structures (totems, emitters).

For the rest, you might have to wait till an update after the game is released.

I admit, with the totems and ore it doesn't seem too important, as those will always be present in small amounts only.
However, I need to know the tech level for ore extraction to be accurate first.

As to the energy production, I believe it is too heavy a calculation to perform to only have an approximation as a result (also, lacks the tech level again). It's throwing away loads and loads of cycles for data that is already calculated and available. But I thank you for the suggestion, as a workaround for the time being, this will do fine :)
Would be glad to have the more efficient and accurate version though :)

As to the last part (10) do you have a link for that? I don't find it in the Official CRPL examples nor the code_examples on the wiki :(
When looking in the CreeperWorld3\data\sectors\internal\1 I don't see any scripts for the mission, either?

Thanks :)

J

Quote from: Molay on May 29, 2013, 06:22:08 PM
I admit, with the totems and ore it doesn't seem too important, as those will always be present in small amounts only.
However, I need to know the tech level for ore extraction to be accurate first.

As to the energy production, I believe it is too heavy a calculation to perform to only have an approximation as a result (also, lacks the tech level again). It's throwing away loads and loads of cycles for data that is already calculated and available. But I thank you for the suggestion, as a workaround for the time being, this will do fine :)
Would be glad to have the more efficient and accurate version though :)

As to the last part (10) do you have a link for that? I don't find it in the Official CRPL examples nor the code_examples on the wiki :(
When looking in the CreeperWorld3\data\sectors\internal\1 I don't see any scripts for the mission, either?

Thanks :)
To get the scripts out of a map, go to the game -> projects, create a new project (name it however you want), go to the CW3 data folder and look for the map, copy it, go to the CW3 WorldEditor folder, choose the folder of which you just created a project for, paste the map there and rename it to save.cw3. Open it in the game and go to scripts, they should be there.

Molay


thepenguin

Quote from: Molay on May 29, 2013, 03:53:06 PM
1) Read the energy stored by player
4) Read the ore stored by player
I would have thought these would have worked with getunitvars
We have become the creeper...

Molay

Quote from: thepenguin on June 03, 2013, 06:58:35 PM
Quote from: Molay on May 29, 2013, 03:53:06 PM
1) Read the energy stored by player
4) Read the ore stored by player
I would have thought these would have worked with getunitvars

You could get the energy stored in all player units with GetUnitAttribute, that's what you're thinking about, right?
However, I can't get the Unit Type "COMMAND NODE" with GetUnitType, so there is no way to tell how much energy I have stored in the command nodes. Also, I'm not sure if energy is stored as CONST_AMMO in the command node, either, if it was possible to get the command node's UID in the first place.

Further, most importantly (after that disaster of a script I wrote that slowed down the game to 8 fps), I'm reluctant to get all the units on the map, check if their type is command node, and add their current energy. The energy stored is clearly something that is already available, reading it directly would be much more efficient than cycling through all units on the map. Not sure how the class Command Node is structured, but basically all I want is a GetEnergyStored.

J

Quote from: Molay on June 04, 2013, 10:09:41 AM
Further, most importantly (after that disaster of a script I wrote that slowed down the game to 8 fps), I'm reluctant to get all the units on the map, check if their type is command node, and add their current energy.
You shouldn't go through all units every frame. Just store them (unitUID's) in a list and check that(<-count 0 do "list" I concat <-! loop). You might also choose to only run your script/update vars every 30 frames.

thepenguin

Quote from: Molay on June 04, 2013, 10:09:41 AM
Quote from: thepenguin on June 03, 2013, 06:58:35 PM
Quote from: Molay on May 29, 2013, 03:53:06 PM
1) Read the energy stored by player
4) Read the ore stored by player
I would have thought these would have worked with getunitvars

You could get the energy stored in all player units with GetUnitAttribute, that's what you're thinking about, right?
However, I can't get the Unit Type "COMMAND NODE" with GetUnitType, so there is no way to tell how much energy I have stored in the command nodes. Also, I'm not sure if energy is stored as CONST_AMMO in the command node, either, if it was possible to get the command node's UID in the first place.

Further, most importantly (after that disaster of a script I wrote that slowed down the game to 8 fps), I'm reluctant to get all the units on the map, check if their type is command node, and add their current energy. The energy stored is clearly something that is already available, reading it directly would be much more efficient than cycling through all units on the map. Not sure how the class Command Node is structured, but basically all I want is a GetEnergyStored.
COMMANDNODE is one word
We have become the creeper...

Neko187

Quote from: thepenguin on May 26, 2013, 03:12:36 PM
I was wondering if it would be possible for you to add some new commands to the CRPL Tower:

1. Move Player Unit to new location
2. Target Aircraft
3. Control GUI checkboxes for each unit (the ones you see when you click on it)
4. Create unit build marker, but require network to send packets to construct unit.
5. Forge Controls (Upgrades and black holes)
6. Drop Down Command Node

Pretty much anything you would need to create a CRPL script to play the game like a player.  (Yes, I am hoping I can write an AI to play CW3).




IBM would be proud.
Everything is too long a list to work with.
No one knows everything about anything.
No one knows something about everything.
Everyone knows something about something.
Anyone could be the world's foremost expert on something.
Anyone who thinks that just because they didn't already know a thing, it must not be true or important, is an idiot.
-OSC