Player scripting with Lua?

For what's not in 'Top Priority Game Design'. Post your ideas, visions, suggestions for the game, rules, modifications, etc.

Moderators: Oberlus, Oberlus

Post Reply
Message
Author
PeterM_20492
Space Krill
Posts: 4
Joined: Sun Apr 21, 2019 2:03 am

Player scripting with Lua?

#1 Post by PeterM_20492 » Sun Apr 21, 2019 2:13 am

Hello,

Just wondering if anyone has considered providing player scripting with Lua.
Empire maintenance gets awfully tedious and I would like to script some logic to, for example, initiate builds of Basic Shipyard and Drydock when there's no other one of these in-system (or according to other rules I decide upon and script in.)

Later on in the game, I'd like to script 'auto-improve' planets, just queueing up terraforming and gaia transform if available.

Or a script that goes through the queue and puts ship builds at the top and terraforming and gaia transforms on the bottom.

If people got really sophisticated with their scripts, they could AI a "player" and have contests about whose player is the best.

Lua is "cool" because it's designed to be an embedded scripting language.


If I did this, would it be considered for inclusion in the code base?

Best,

--PeterM

User avatar
Vezzra
Release Manager, Design
Posts: 4928
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Player scripting with Lua?

#2 Post by Vezzra » Sun Apr 21, 2019 1:16 pm

We have already two scripting languages in FO, one self-designed (FOCS) for scripting game contents, and Python for the AI and universe generation scripts. The (long-term) plan is to replace FOCS with Python, not to add yet another scripting language to the mix.

So, if we wanted to include scripted player actions, extending the already present Python API would be the way to go.

That said, for the cases you cited this actually should not be done, because if you find something in the game that wants to make you use scripts to automate it (because you perceive it that repetitive and boring), than that means we've failed to meet our design goal and the game element/mechanic is in need of revision. There shouldn't be anything in the game that requires boring and repetitive micromanagement that can be done by a script.

I know that we currently have such elements/mechanics in FO, but the way to fix this is to redesign/revise those elements/mechanics properly. At least that's the plan.

PeterM_20492
Space Krill
Posts: 4
Joined: Sun Apr 21, 2019 2:03 am

Re: Player scripting with Lua?

#3 Post by PeterM_20492 » Sun Jun 16, 2019 2:37 pm

Hello, thanks for the response. Python would absolutely work, it's actually my favorite scripting language, and it's a better idea than including Lua, because as you point out, it's already in use.

I still support exposing scripting capability to the players, because one player's boring and repetitive is maybe another player's fun, and a lot of people who use Linux just like to program.

Here're some more things that I find boring and repetitive, and it applies to large empires/galaxies mostly. For small ones, micromanaging is just fine.
1) Build-up of a planet into a forward operating base. The steps involved are always the same and always require user intervention: Build outpost ship, send outpost, build colony, build shipyard, build drydock, and you have to notice all this stuff not to miss a turn.
2) Repetitive-stress-inducing mouse movements. Go to system of interest. Mouse over to planet, click it. Mouse over to build menu, click item you want to build. How about this: mouse over to system, right click, up pops up planet window, right click planet, up pops construction menu, less mouse movements. Include hot keys in the pop up menus so you can use the keyboard, with multiple styles of hotkeys: numbers or left-handed keys or right-handed keys. A better UI would, as you said, reduce need for scripting.

--PM

User avatar
The Silent One
Graphics
Posts: 887
Joined: Tue Jul 01, 2003 8:27 pm

Re: Player scripting with Lua?

#4 Post by The Silent One » Sun Jun 16, 2019 4:51 pm

PeterM_20492 wrote:
Sun Jun 16, 2019 2:37 pm
mouse over to system, right click, up pops up planet window, right click planet, up pops construction menu
Double-clicking a system or a planet does just that.
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

User avatar
Oberlus
Cosmic Dragon
Posts: 1290
Joined: Mon Apr 10, 2017 4:25 pm

Re: Player scripting with Lua?

#5 Post by Oberlus » Sun Jun 16, 2019 4:54 pm

The Silent One wrote:
Sun Jun 16, 2019 4:51 pm
PeterM_20492 wrote:
Sun Jun 16, 2019 2:37 pm
mouse over to system, right click, up pops up planet window, right click planet, up pops construction menu
Double-clicking a system or a planet does just that.
Maybe he means that you have to move mouse from right side of the screen (planets) to left side (building items list). This has inspired me to rearrange my windows, so that building items and planets are on the same side. Problem with this is it makes hard-to-impossible to keep the centre of the screen free of windows, and so clicking on an object name in the sitreps does not centre your view (from your perspective) since you'd like to consider the centre of your view displaces to one side.

User avatar
The Silent One
Graphics
Posts: 887
Joined: Tue Jul 01, 2003 8:27 pm

Re: Player scripting with Lua?

#6 Post by The Silent One » Sun Jun 16, 2019 5:58 pm

Oberlus wrote:
Sun Jun 16, 2019 4:54 pm
Maybe he means that you have to move mouse from right side of the screen (planets) to left side (building items list).
Ah. I guess he means a pop-up menu like:

Code: Select all

planets     >> planet 1
            >> planet 2
            >> planet 3 >> Add Building
                        >> Add Ship      >> Colony Ship
                                         >> Scout
That does sound like a good idea. PeterM, would you create a feature request on github? https://github.com/freeorion/freeorion/issues
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

PeterM_20492
Space Krill
Posts: 4
Joined: Sun Apr 21, 2019 2:03 am

Re: Player scripting with Lua?

#7 Post by PeterM_20492 » Sun Jun 16, 2019 11:33 pm

Oberus, you're quite right, the sweep of the mouse across the screen is bothersome to me--sweep, aim, scroll through menu, double click what I want, sweep back.

I think you're closer to the idea, Silent One. I had in mind something like the pop up menus that come up when I mouse-click into open space in KDE, and then hotkeys to navigate quickly.

OK, I'll create a feature request, Silent One.

Thanks,

--PeterM

User avatar
The Silent One
Graphics
Posts: 887
Joined: Tue Jul 01, 2003 8:27 pm

Re: Player scripting with Lua?

#8 Post by The Silent One » Mon Jun 17, 2019 6:11 am

PeterM_20492 wrote:
Sun Jun 16, 2019 11:33 pm
I think you're closer to the idea, Silent One. I had in mind something like the pop up menus that come up when I mouse-click into open space in KDE, and then hotkeys to navigate quickly.
It shouldn't be too hard to do, the code is already there in ObjectsWnd and just needs to be modified for MapWnd.
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

Post Reply