AI BONUS' PLUGIN

Download scenarios and talk about scenario design.

Moderators: Slitherine Core, BA Moderators

Post Reply
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

AI BONUS' PLUGIN

Post by Merr »

Pip and all,

I've spent the past few days stomping on unfamiliar ground and built a little PLUGIN ... To add AI BONUS' to the scenario.

I don't know if Pip and the gang are going to eventually add a PLUGIN, my goal was to practice coding and translate some ideas into reality.

So far, I've got 3 Bonus' for the AI built ... actually 2 and half.

1. AI Rally - Same as human player ... The players Rally is "free" adding 50 points to morale until it's above it's base morale, the same applies to AI in one step during it's turn.
2. AI Ammo - Same as human player ... Resets the "APCharges" to maximum.

Now, the third Bonus is what I'm working on .... AI Artillery ... Giving the AI a Battery of 150mm to ruin your day.

Below is a screen shot of the PLUGIN ... note, it's just basic since I'm adding stuff as I go. Also, the buttons are simply since I can't (for the life of me!) create a toggle button despite numerous examples in the current plugin scripts :cry: .

Image

Now, lets get back to the BATTERY part, or artillery ... (I'm going to change the BATTERY to read "150mm Battery").
Currently, I have the AI use the VP as their target point IF the VP is hostile (meaning they don't own it), with a random 3 Tile "scatter".
I'm having logic problems with this that needs sorting out.

Ok ... What I would like to do for the AI Artillery Target Selection is this ... The scenario designer set's up Pre-Target selection points using the same scripts as setting up VP loactions.
The AI will scan each Target point and check for any enemy units within a certain radius ... deemed as cheating in my book, but better than having it randomly select a point for absulutly no reason what so ever.
It's requires alot of code logic and I don't even know if I can get it to work. I want the AI to make a logical decision when comitting an artillery strike.

So ... use VP's ? ... use Pre-Targets ? or use random combination of both?

I dunno ... I've got to get the basic artillery strike logic to work properly with cooldown times ... if I can even do that!

Merr
junk2drive
BA Moderator
BA Moderator
Posts: 1478
Joined: Sun May 23, 2010 4:47 pm
Location: Arizona USA -7GMT

Post by junk2drive »

I can't even find the plug in graphics. Paint.net has a bevel edge tool in effects if that's what you want for your buttons.

I might rather have the AI cheat than lob shells willy nilly. If a human would see you or guess where you would be to decide a target, than the best choice for the AI is a visual target or a point. Or a point but only if visual contact is made. In addition, maybe only infantry and artillery type targets should be valid.
You can call me junk - and type that with one hand.
pipfromslitherine
Site Admin
Site Admin
Posts: 9937
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

Wow - never expected people to try making their own plugins :). One thing to note is that we don't have the ability to have them distributed as part of a campaign as yet (I will try my very best to get this into the France update to allow for people to make and use them without us having to ship them out as an update from our end).

For toggles I just store the state I desire, and then change the text on the button based on the current state. The function to look at is SetUIStrings called from the PLUGIN_TICK() function.

Constantly impressed by the stuff you guys are doing!

I also want to apologise for the delays in getting people's finished work up for ingame download - hopefully will have more time once France is finally done!

Cheers

Pip
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

pipfromslitherine wrote:Wow - never expected people to try making their own plugins :). One thing to note is that we don't have the ability to have them distributed as part of a campaign as yet (I will try my very best to get this into the France update to allow for people to make and use them without us having to ship them out as an update from our end).
Pleas don't rush on this ... It's very low priority in my book. It would take me awhile to get everything to work correctly. Besides, at my currernt "test" stage it all generates crazy stuff ... which I'll update my AP/VP bug thread now :oops:
For toggles I just store the state I desire, and then change the text on the button based on the current state. The function to look at is SetUIStrings called from the PLUGIN_TICK() function.
Hmm ... Thanks! I'll need to dig more into toggles, it's one thing to get the toggle to work, yet another to get the logic to coincide with the toggle!
I also want to apologise for the delays in getting people's finished work up for ingame download - hopefully will have more time once France is finally done!
I don't expect you guys to get back up into full gear again until after the holidays ... Perhaps next year you can have download content for PLUGINs? ... that saying when plugins becomes an official modable item. :wink:

Keep up the great work!

Merr
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

junk2drive wrote:I can't even find the plug in graphics. Paint.net has a bevel edge tool in effects if that's what you want for your buttons.
You can find the info in the PLUGIN folder ... it's a text file that writes out the area to be drawn, colors, and text size. The buttons are DDS files ... I can't recall (at work) but the DDS is called something like "enemy turn button". The toggle part is all code using one of the DDS's as the background.
I might rather have the AI cheat than lob shells willy nilly. If a human would see you or guess where you would be to decide a target, than the best choice for the AI is a visual target or a point. Or a point but only if visual contact is made. In addition, maybe only infantry and artillery type targets should be valid.
Yeah ... determining the "best" target is the tricky part. I think for this to work is have (at least) one PRE-REGISTERED target points dropped on the map by the scenario designer. This will be the "starting point" that the AI can reference when "looking" for a valid target, whether it be known or unknown. The important part is allowing the designer to select the conditions he want for his scenario, that is location and type of strike. So, basically, the designer wants the AI to "look" in this area (initially) for opportunities to bombard. It won't be constrained to this location, but just a starting point. Starting points allow me to code any conditions from that point (I hope!).

There are lots of code scripts in the game now that can be used to get this done. It's going to take awhile to do because we want the AI the select ... THE BEST ... but, frankly, we want the AI to make bad choices too. For example, when Humans (like me) have an arty barrage available I tend to hold back a few turns before using it, escpecially if there's not much to shoot at, meaning it will be a waste of time. To get the AI to sit on it's hands would be another scripting nightmare ... although I am good at breaking things it might be a "bug" that makes it sit on it's hands :lol:

Merr
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

Here's a quick outline ... I figure it has to have 3 setups for the plugin ....

1. SPOTTER UNIT - on/off. You'll need a new unit in the CSV for this. I was thinking of a 2-man team with a Bombard Range of 999. Now, using the InDirectFire logic, instead of the unit firing at you it will fire a GLOBAL at you, then check a 5-tile radius around that global. It will then "add up" all the unit costs of the enemy and determine IF it should mark this location (with another global) for the bonus to attack with artillery. This should cover the AI's "known units" scan, same as a human's scan. And, this will prevent the AI from selecting a lone unit and wait for a better opportunity to bombard.

2. Pre-Registered Marker - 8 Markers, on/off, turn arrival selection.
The designer can place the markers in the editor, select whether they are on/off, then select a turn on which it will arrive.

3. VP Marker - 8 Markers, on/off, hostile
The designer uses the VP markers as the x/y location and sets whether the VP needs to be hostile for target selection.

Now, we only want one artillery salvo to arrive(per turn) ... So, if the designer has selected more than one setup above, in the turn that the salvo arrives it will need to run one final check to decide which setup executes in that turn. The overall desicion would be based on the surrounding units that fall within a certain radius. Whichever radius yields the best (using unit cost total), it will select that and .... BOOM.

To prevent "friendly-fire", there can be another button in the plugin called RISK FACTOR, with a scalable setting from 1-10. The AI will weigh the total unit cost of both sides within the radius of the marker and then decide to execute the salvo right now.

Interesting concept ... looks good on paper... ha!

Again, all I'm thinking is for the scenario designer to just "click-n-go" ... no manual scripting knowledge required.
junk2drive
BA Moderator
BA Moderator
Posts: 1478
Joined: Sun May 23, 2010 4:47 pm
Location: Arizona USA -7GMT

Post by junk2drive »

Looking good, good thought put into it.

I like the risk setting. When we get the Soviets you can set it at 10!
You can call me junk - and type that with one hand.
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

junk2drive wrote: I like the risk setting. When we get the Soviets you can set it at 10!
:lol:

And ... Next to the SPOTTER button there can be a MIN/MAX Cost button ... The scenario designer can decide how much the total cost will be to trigger a marker global.

Also, if we want to get fancy with the SPOTTER .... the initial target selection global (aka spotting round) can actually be dropped on the map using a smoke marker. This will let the human player know that something nasty "might" be coming hence forth!

In reality, they would be several ways that a player could know he's being targeted .... In the Battle of Singling, the US knew something was coming when they observed a "white signal flare" being shot in the sky. They were right, a German artillery strike arrived a few seconds later :shock:
Post Reply

Return to “Battle Academy : Scenario Design”