OpenXcom Forum

Modding => Released Mods => XPiratez => Topic started by: ziroc on April 15, 2019, 05:21:12 pm

Title: questions about Piratez.rul
Post by: ziroc on April 15, 2019, 05:21:12 pm
Before the question I have to say, I'm new to the game and it's awesome :)

So, I'm trying to create something like a wiki for the Bootypedia. Actually it is a parser for Piratez.rul and en-US.rul + a web front-end. But I'm having some troubles with connecting the items in both files.

After some research I found out that most of the keys in the Piratez.rul look like STR_BASIC_ELECTRONICS.  And you can add _UFOPEDIA to them. With the resulting STR_BASIC_ELECTRONICS_UFOPEDIA you can look up in the en-US.rul to find the description of the technology.

But it turns out it is not so simple.
Some of the items you have to add _AC_UFOPEDIA to get the correct key.
And some items like STR_TINY_DRILL_INVESTIGATION have key like STR_TINY_DRILL_UFOPEDIA. So I cannot derive the key from the item name.

So my first question is, is there some algorithm I can use to always get the correct key from the language file for every item in Piratez.rul?

Thanks :)
Title: Re: questions about Piratez.rul
Post by: Meridian on April 15, 2019, 06:50:11 pm
Start here: https://github.com/MeridianOXC/OpenXcom/blob/oxce-plus/src/Geoscape/GeoscapeState.cpp#L2254
Continue here: https://github.com/MeridianOXC/OpenXcom/blob/oxce-plus/src/Geoscape/ResearchCompleteState.cpp#L98
Continue here: https://github.com/MeridianOXC/OpenXcom/blob/oxce-plus/src/Ufopaedia/Ufopaedia.cpp#L155
End here: https://github.com/MeridianOXC/OpenXcom/blob/oxce-plus/src/Ufopaedia/Ufopaedia.cpp#L70


Short answer: difficult.
Title: Re: questions about Piratez.rul
Post by: ziroc on April 15, 2019, 10:03:51 pm
Perfect. I haven't read C++ in 15 years, but I think I found what I need. Thanks Meridian!
Title: Re: questions about Piratez.rul
Post by: ziroc on April 16, 2019, 12:25:26 am
Alright. I have a prototype to show :)

https://xpz-wiki.herokuapp.com/

The hosting is free and they sleep the app after some time, so the first page load time could be half a minute.
Title: Re: questions about Piratez.rul
Post by: ziroc on April 16, 2019, 12:20:34 pm
What is the purpose of the techs that have 0 cost? For example:

Code: [Select]
- name: STR_HELMET
    cost: 0
    points: 10
    dependencies:
      - STR_SECTOID_EXPLORER
      - STR_ACADEMY_SCIENTIST
      - STR_GUILD_EXTERMINATOR
      - STR_GOVT_ELITE
      - STR_NAZI_STORMTROOPER
      - STR_BANDIT_GHOUL
      - STR_BANDIT_GHOUL_SCI

Do you get it for free?
I also cannot find link to Bootypedia article about it.
Title: Re: questions about Piratez.rul
Post by: Meridian on April 16, 2019, 01:05:48 pm
What is the purpose of the techs that have 0 cost?

Many different things.

Use the in-game TechTreeViewer to see the connections and guess... or ask the mod author.
Title: Re: questions about Piratez.rul
Post by: Ashghan on April 16, 2019, 04:35:29 pm
While I applaud the idea, the execution might be very difficult. Xpiratez was not written in a way that would play nice with what you want to do - you'll get many inconsistent results and some which are blatantly wrong. I opened the page and from the 5 random articles, 1 was wrong and 2 were incomplete (to the point of being useless).
https://xpz-wiki.herokuapp.com/item?id=STR_CONTACT_MAGIC_SHOP_ZZZ - it gives the description of the Heartgrip Staff - it's a dependency project, without it's own Bootypedia article. IIRC HG Staff is only one of the unlocks after researching it.
https://xpz-wiki.herokuapp.com/item?id=STR_LOADER_ARMOR - loader suit shows that the text string (the description) is not enough - we'd need armor values and stat modifiers for the page to be meaningful. Plus Loader Suit unlocks multiple different armors at once (land, sea and space version - each of these for Gals, Peasants and Slaves separately - 9 variants total).
https://xpz-wiki.herokuapp.com/item?id=STR_LARGE_RADAR_SYSTEM - no errors, but still not enough info - cost, build time etc.
https://xpz-wiki.herokuapp.com/item?id=STR_RUSSIAN_FILES - OK, it's a lore article (and an unlock) anyway.
https://xpz-wiki.herokuapp.com/item?id=STR_CYBERDISC_TERRORIST - As above.

Correcting everything by hand would be too much to even consider it. A difficult, but perhaps more consistent approach would be to make the script look through each section of Piratez.rul separately and add Cost, build time, tech required, etc. based on the entries. How to handle other stats (prison capacity, defense ratio, storage space etc.) is another problem. Multiply these problems for each of the sections (facilities, craft, equipment, soldiers, armors and so on).
Basically - you'd have to re-write the code that generates in-game Bootypedia into something that works web-based, while still retaining 100% functionality. Good luck, you're going to need it.

Title: Re: questions about Piratez.rul
Post by: ziroc on April 16, 2019, 06:10:10 pm
Ashghan, you are right, its not easy.

My initial goal was getting the research tree and its dependencies. So I can search for a tech and check what I need to obtain it. On this goal, I think I'm half way there :)

For the future and in order to be more useful, the wiki must have the connection between technologies and their corresponding items, weapons, armors, buildings, etc. Which as you said could be hard. But we'll see, I'm optimistic :)
Title: Re: questions about Piratez.rul
Post by: Meridian on April 16, 2019, 06:15:44 pm
My initial goal was getting the research tree and its dependencies. So I can search for a tech and check what I need to obtain it. On this goal, I think I'm half way there :)

Maybe you don't know, but such tech tree with search and all dependency links is already available directly in-game.
Title: Re: questions about Piratez.rul
Post by: ziroc on April 16, 2019, 07:38:44 pm
Maybe you don't know, but such tech tree with search and all dependency links is already available directly in-game.
I think I have saw it. But I can't play the game in the bus. Or at work. Sad.
Title: Re: questions about Piratez.rul
Post by: Meridian on April 16, 2019, 07:41:24 pm
But I can't play the game in the bus.

There is a version for Android and for iOS too.

Or at work.

Nobody can.
Title: Re: questions about Piratez.rul
Post by: LytaRyta on April 16, 2019, 07:54:55 pm
..excellent!

yap, parsing, = automatization (of some coding, programming, code, (datas) processing... etc.. (if i get it, understand it right )), - but wouldn´t it better make just all just "by hand", "manually ?   every article, every "technology", page after page, tech after tech, ~~ and make from all of it whole new UFO-pedia (xPiratez Wiki)  8)
Title: Re: questions about Piratez.rul
Post by: Meridian on April 16, 2019, 07:59:49 pm
yap, parsing, automatization (if i get it, understand it right), - but wouldn´t it better make just all just "by hand", "manually ?   every article, every "technology", page after page, tech after tech, ~~ and make from all of it whole new UFO-pedia (xPiratez Wiki)  8)

Yes, please do it.
Title: Re: questions about Piratez.rul
Post by: ziroc on April 16, 2019, 08:22:47 pm
@LytaRyta Not sure if serious. There are like 3 thousand items in the Bootypedia :)

@Meridian  I guess you feel I'm duplicating the work done for the in-game Ufo-pedia. That is true, but in my defense - creating small utilities for the games I play is my hobby.
For example I have a thingie that auto-accepts my Dota2 games. I have a utility for Dwarf Fortress that shows the skills of the dwarves (similar to Dwarf Therapist, which wasnt working at the time). Things like this. Its just my thing.
Title: Re: questions about Piratez.rul
Post by: legionof1 on April 17, 2019, 03:22:32 am
Well for my part, i hope this turns out well, external references are nice/handy when possible.
Title: Re: questions about Piratez.rul
Post by: Martin on April 17, 2019, 01:27:43 pm
zyroc: I might be biased but manually checking and sorting 3k entries doesn’t seem that much to me. Not that I would ever do it for free of course and it woud be much faster to learn enough coding to let the machine do it which should be perfectly doable in this case.
Title: Re: questions about Piratez.rul
Post by: ziroc on April 18, 2019, 12:14:33 am
Yep, I'm trying to do it automatically.

I added items as a separate entity from the research items. Search tries to look both in research and in items.
It will take me some time to show more useful stats for the items though. For now mainly guns + clips and their damage.
Title: Re: questions about Piratez.rul
Post by: ziroc on April 23, 2019, 01:08:06 am
Guns now have more stats. Starting to work on the armors, for now only their armor values are shown.