Potential replacement of FOCS with Python

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Message
Author
Ophiuchus
Programmer
Posts: 3427
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Potential replacement of FOCS with Python

#76 Post by Ophiuchus »

o01eg wrote: Thu Mar 11, 2021 8:57 am Finished minimal techs parser for two techs Algorithmic Elegance and Orbital Habitation.
Congrats! Hope to have a look soon.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Potential replacement of FOCS with Python

#77 Post by o01eg »

It left to convert less then twenty techs so I think its time to choose what convert next.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Potential replacement of FOCS with Python

#78 Post by o01eg »

Techs are finished. Now it's remaining to clean up unused macros files and old tokens from parser.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

Ophiuchus
Programmer
Posts: 3427
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Potential replacement of FOCS with Python

#79 Post by Ophiuchus »

Congrats again. Great milestone!
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

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

Re: Potential replacement of FOCS with Python

#80 Post by Vezzra »

o01eg wrote: Wed Aug 10, 2022 1:33 pm It left to convert less then twenty techs so I think its time to choose what convert next.
You are probably the one who's guess is the best regarding what to convert next...

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Potential replacement of FOCS with Python

#81 Post by o01eg »

We have token Species which depending of context produce Condition::Species or species declaration. Maybe rename condition to IsSpecies to remove ambiguous token? Not for old FOCS parser but at least for Python FOCS?
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

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

Re: Potential replacement of FOCS with Python

#82 Post by Oberlus »

+1

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Potential replacement of FOCS with Python

#83 Post by o01eg »

Same with Focus as condition and declaration. Should be declaration use FocusType same as C++ class name or rename condition to HasFocus?
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Potential replacement of FOCS with Python

#84 Post by o01eg »

Found EmpireStockpile used as condition and value. Maybe rename condition to HasEmpireStockpile or value to GetEmpireStockpile?

Also Building used as declaration and condition. I suppose condition should be renamed to IsBuilding as it matches building itself?
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

Ophiuchus
Programmer
Posts: 3427
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Potential replacement of FOCS with Python

#85 Post by Ophiuchus »

one question: how does one debug errors in the focs.py files? i get black screens when starting a game and no error messages.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Potential replacement of FOCS with Python

#86 Post by o01eg »

Ophiuchus wrote: Wed Oct 12, 2022 1:58 pm one question: how does one debug errors in the focs.py files? i get black screens when starting a game and no error messages.
Log should contains errors. Maybe rethrow exception if parsing failed?
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

Ophiuchus
Programmer
Posts: 3427
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Potential replacement of FOCS with Python

#87 Post by Ophiuchus »

o01eg wrote: Wed Oct 12, 2022 2:01 pm
Ophiuchus wrote: Wed Oct 12, 2022 1:58 pm one question: how does one debug errors in the focs.py files? i get black screens when starting a game and no error messages.
Log should contains errors. Maybe rethrow exception if parsing failed?
i get things like:

Code: Select all

16:47:36.799612 {0x00007fc1b3568780} [error] server : PythonCommon.cpp:101 : Traceback (most recent call last):
16:47:36.799670 {0x00007fc1b3568780} [error] server : PythonCommon.cpp:101 :   File "<string>", line 63, in <module>
16:47:36.799680 {0x00007fc1b3568780} [error] server : PythonCommon.cpp:101 : TypeError: unsupported operand type(s) for +: 'float' and 'ValueRefInt'
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Potential replacement of FOCS with Python

#88 Post by o01eg »

Ophiuchus wrote: Wed Oct 12, 2022 2:52 pm i get things like:

Code: Select all

16:47:36.799612 {0x00007fc1b3568780} [error] server : PythonCommon.cpp:101 : Traceback (most recent call last):
16:47:36.799670 {0x00007fc1b3568780} [error] server : PythonCommon.cpp:101 :   File "<string>", line 63, in <module>
16:47:36.799680 {0x00007fc1b3568780} [error] server : PythonCommon.cpp:101 : TypeError: unsupported operand type(s) for +: 'float' and 'ValueRefInt'
Yes, some operators not fully implemented for any combinations of arguments. I'll make PR to add it.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

Ophiuchus
Programmer
Posts: 3427
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Potential replacement of FOCS with Python

#89 Post by Ophiuchus »

o01eg wrote: Wed Oct 12, 2022 2:59 pm
Ophiuchus wrote: Wed Oct 12, 2022 2:52 pm i get things like:

Code: Select all

16:47:36.799612 {0x00007fc1b3568780} [error] server : PythonCommon.cpp:101 : Traceback (most recent call last):
16:47:36.799670 {0x00007fc1b3568780} [error] server : PythonCommon.cpp:101 :   File "<string>", line 63, in <module>
16:47:36.799680 {0x00007fc1b3568780} [error] server : PythonCommon.cpp:101 : TypeError: unsupported operand type(s) for +: 'float' and 'ValueRefInt'
Yes, some operators not fully implemented for any combinations of arguments. I'll make PR to add it.
isnt this one the right one?

Code: Select all

value_ref_wrapper<double> operator*(double lhs, const value_ref_wrapper<int>& rhs) {
actually i am looking for a cast from int valueref to double valueref
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Potential replacement of FOCS with Python

#90 Post by o01eg »

Ophiuchus wrote: Wed Oct 12, 2022 3:09 pm isnt this one the right one?

Code: Select all

value_ref_wrapper<double> operator*(double lhs, const value_ref_wrapper<int>& rhs) {
actually i am looking for a cast from int valueref to double valueref
No, it's a times operation not plus.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

Post Reply