aliens

Author Topic: 16B Patch  (Read 11308 times)

Offline Stoddard

  • Colonel
  • ****
  • Posts: 485
  • in a fey mood
    • View Profile
    • Linux builds & stuff
16B Patch
« on: August 17, 2016, 12:35:44 am »
While hammering away on my Geoscape AI project I got sick of being bitten in the ass with the 8-base limitation.

The AI in the current form just doesn't forgive any interception, and if the base responsible was in detection range of faction being intercepted, and if they have particularly bitter hangover at the moment (which they usually do), and they have enough forces at the ready, there goes your base. So bases became that much more disposable. Just hope the crackdown is detected so you can cheat and transfer all the stuff away (to be fixed, so that you won't be able to do that in a couple of clicks :) ). Also I'm experimenting with reducing detection range in favor of scan frequency. This obviously raises number of bases needed.

Long story short, here's a minimal patch extending max number of bases  to 16.

After you build 9th base, the 'NEW HIDEOUT' button is replaced by the second row of bases. To build more, click on an empty base slot.

The click works before that too.
12B

I guess a ruleset setting is needed instead of hardcoded constants like 8 or 16.

I got lost in git right now, so here's the patch if anyone's interested:

Spoiler:
diff --git a/src/Basescape/BasescapeState.cpp b/src/Basescape/BasescapeState.cpp
index 76738cd..3988e12 100644
--- a/src/Basescape/BasescapeState.cpp
+++ b/src/Basescape/BasescapeState.cpp
@@ -68,7 +68,13 @@ BasescapeState::BasescapeState(Base *base, Globe *globe) : _base(base), _globe(g
        https:// Create objects
        _txtFacility = new Text(192, 9, 0, 0);
        _view = new BaseView(192, 192, 0, 8);
+       if ( _game->getSavedGame()->getBases()->size() > MiniBaseView::ROW_BASES) {
+               _mini = new MiniBaseView(128, 32, 192, 38);
+       }
+       else
+       {
        _mini = new MiniBaseView(128, 16, 192, 41);
+       }
        _edtBase = new TextEdit(this, 127, 17, 193, 0);
        _txtLocation = new Text(126, 9, 194, 16);
        _txtFunds = new Text(126, 9, 194, 24);
@@ -203,8 +209,7 @@ void BasescapeState::init()
        }
 
        _txtFunds->setText(tr("STR_FUNDS").arg(Text::formatFunding(_game->getSavedGame()->getFunds())));
-
-       _btnNewBase->setVisible(_game->getSavedGame()->getBases()->size() < MiniBaseView::MAX_BASES);
+       _btnNewBase->setVisible(_game->getSavedGame()->getBases()->size() <= MiniBaseView::ROW_BASES);
 }
 
 /**
@@ -480,7 +485,7 @@ void BasescapeState::viewMouseOut(Action *)
  * Selects a new base to display.
  * @param action Pointer to an action.
  */
-void BasescapeState::miniLeftClick(Action *)
+void BasescapeState::miniLeftClick(Action *unused)
 {
        size_t base = _mini->getHoveredBase();
        if (base < _game->getSavedGame()->getBases()->size())
@@ -488,13 +493,17 @@ void BasescapeState::miniLeftClick(Action *)
                _base = _game->getSavedGame()->getBases()->at(base);
                init();
        }
+       else
+       {
+               btnNewBaseClick(unused);
+       }
 }
 
 /**
  * Opens a dialog to make the selected base your HQ.
  * @param action Pointer to an action.
  */
-void BasescapeState::miniRightClick(Action *)
+void BasescapeState::miniRightClick(Action *unused)
 {
        size_t baseIndex = _mini->getHoveredBase();
 @@ -510,6 +519,10 @@ void BasescapeState::miniRightClick(Action *)
                        _game->pushState(new ChangeHeadquartersState(_game->getSavedGame()->getBases()->at(baseIndex)));
                }
        }
+       else
+       {
+               btnNewBaseClick(unused);
+       }
 }
 
 /**
diff --git a/src/Basescape/MiniBaseView.cpp b/src/Basescape/MiniBaseView.cpp
index 0ab1e4a..973197b 100644
--- a/src/Basescape/MiniBaseView.cpp
+++ b/src/Basescape/MiniBaseView.cpp
@@ -94,18 +94,20 @@ void MiniBaseView::draw()
        Surface::draw();
        for (size_t i = 0; i < MAX_BASES; ++i)
        {
+               int cell_x = (i % ROW_BASES) * (MINI_SIZE + 2);
+               int cell_y = (i / ROW_BASES) * (MINI_SIZE + 2);
                https:// Draw base squares
                if (i == _base)
                {
                        SDL_Rect r;
-                       r.x = i * (MINI_SIZE + 2);
-                       r.y = 0;
+                       r.x = cell_x;
+                       r.y = cell_y;
                        r.w = MINI_SIZE + 2;
                        r.h = MINI_SIZE + 2;
                        drawRect(&r, 1);
                }
-               _texture->getFrame(41)->setX(i * (MINI_SIZE + 2));
-               _texture->getFrame(41)->setY(0);
+               _texture->getFrame(41)->setX(cell_x);
+               _texture->getFrame(41)->setY(cell_y);
                _texture->getFrame(41)->blit(this);
 
                https:// Draw facilities
@@ -121,8 +123,8 @@ void MiniBaseView::draw()
                                else
                                        color = _red;
 
-                               r.x = i * (MINI_SIZE + 2) + 2 + (*f)->getX() * 2;
-                               r.y = 2 + (*f)->getY() * 2;
+                               r.x = cell_x + 2 + (*f)->getX() * 2;
+                               r.y = cell_y + 2 + (*f)->getY() * 2;
                                r.w = (*f)->getRules()->getSize() * 2;
                                r.h = (*f)->getRules()->getSize() * 2;
                                drawRect(&r, color+3);
@@ -156,6 +158,7 @@ void MiniBaseView::draw()
 void MiniBaseView::mouseOver(Action *action, State *state)
 {
        _hoverBase = (int)floor(action->getRelativeXMouse() / ((MINI_SIZE + 2) * action->getXScale()));
+       _hoverBase += (int)floor(action->getRelativeYMouse() / ((MINI_SIZE + 2) * action->getYScale())) * ROW_BASES;
        InteractiveSurface::mouseOver(action, state);
 }
 
diff --git a/src/Basescape/MiniBaseView.h b/src/Basescape/MiniBaseView.h
index 9168634..0bef494 100644
--- a/src/Basescape/MiniBaseView.h
+++ b/src/Basescape/MiniBaseView.h
@@ -43,7 +43,8 @@ private:
        size_t _base, _hoverBase;
        Uint8 _red, _green;
 public:
-       static const size_t MAX_BASES = 8;
+       static const size_t MAX_BASES = 16;
+       static const size_t ROW_BASES = 8;
        https:/// Creates a new mini base view at the specified position and size.
        MiniBaseView(int width, int height, int x = 0, int y = 0);
        https:/// Cleans up the mini base view.



EDIT: yea, it doesn't show extra bases in Logs screen, I know
« Last Edit: August 17, 2016, 01:04:37 am by Stoddard »

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Re: 16B Patch
« Reply #1 on: August 17, 2016, 01:47:58 am »
You might be interested to look into this then:
- https://github.com/fenyo1/OpenXcom/tree/InfiniteBaseSizes
- https://github.com/fenyo1/OpenXcom/tree/UnlimitedBases

Unlimited potential if you'd like more bases. And if your AI can take them out more reliably, maybe the feature won't appear as broken to the community as it did back when it was presented.

Offline Dioxine

  • Commander
  • *****
  • Posts: 5451
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: 16B Patch
« Reply #2 on: August 17, 2016, 08:18:53 am »
This won't fly without global limits on the number of buildings, or people (extendable by progressively more expensive command buildings?); 8 bases is much more than enough to build up more industry and soldier capacity than you'll ever need in this gameplay model. However, say, 4 large bases + 12 outposts (radar + sam sites? would be nice if SAMs could engage fly-bys, and required ammo) would be much more reasonable (and manageable).

Offline nrafield

  • Captain
  • ***
  • Posts: 77
    • View Profile
Re: 16B Patch
« Reply #3 on: August 17, 2016, 09:04:19 am »
Usually in these situations I just build my bases so that living quarters are next to a hangar and can shoot a Chinese Dragon into it. Although, that may stop working so well once it's the Mercenaries who start visiting my bases and not the Spartans.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11583
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: 16B Patch
« Reply #4 on: August 17, 2016, 11:05:38 am »
Usually in these situations I just build my bases so that living quarters are next to a hangar and can shoot a Chinese Dragon into it. Although, that may stop working so well once it's the Mercenaries who start visiting my bases and not the Spartans.

The problem isn't with base layout, only that it is viable to build more and more bases and turn most of them into manufacturing plants, making exponentially more money. This needs some investment, but in the long run would kill the campaign, since you could afford everything, no limits.

Dioxine proposes a de facto differentiation between types of bases, so you could have standard ones (with a limit) and some other types, where you can't build industry (possibly limited). Which is a fine idea game-wise, but it would need a logical explanation of why you can't do some stuff there.

Offline Dioxine

  • Commander
  • *****
  • Posts: 5451
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: 16B Patch
« Reply #5 on: August 17, 2016, 12:07:15 pm »
Money is one problem, management is the other. You will invest in more soldiers, scientists and engineers, because that pays off, but at some point, the game would turn into micromanaging hell.
Third problem, related, is, the game model designed for 30-40 soldiers, will come apart if you have hundreds or thousands of soldiers, both mechanics- and lore- wise.
Perhaps enforcing staff limitations is the simplest way out (since radars and storage facilities do not require staff).

Offline nrafield

  • Captain
  • ***
  • Posts: 77
    • View Profile
Re: 16B Patch
« Reply #6 on: August 17, 2016, 03:38:47 pm »
The problem isn't with base layout, only that it is viable to build more and more bases and turn most of them into manufacturing plants, making exponentially more money. This needs some investment, but in the long run would kill the campaign, since you could afford everything, no limits.

Dioxine proposes a de facto differentiation between types of bases, so you could have standard ones (with a limit) and some other types, where you can't build industry (possibly limited). Which is a fine idea game-wise, but it would need a logical explanation of why you can't do some stuff there.
Oh yeah, that as well. Not like spending money isn't a problem already because there are already tons of ways to make millions with ease. It's just going to be hell to keep track of 16 bases anyway, especially when the compulsory monthly Crackdown missions come along. Although by that time you'll probably be able to shoot ALL of them down...which is somewhat a problem by itself.

Offline Stoddard

  • Colonel
  • ****
  • Posts: 485
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: 16B Patch
« Reply #7 on: August 17, 2016, 10:21:08 pm »
I think the micromanagement hell is in itself quite effective a limitation. In my current campaign, 1 research/industry base, 2 industry bases, 3 raiding bases and 1 pure outpost (radar/hangar) and I already resorted to writing inventory management tools, and that's just 7 of them.

It's that limited detection ranges and hyperaggressive retaliations require more bases overall present, and some backups 'in the pipeline', being built to replace neighbours that will fall. Nice money sink too. More than 16 though, and it'd turn into micromanagement hell of its own.

I also don't actually hit 30-40 soldier threshold, so to speak. Detachments of ~20 soldiers sit on some of the bases, but 3-5 are usually wounded, another 5 or so in reserve, and the craft carries 8-10. So I might have 30 active, 30 inactive, plus about 30 training up, any more and micromanagement bites again (and also is not needed).

So in fact I don't feel that introducing some base type subdivision is worth it. Those who overbuild will be punished as it is.


EDIT:
My perception might be biased by the geoscape work, which certainly changes the gameplay model, and in many ways I don't yet know.
But trying the patch in regular piratez, I never even considered building anything but an outpost, hangar and hyperwave detector on the extra bases. It's just not worth the hassle.
« Last Edit: August 17, 2016, 10:24:28 pm by Stoddard »

Offline Stoddard

  • Colonel
  • ****
  • Posts: 485
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: 16B Patch
« Reply #8 on: August 17, 2016, 10:33:24 pm »
The overabundance of money is a separate concern, and if it kills the campaign, then it is already dead, and a dozen more bases won't make it deader. I feel it should be solved not by directly limiting industry, but the market for the produce.

Offline Star_Treasure

  • Captain
  • ***
  • Posts: 96
    • View Profile
Re: 16B Patch
« Reply #9 on: August 18, 2016, 07:20:51 am »
As I mentioned before, the Guild and or the Church should raid bases that sell too much bootleg X-grog.

Offline Surrealistik

  • Colonel
  • ****
  • Posts: 485
    • View Profile
Re: 16B Patch
« Reply #10 on: August 18, 2016, 08:35:50 am »
As I mentioned before, the Guild and or the Church should raid bases that sell too much bootleg X-grog.

I'm not sure what purpose this would serve; is the intent narrative or gameplay related? In the case of the latter as an attempt to curb income from bootlegging, all this will practically do is further increase the player's wealth (if he has prepared any kind of adequate defense).

Offline Dioxine

  • Commander
  • *****
  • Posts: 5451
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: 16B Patch
« Reply #11 on: August 18, 2016, 11:25:06 am »
The overabundance of money is a separate concern, and if it kills the campaign, then it is already dead, and a dozen more bases won't make it deader. I feel it should be solved not by directly limiting industry, but the market for the produce.

You're right, direct limitation of industry is a bad solution. What I stressed was that the existing gameplay model breaks apart at some point; problems visible with 8 bases will be even more pronounced with 16. To handle this, some change of the model is needed. Solutions to these problems, as I see them:
- Administrative limitations. Limits on the number of personnel (exceedable only at a huge cost). This isn't a hard limit, and it's a natural limit: how many people can you command directly?
- Security limitations: More aggressive enemy, more enemy actions when your business gets too big (sabotage of various kinds, security problems).
- Market limitations: Some kind of market model, limiting the amount of goods you can sell monthly and/or changing prices.  Related: limits on how many people you can hire monthly.

You can't really keep adding new bases without adressing these problems IMO; moving from small organization simulator to a state simulator can't be done without adding statehood mechanics.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11583
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: 16B Patch
« Reply #12 on: August 18, 2016, 12:36:53 pm »
OK, I'll think about adding some/all of this to the Wishlist.

Offline Dioxine

  • Commander
  • *****
  • Posts: 5451
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: 16B Patch
« Reply #13 on: August 18, 2016, 12:52:44 pm »
Not sure we want that; do we really want OXCom to become a state simulator?

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11583
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: 16B Patch
« Reply #14 on: August 18, 2016, 12:56:10 pm »
Not sure we want that; do we really want OXCom to become a state simulator?

I don't know, that's why I'll think :)