PAC maps: theory and practical

Started by teknotiss, December 03, 2014, 12:02:14 PM

Previous topic - Next topic

mzimmer74

It seems like a lot of the ideas people are having could be solved by allowing easy picking of multiple items much like you can in the regular game.  For example, double clicking on a spore tower would select all spore towers in the nearby area or using a selection box to select all items within it.  I don't know if that is even possible, but it seems like that would solve a lot of the issues without having to create buttons or hotkeys for each type of action.
Omnipotence doesn't mean the ability to do what is logically impossible. It's possible, therefore, for God to create beings with the kind of free will that can choose between good and evil, but he can't also force those creatures to choose good. If he forced their choice, it wouldn't be free.

Hubs

Quote from: mzimmer74 on December 06, 2014, 11:21:40 AM
It seems like a lot of the ideas people are having could be solved by allowing easy picking of multiple items much like you can in the regular game.  For example, double clicking on a spore tower would select all spore towers in the nearby area or using a selection box to select all items within it.  I don't know if that is even possible, but it seems like that would solve a lot of the issues without having to create buttons or hotkeys for each type of action.

I really like the idea but it would be difficult to implement. Double click to select near by towers plus shift click to add to selection plus drag box select. I can look at the code but no promises!

stdout

I think a button that resets all spore towers would be perfect.

Hubs

Or maybe just set them all to match the tower with the most time. I'll try to do that.

teknotiss

Quote from: Hubs on December 06, 2014, 01:12:59 PM
Or maybe just set them all to match the tower with the most time. I'll try to do that.

perhaps a delay by "x" secs function for the towers? that could help a bit with spore assault timings.
not critical though, multi select is more of a wish! ;)
"Is God willing to prevent evil, but not able? Then he is not omnipotent.... Is he able, but not willing? Then he is malevolent.... Is he both able and willing? Then whence cometh evil?.... Is he neither able nor willing? Then why call him God?" --- Epicurus

RrR

A button that resets the timer on all the spore towers wouldn't help they way I play much.

When I synchronise the spores, I launch the spore furthest from target first, then launch the others as this spore passes by their tower, so the spores all reach their target at (ideally) the same time.

Synchronised landing rather than synchronised launching. Yes I micromanage.

If this could be automated, it would save a lot of fiddling (but I accept that it is much more work than resetting the timers). Just having an all tower pause button would save half the effort.

DestinyAtlantis

#36
Selection box as a whole is easy to implement if you have 2 functions, button press down, and button release, just take the coordinates of the first and the second, and you have a box, but then there are also specific types of units, so maybe with priority? If you have structures type x and y, select only x (with higher priority), which may be a bit harder, i have coded very little, so i don't know if there are GetUnitsWithinRectangleCoords functions or anything like that, well only GetUnitsWithinRange or something, but that's for a circle.

Hm, it will probably be too complex (both to implement and use), but a button to both reset timers and target that spot (T style), but with smart timer resets( i.e the furthest becomes 20 seconds, and the rest depending on the distance the spores have to travel so they land at the same time (within 1 second accuracy if the timer is int based), so i'd guess up to about 30-40 seconds depending on map size). Like how RrR does it manually.
Technically this should be simple to implement, but it will probably confuse the new players too much to have 5 buttons doing select all and do something.
Somehow get the tower the farthest from the target point and set it's distance to a variable (let's say BaseDistance) and BaseTimer, then for every selected tower (or all if selection never gets implemented) and set the timer to BaseTimer+(BaseDistance-CurrentDistance)/SporeSpeed, where BaseTimer is the timer for the first spore launch (currently set to 20-19 seconds), SporeSpeed is the current spore speed and CurrentDistance is the distance between the specific spore tower and the target point.

Hubs

Quote from: DestinyAtlantis on December 06, 2014, 01:58:31 PM
Selection box as a whole is easy to implement if you have 2 functions, button press down, and button release, just take the coordinates of the first and the second, and you have a box, but then there are also specific types of units, so maybe with priority? If you have structures type x and y, select only x (with higher priority), which may be a bit harder, i have coded very little, so i don't know if there are GetUnitsWithinRectangleCoords functions or anything like that, well only GetUnitsWithinRange or something, but that's for a circle.

Hm, it will probably be too complex (both to implement and use), but a button to both reset timers and target that spot (T style), but with smart timer resets( i.e the furthest becomes 20 seconds, and the rest depending on the distance the spores have to travel so they land at the same time (within 1 second accuracy if the timer is int based), so i'd guess up to about 30-40 seconds depending on map size). Like how RrR does it manually.
Technically this should be simple to implement, but it will probably confuse the new players too much to have 5 buttons doing select all and do something.
Somehow get the tower the farthest from the target point and set it's distance to a variable (let's say BaseDistance) and BaseTimer, then for every selected tower (or all if selection never gets implemented) and set the timer to BaseTimer+(BaseDistance-CurrentDistance)/SporeSpeed, where BaseTimer is the timer for the first spore launch (currently set to 20-19 seconds), SporeSpeed is the current spore speed and CurrentDistance is the distance between the specific spore tower and the target point.

I agree that it wouldn't be that hard to implement a selection box by itself but there is so much going on with other mouse interactions with the build buttons, digitalis placement, tower building, fields, targeting, and supporting. Without very careful programming you would end up with "collision" which means you unintentially are triggering multiple things at once such as targeting and selecting towers at the same time. Someone else is welcome to try to implement that if they have the patience for it :)

For the spore targeting synchronized landing of spores should be possible with the method you described but it could get complex with large maps in which it takes over 20 seconds to hit the target. Maybe 10% of the hardcore PAC players would use it effectively. You also start getting into way too many commands with all this automated micro management. Players gotta play a little too :)

Hubs

Ok, so here's where I'm at with the template:

For creating a map, it's extremely simple now: basically create the map then play. It converts to a PAC map after one frame, so you can keep it paused and press "N", then save and publish. For testing just make sure you don't save after it converts, although I have a really easy way to convert it back to an editable state. I also added shortcuts "U" for emitters and "I" for Spore Towers which will create them while you're building the map.

For the actual game added "Y" for emitters to stop supporting and all go back to normal mode, or "Y" for spore towers to all go to auto target mode.

When a spore tower is selected you will now have a smaller version of the target circle under the mouse. This should help to indicate that you have a spore tower selected and that you can set a new target.

When a spore tower's target is shown (In red when it's about to fire) and you don't already have a tower selected, you can click on the red target. This will select the tower for you and you can set a new target (A lot like berthas in the normal game)

I also completely rewrote Abraxis, which is the AI that rebuilds stuff, so that it runs about 10 times faster.  It used to check for connections and a bunch of other stuff but I found a much simpler way to do it. This has two main effects: (1) your game should run with a lot less lag on larger maps and (2) buildings will rebuild much faster (especially on large maps). The old script would only attempt to rebuild 10 buildings per frame. The new one attempts 25 per frame.

Temp.crpl has also been completely rewritten. On the template you start with a blank map and one core that has Temp.crpl. When the map loads it completely removes all PAC cores (other than placed towers) so that you should never have an issue with finalizing a map. If you accidentally save your map in PAC mode, all you have to do is add a core, give it Temp.crpl, then save and reload your map. It will completely return it back to edit mode. This script will also display the steps to make a PAC map in game in edit mode.

I also plan on including a ReadMe document that will completely explain how to create a PAC map. I'll also include instructions on changing some of the parameters, such as emitter amount, and instructions for including additional crpl scripts to the gameplay for new scripted events.

Michionlion

Wow, this sounds amazing Hubs!  I guess I'll have to get back into this...  wonder what kind of goodies I can make with PAC maps...  :P
"Remember kids, the only difference between science and messing around is writing it down."
                                                                                                                         - Adam Savage

My website
My CW1, and CW2 maps!

stdout

Outstanding, Hubs. You're bringing an early Christmas present for many of us.

teknotiss

Quote from: Hubs on December 06, 2014, 09:49:12 PM
Ok, so here's where I'm at with the template:

Spoiler
For creating a map, it's extremely simple now: basically create the map then play. It converts to a PAC map after one frame, so you can keep it paused and press "N", then save and publish. For testing just make sure you don't save after it converts, although I have a really easy way to convert it back to an editable state. I also added shortcuts "U" for emitters and "I" for Spore Towers which will create them while you're building the map.

For the actual game added "Y" for emitters to stop supporting and all go back to normal mode, or "Y" for spore towers to all go to auto target mode.

When a spore tower is selected you will now have a smaller version of the target circle under the mouse. This should help to indicate that you have a spore tower selected and that you can set a new target.

When a spore tower's target is shown (In red when it's about to fire) and you don't already have a tower selected, you can click on the red target. This will select the tower for you and you can set a new target (A lot like berthas in the normal game)

I also completely rewrote Abraxis, which is the AI that rebuilds stuff, so that it runs about 10 times faster.  It used to check for connections and a bunch of other stuff but I found a much simpler way to do it. This has two main effects: (1) your game should run with a lot less lag on larger maps and (2) buildings will rebuild much faster (especially on large maps). The old script would only attempt to rebuild 10 buildings per frame. The new one attempts 25 per frame.

Temp.crpl has also been completely rewritten. On the template you start with a blank map and one core that has Temp.crpl. When the map loads it completely removes all PAC cores (other than placed towers) so that you should never have an issue with finalizing a map. If you accidentally save your map in PAC mode, all you have to do is add a core, give it Temp.crpl, then save and reload your map. It will completely return it back to edit mode. This script will also display the steps to make a PAC map in game in edit mode.

I also plan on including a ReadMe document that will completely explain how to create a PAC map. I'll also include instructions on changing some of the parameters, such as emitter amount, and instructions for including additional crpl scripts to the gameplay for new scripted events.
[close]

cool dude! that is great, we'll whack that completed map at the front of this thread (or i'll start a new one and see if we get it stickied)

i particularly like the bertha style target selecting. was gonna ask but forgot! ;)
and the simplified setup and also seemingly simple resetting of the PAC scripts is excellent.
code monkey of the month award for you dude!
"Is God willing to prevent evil, but not able? Then he is not omnipotent.... Is he able, but not willing? Then he is malevolent.... Is he both able and willing? Then whence cometh evil?.... Is he neither able nor willing? Then why call him God?" --- Epicurus

teknotiss

runners, and what to do about them?
i was sort of thinking we could have runners nests on ore mines, but it'd mean no ac for abraxis if a mapper didn't want runners ???
and i do want them sometimes, but not spawning from towers or emitters.
what to do?  ::)
suggestions? 
"Is God willing to prevent evil, but not able? Then he is not omnipotent.... Is he able, but not willing? Then he is malevolent.... Is he both able and willing? Then whence cometh evil?.... Is he neither able nor willing? Then why call him God?" --- Epicurus

DestinyAtlantis

Aside from a fifth button for runner nests that can be disabled by the map maker?

teknotiss

Quote from: DestinyAtlantis on December 08, 2014, 02:59:49 PM
Aside from a fifth button for runner nests that can be disabled by the map maker?
i was under the impression that'd be tricky, but it would be the simplest solution yes ::) ;)
"Is God willing to prevent evil, but not able? Then he is not omnipotent.... Is he able, but not willing? Then he is malevolent.... Is he both able and willing? Then whence cometh evil?.... Is he neither able nor willing? Then why call him God?" --- Epicurus