View previous topic :: View next topic |
Author |
Message |
jlangsdo
Cutthroat
Posts: 399
10932 Gold -
|
Posted: Mon Apr 22, 2019 3:17 pm Post subject: c++ version of savegame editor |
|
|
Ahoy!
It's been a long time, I'm amazed to see that this site keeps going!
I decided that I wanted to learn c++, and thought that a nice size project to learn with would be rewriting my pirates savegame editor. The perl code for it was really nasty, so a big part of this project was untangling all of that.
This new version is about 8x faster than the perl version, not that runtime was ever really much of an issue. [Also, to be fair to perl, I never ran it through the perl profiler to look for easy speedups.] One big surprise for me was that regex are really slow in c++, at least compared to string operations like find and substr.
So, here it is on github:
https://github.com/jlangsdo/pirates_savegame_editor
I wrote this in Xcode on my mac. I have no idea how to build it on another machine.
Actually, if you have a mac it looks like github makes it easy to get into Xcode, then Build->For Profiling and look for the release version in a crazily named directory:
/Users/$USER/Library/Developer/Xcode/DerivedData/pirates_savegame_editor-*/Build/Products/Release/
I should probably remove the use of 'boost' functions so you wouldn't need to install boost to make it work.
Anyone out there want to work with me to figure out porting, and we can post a README on how to install it? It would be especially useful if you run on Windows. |
|
Back to top |
|
|
fleetp
Boatswain
Posts: 3854
37201 Gold -
|
Posted: Mon Apr 22, 2019 5:02 pm Post subject: |
|
|
Holy mackerel! Welcome back! |
|
Back to top |
|
|
Pirate
Helmsman
Posts: 5665
112704 Gold -
|
Posted: Tue Apr 23, 2019 1:56 am Post subject: |
|
|
Welcome Back! |
|
Back to top |
|
|
parksbanyon
Gunner
Posts: 565
13127 Gold -
|
Posted: Fri May 17, 2019 12:24 pm Post subject: welcome back |
|
|
Any other winblows users out there to help with the porting? When I go thru the savegame editor I reach a "main.cpp" I can download....this should be the main body coding..?..? |
|
Back to top |
|
|
parksbanyon
Gunner
Posts: 565
13127 Gold -
|
Posted: Fri May 17, 2019 12:32 pm Post subject: got i all |
|
|
had to use firefox to get the entire download |
|
Back to top |
|
|
corsair91
Sailing Master
Posts: 8189
221101 Gold -
|
Posted: Wed Mar 11, 2020 2:25 am Post subject: |
|
|
jlangsdo wrote:
I wrote this in Xcode on my mac. I have no idea how to build it on another machine
FYI
on github for a complete download
Green Clone or download button on right - drop down arrow -
Download as a Zip link
will give you a zip file of the github link complete contents
Xcode is an integrated development environment (IDE) that consists of set of software development tools which are designed by Apple specifically for developing software on Mac OS X and iOS.
The app development kit, Xcode is not available for any other operating systems except Mac OS X and iOS.
To run Xcode on a Windows PC requires an Apple OSX Virtual machine
with an Xcode installation and not a trival install.
This article gives an overview of what is involved
https://www.alltechbuzz.net/install-xcode-on-windows-for-ios-sdk/
Even then it will not produce a native Windows executable
Youtube clip
How to Install xcode on Windows | How to use Swift Compiler on Windows
https://www.youtube.com/watch?v=F8UKtjPEiWA
Warning - Indian accented English, may find it difficult to follow
This is what Microsoft has to say For Visual Studio, for example
Import an Xcode project
https://docs.microsoft.com/en-us/cpp/cross-platform/import-an-xcode-project?view=vs-2019
The Visual Studio tools for cross-platform mobile development with C++ include support for moving your Xcode projects into Visual Studio, where you can create cross-platform libraries and share code with other projects.
Rule of thumb appears to be Xcode for Apple apps, and Visual Studio or others for Windows apps.
Microsoft is not the only Retail Sold C++ Complier for Windows,
for example
Intel® C++ Compiler
https://software.intel.com/en-us/c-compilers
Evaluation Trial version available
An opensource GCC compiler maybe an option
(dependancies dependent, and Windows probably requires coding
changes to say OSX at a guess)
A GCC compiler is included in most Linux Distributions but not with Windows, available via 3rd party downloads.
mingw - Windows version of GCC.
http://www.mingw.org/
or
http://www.cygwin.com/
a large collection of GNU and Open Source tools which provide functionality similar to a Linux distribution on Windows.
Includes a GCC Compiler.
A GCC Compler is available for Apple Xcode but not installed by default
gcc compiler on Mac OS X
https://mkyong.com/mac/how-to-install-gcc-compiler-on-mac-os-x/
Mac OS X: Install GCC Compiler with Xcode
https://www.cyberciti.biz/faq/howto-apple-mac-os-x-install-gcc-compiler/
At a guess, Xcode C++ source run through the Apple Xcode - GCC compiler, may have a better chance of working with a Windows PC GCC compiler.
Integrated development environment (IDE) alternatives
for Windows to Xcode.
https://alternativeto.net/software/xcode/?platform=windows
Last edited by corsair91 on Tue Oct 13, 2020 2:50 am; edited 14 times in total |
|
Back to top |
|
|
corsair91
Sailing Master
Posts: 8189
221101 Gold -
|
|
Back to top |
|
|
corsair91
Sailing Master
Posts: 8189
221101 Gold -
|
Posted: Thu Mar 12, 2020 7:58 pm Post subject: |
|
|
Since this is based on a perl script
pirates_savegame_editor.pl
Converts a savegame file to a readable and editable text file and back
(the script includes the options syntax in the script remarks)
link to jlangsdo's mods
http://www.hookedonpirates.com/forums/viewtopic.php?t=7705
another possible alternative
(with some reservations such as level of performance and
size of executable generated,
as Perl is an Interpreted Script and rewriting in say C++
is one of the frequently recommended performance improvements)
is convert the perl script to a windows excutable
(may need to have the perl environment, added to to windows Path system
variable, when generating the executable)
A Google search on say
convert perl script to windows excutable
should give some hits
EDIT: Perl2exe with Stawberry perl,
generating a executable from the Perl script is less than
5 MB in size and no real performance advantage over running the script
natively from Perl. Still needs to run in the Windows command line.
(Strawberry perl takes care of setting the windows environmenal path as part of the install)
Options suggested appear to depend on What Windows Perl Distribution you have.
Checking out
https://www.perl.org/
https://www.perl.org/get.html#win32
suggests 2 Perl Distribution options - activeperl and strawberryperl
activeperl
http://www.activestate.com/activeperl/downloads
(may require a user account)
strawberryperl
http://strawberryperl.com/
A Beginner’s Guide to Compiling Perl Scripts
https://www.marcbilodeau.com/compiling-perl/
Reading around some, this is what tended to be recommended
for each perl distribution.
activeperl
Perl2exe
http://www.indigostar.com/perl2exe/
Perl2Exe is a command line program for converting Perl scripts to executable files.
Specific version of Perl required, has a link for Strawberry Perl
This allows you to create stand alone programs in Perl that do not require the Perl interpreter
All downloads are free non-expiring trial versions.
Non-trial features can be activated when a licence is purchased
Windows versions of Perl2Exe require a Perl interpreter
Trial version may have watermarking on the output and license
limitations on distributing executables.
EDIT: see the next post for confirmation on this
strawberryperl
Converting .pl to .exe file
https://www.perlmonks.org/?node_id=1115026
recommend installing the PAR::Packer module, which would give you the pp utility
https://metacpan.org/pod/PAR::Packer
PAR-Packer Module
https://metacpan.org/pod/PAR
PAR-Packer download
https://github.com/rschupp/PAR-Packer
https://metacpan.org/pod/pp
This utility can bundle your script into a stand-alone executable. The documentation for pp does include some examples.
PAR::Packer module may also work with activeperl
Some Perl distributions may have perlcc included (outdated),
run your perl code through a c compiler to make an executable.
strawberryperl does included a GCC complier.
parksbanyon posted this useful Perl on windows link previously
using PERL with windows a linked article
http://www.hookedonpirates.com/forums/viewtopic.php?t=6662
How do I make my Perl scripts act like normal programs on Windows?
https://stackoverflow.com/questions/4727480/how-do-i-make-my-perl-scripts-act-like-normal-programs-on-windows
Last edited by corsair91 on Thu Dec 07, 2023 9:06 pm; edited 26 times in total |
|
Back to top |
|
|
corsair91
Sailing Master
Posts: 8189
221101 Gold -
|
Posted: Thu Mar 12, 2020 8:19 pm Post subject: |
|
|
Perl2Exe User Manual
http://www.indigostar.com/pxman.html
Exe files generated by the registered version of Perl2exe may be freely distributed.
$149 US Single User License
Shareware Version
You are hereby licensed to use the shareware evaluation version of Perl2Exe for evaluation purposes without charge for a period of 30 days. This is not free software. If you use this software after the 30 day evaluation period a registration fee is required. Under no circumstances are you licensed to distribute Exe files created by the shareware evaluation version of Perl2Exe. Unregistered use of Perl2Exe after the 30 day evaluation period is in violation of copyright laws. |
|
Back to top |
|
|
corsair91
Sailing Master
Posts: 8189
221101 Gold -
|
Posted: Fri Mar 13, 2020 5:13 pm Post subject: |
|
|
If you install say a GCC Complier or Perl distribution on Windows,
you may have to add the install location to the Windows System path.
This is best done by this procedure using Control Panel
as the Tablet style - Settings App doesn't have this functionality
in Windows 10 1909.
Setting global environment variables on Windows
https://support.shotgunsoftware.com/hc/en-us/articles/114094235653-Setting-global-environment-variables-on-Windows
November 15, 2019
EDIT: Link now appears dead
https://knowledge.autodesk.com/support/shotgrid/learn-explore/caas/CloudHelp/cloudhelp/ENU/SG-RV/files/rv-knowledge-base/SG-RV-rv-knowledge-base-rv-setting-global-variables-windows-html-html.html#:~:text=Right%20click%20the%20Computer%20icon,to%20edit%2C%20and%20click%20Edit.
Windows 10 and Windows 8
Search and select System (Control Panel).
Click on the Advanced system settings link
and then click Environment Variables.
Under the section System Variables, select the environment variable you want to edit, and click Edit.
If the environment variable you want doesn't exist, click New.
Input the value of the environment variable in the Edit System Variable (or New System Variable) window, and click OK.
Windows 7
Right click the Computer icon on your desktop and choose Properties from the menu.
Click on the Advanced system settings link and then click Environment Variables. Under the section System Variables, select the environment variable you want to edit, and click Edit.
If the environment variable you want doesn't exist, click New.
Input the value of the environment variable in the Edit System Variable (or New System Variable) window, and click OK.
EDIT:
Strawberry Perl apparently takes care of setting the windows environmenal path as part of the install
Last edited by corsair91 on Sat Nov 20, 2021 10:11 pm; edited 4 times in total |
|
Back to top |
|
|
corsair91
Sailing Master
Posts: 8189
221101 Gold -
|
|
Back to top |
|
|
Pirate
Helmsman
Posts: 5665
112704 Gold -
|
Posted: Tue Mar 17, 2020 1:02 am Post subject: |
|
|
Why would anyone be needing a completed game for unless maybe they think it might could gather information in it to cheat or something. |
|
Back to top |
|
|
fleetp
Boatswain
Posts: 3854
37201 Gold -
|
Posted: Tue Mar 17, 2020 7:29 pm Post subject: |
|
|
Pirate wrote: | Why would anyone be needing a completed game for unless maybe they think it might could gather information in it to cheat or something. |
I was thinking the same thing. |
|
Back to top |
|
|
corsair91
Sailing Master
Posts: 8189
221101 Gold -
|
|
Back to top |
|
|
corsair91
Sailing Master
Posts: 8189
221101 Gold -
|
|
Back to top |
|
|
|