project reality header
Go Back   Project Reality Forums > PR:BF2 Mod Forums > PR:BF2 Community Modding
19 Dec 2018, 00:00:00 (PRT)
Register Forum RulesDeveloper Blogs Project Reality Members List Search Today's Posts Mark Forums Read
PR:BF2 Community Modding Making or wanting help making your own asset? Check in here

Reply
 
Thread Tools Display Modes
Old 2014-03-18, 10:34   #1
[R-DEV]​Senshi
PR:BF2 Developer
PR Server License Administrator

Senshi's Avatar
Send a message via Skype™ to Senshi
Default Battlefield 2 Exploratory Mod Analyzer

I've been developing a Java app to assist in aggregating accurate technical data about PR for our wiki to keep it updated in a more automated way for over a year now.

By now the project has grown large enough (8879 lines of code) that I think it might be a useful lookup tool for some modders/contributors or some other data nerds that really need to know the exact muzzle velocity and setup time differences between weapons .



Stuff it currently does quite nicely:
- Gather kit information. List can be filtered using regex search strings
- Gather weapon information. List can be filtered using regex search strings
- Gather information about maps
- Generate minimaps showing the AAS routes (not yet completed)
- Gather information about projectiles and materials (data parsing is done, but no GUI yet to access this in a fancy way). I plan to add a "damage calculator" sort of thing, allowing the user to see the exact damage a specific weapon/projectile will do on hitting a specific material/armor.
- Compiles xml-based DBs for quick data access
- Can decompile the menuatlas files
- Can read DDS files

I also aim to reconstruct vehicles (engine, armor, weapons, mobility) as well at some point, but that's for a more distant future version.

--- FOR PROGRAMMERS ---
For my own convenience I already have been using Bitbucket for this project for some time, and this is one of the ways you can access it:
https://bitbucket.org/WGP_Senshi/wikiparser
The tool uses SWT for native-OS-lookalike GUIs, and I'm on Win64bit, so that's the version it'll run on out of the box. But if you pull it and simply replace the referenced SWT with the SWT of your OS in the classpath, everything will work fine again. But I just assume most modders use win64bit anyway.

The bitbucket repo is basically a 1:1 copy of my local Eclipse project workspace, so if you use Eclipse and eGit as well, you can easily clone the entire repository as a new local project.

I never learned to program in a professional sense, and this has been my "startup" project, so if you have computer science experience, expect to cringe at my horrible code hackjobs . Which is another reason I'm opening this up, it's getting difficult to learn auto-didactically and I'm always eager to learn about optimizing processes.

However: Most data parsing works quite nicely already, which might make this a valid base to branch off for your own needs. The tool is entirely geared towards my wiki use, so most output it generates is in the wiki format I need for my wiki templates. The underlying data objects usually contain many more attributes (=all) that I do not need or use, you just need to rewrite the output formatters to get those as well.
To be clear: I invite you to create forks and if you got something cool, make pull requests, I'm very eager to see what you come up with! I'm very open to integrating pull requests into the master branch.

--- FOR NON-PROGRAMMERS ---

I also offer the current in-dev version as a direct download here for you to play around with. Be advised that this compiled version will only run on Windows 64bit.
Consider this very alpha. The non-programmer version will be updated sporadically when I feel essential features have been completed or a number of bugs have been fixed. If interest is high enough, I'll also put in some auto-updater code I already have lying around to facilitate updating.

--- Note to BOTH ---

The tool currently is very bad at exception handling, and I absolutely expect the tool to run into exceptions causing fatal crashes upon selecting maps/weapons/kits.
If that happens, please tell me exactly how to reproduce it and/or provide the error message given. Usually it's very easy to catch those exceptions once I know where they pop up.
PLEASE add bug reports on the bitbucket issue tracker of the project. It makes it much easier to keep track of bugs and fixes for you and me and keeps this thread here open for general feedback.

If the app crashes and you don't know why, execute it from a local command window (cmd) with the java -jar Parser.jar command. That way you'll get the console output in the cmd window which will include the crash message you then can use to either debug yourself or raise an issue on the issue tracker above.

--- HOW TO RUN ---

I strongly suggest to store this tool in a separate folder. It will create some files for its internal db and persistent settings stored.
The tool is not able to look inside the mod's zip files so it needs everything in an EXTRACTED form.
Modders already should be familiar with this, using the recommended approach to clone the pr folder into a "pr_edit" one. Inside this, all zips should be extracted (maps, objects etc.). After that, the original zips can be deleted or left sitting around, the tool doesn't care.

It requires an up-to-date Java 7.
Double-click the Parser.jar to launch it. If that doesn't work, open a command prompt on the same folder and use "java -jar Parser.jar" to run it.

Once the app launches, it asks to be directed to the mod's localization folder (mods\pr_edit\localization)
After that, before doing anything else, you should head to the Settings Tab and use the buttons to generate the DB (a one time thing that speeds up tool responsiveness later a lot). Order is currently irrelevant, EXCEPT: ALWAYS build the HANDHELDS before the KITS, or you'll get error messages.
Minimap building is not necessary, I just included that to compile a handy set of all the map loading screens (those which show the gamemode, AAS routes and vehicle numbers).

Once all that is done, you can switch through the tabs and finally analyze the data yourself

Senshi is offline
Last edited by [R-CON]Senshi; 2014-08-26 at 14:44..
Reply With Quote
Old 2014-03-19, 02:06   #2
[R-DEV]AncientMan
Retired - Project Manager
Supporting Member
PR Server License Administrator

AncientMan's Avatar
Default Re: Battlefield 2 Exploratory Mod Analyzer

Not sure if you've already done your own map parser, but PRBuild generates this data which might be useful for you:

https://dl.dropboxusercontent.com/u/...ta-1.1.4.0.zip

AncientMan is offline Reply With Quote
Old 2014-03-19, 08:28   #3
[R-DEV]​Senshi
PR:BF2 Developer
PR Server License Administrator

Senshi's Avatar
Send a message via Skype™ to Senshi
Default Re: Battlefield 2 Exploratory Mod Analyzer

Thanks for that info, Ancient. It's pretty much what I already got, minus some details I'm simply skipping right now as I had no use for it yet.
Currently the minimap-parsing is stuck on processing the AASv4. BF2/PR is very lenient in accepting all kinds of SGID combinations (especially for mainbases), it's pretty much impossible impossible to do this only with the control points. Sometimes main bases don't even use CPs, so I would have to resort to the soldier spawngroup positions. Tricky to do all that in an automated way...
Once that is sorted, the user can switch between the possible AAS routes on a map, getting only relevant routes shown. Then adding the vehicle spawn locations in with some info would be easy, but I really think I'll move the entire "minimap" project out of this tool and rather create something web-based (interactive maps). If you devs got the map data in json anyway, it would make more sense to base it off that right away, so updating the map DB would be more straightforward. No point in doing such tasks twice over.

Senshi is offline Reply With Quote
Old 2014-03-19, 09:01   #4
[R-DEV]AncientMan
Retired - Project Manager
Supporting Member
PR Server License Administrator

AncientMan's Avatar
Default Re: Battlefield 2 Exploratory Mod Analyzer

AASv4 parsing isn't too difficult, just gotta understand the rules.

Can check out this C# code if you want. You'll need to do some re-working as it's made for PRBuild and generating out the map overviews, but it should be enough to get you well on your way.
[C#] public static Dictionary<uint, Dictionary<uint, List<GpoControlPoint>>> ParseRou - Pastebin.com

AncientMan is offline Reply With Quote
Old 2014-03-19, 10:00   #5
[R-DEV]​Senshi
PR:BF2 Developer
PR Server License Administrator

Senshi's Avatar
Send a message via Skype™ to Senshi
Default Re: Battlefield 2 Exploratory Mod Analyzer

The AAS4 routes themselves are not that tricky, yes. The rules are nicely explained in that one tutorial we got stickied somewhere here.
AASv4 parsing is actually pretty much complete, I just haven't done the "easier" task of handling the non-AAS4-flags in AASv4 maps (those that only have a single digit).

The biggest issue however is coming up with a nice, clean way to visualize the routes (especially if they have plenty of possible flags for each "step").
All this UI design takes a lot of work and I'm even worse with implementing my UI ideas than I am with my parsers.

Thank you for the C# source, it contains some things I was unable to figure out with the AAS4 tutorial alone, such as how flags with no SGIDs are treated. I wasn't sure it was really a fixed rule that "team == 2 && SGID == null" equals "last flag" and "team == 1 && SGID == null" equals "first flag". But it's also nice to see that I came up with pretty much the same parsing approach as the one PRBuild uses .

I still will have to come up with a solution for maps like Kashan Desert, where all the main base spawners are linked to the last regular flag which sometimes is over a km away...

This is the WIP I got right now, but I'm more and more thinking I should pursue this as a separate web project.

Senshi is offline Reply With Quote
Old 2014-03-19, 10:24   #6
[R-DEV]AncientMan
Retired - Project Manager
Supporting Member
PR Server License Administrator

AncientMan's Avatar
Default Re: Battlefield 2 Exploratory Mod Analyzer

Well yeah, I just draw the dotted lines between random flags in a group. But then it starts to get real messy when you're drawing radii and flag names and all sorts of stuff. Case in point: http://i.imgur.com/4jkskeU.png

If you're going for a web viewer which would be pretty ideal for this sort of task, you could perhaps have a button which toggles CP info on and off, and/or have a flag which you can roll over or something to see the radius and name and everything. Either way, drawing all the info, even if you're only showing one route, is going to get pretty messy

As for main bases without a flag, drawing the combat area should help a bit with that.

AncientMan is offline Reply With Quote
Old 2014-03-19, 10:56   #7
[R-DEV]​Senshi
PR:BF2 Developer
PR Server License Administrator

Senshi's Avatar
Send a message via Skype™ to Senshi
Default Re: Battlefield 2 Exploratory Mod Analyzer

Yeah, it really gets too much information very quickly. The number of object attributes in the background is manifold of what is shown to the user at any given point anyway.

As I'm a geographer (geoinformatics, to be more precise), a webmap solution would be much more familiar territory for me. It certainly should be very flexible and interactive, roll-over and switches are a must for a modern, multi-layer digital map. I hate messy maps , which is also why I really hope Onil's map overlay makes it into PR some time to allow more information to be mapped.

Given PR's scope, I would give the webmap thing some planning tools, so users get plenty of information out of it on one hand and be able to add information themselves using custom overlays (draw lines, markers or even add images etc.). Tournament/clan war strategists would go nuts on this, I guess . I also have a stockpile of topological maps (contours, shaded reliefs) generated from the heightmap sitting on my disk which would complement a webmap nicely...and maybe integrate some automated viewshed tool...

Oh, if only a day had 48 hours and I wouldn't need sleep...

Senshi is offline Reply With Quote
Old 2014-03-20, 10:08   #8
[R-DEV]​Senshi
PR:BF2 Developer
PR Server License Administrator

Senshi's Avatar
Send a message via Skype™ to Senshi
Default Re: Battlefield 2 Exploratory Mod Analyzer

A question:

Khamisiyah uses a init_usmc_ins.con where the teams are defined for insurgency.
The only call of that file that I can find is this:
"run ../../../Init_usmc_ins.con"
in the
gamemodes\gpm_insurgency\16\GPO.con
This makes sense and I can easily parse the factions for this GM that way.

However: Can someone enlighten me as to why this one line is sufficient to also change the factions for the 32/64 versions of insurgency, which do NOT contain this "run" line?


Then there are other maps that never make a call for their necessary gamemode init.con either, such as Yamalia, which features an unreferenced init_vehicles.con.

I only can guess that this is intercepted by Python somewhere and default gamemode init-names like init_insurgency or init_vehicles get called automatically if the server runs the GM in question? This doesn't yet explain the Khamisiyah phenomenon, but is my best guess.

If there is some python hidden away that handles this, could someone tell me the logic it uses so I can reconstruct it for my tool?

Senshi is offline Reply With Quote
Old 2014-03-20, 15:35   #9
[R-DEV]AncientMan
Retired - Project Manager
Supporting Member
PR Server License Administrator

AncientMan's Avatar
Default Re: Battlefield 2 Exploratory Mod Analyzer

Python does nothing.

Init.con is default, it is always run. The load order is Init.con, then a bit later, GamePlayObjects.con is executed. We can thus override what is done in the Init.con, with what is done in the GPO. The GPO just uses an external file for these commands which makes things simpler.

On Khamisiyah, Insurgency 16 and 32 have such a run line in its GPO, 64 doesn't. Not sure why you said 32 doesn't?

16 -> Init.con loads mec vs usa. GPO is then loaded, which runs Init_usmc_ins.con, which overrides the factions with meinsurgent vs us_ziptie.
32 -> Similar to 16, but the factions are instead loaded from Init_usmc.con and are mec vs us.
64 -> GPO does not override anything, Init.con default values are used, mec vs usa.

Yamalia is a bug lol.

AncientMan is offline Reply With Quote
Old 2014-03-20, 17:47   #10
[R-DEV]​Senshi
PR:BF2 Developer
PR Server License Administrator

Senshi's Avatar
Send a message via Skype™ to Senshi
Default Re: Battlefield 2 Exploratory Mod Analyzer

I was aware of the init.con->GPO load order. It's been there since BF42, after all (which was my real "active" modding time), it "only" got more elaborate and a little bit less straightforward in BF2.

Alright, everything clears up then. I've been confused by a combination of the Yamalia bug and my lack of knowledge, then . I didn't know 64 INS used the regular teams on that map, I just assumed they would use the insurgency ones as well.

Thank you very much!

Senshi is offline Reply With Quote
Reply


Tags
analyzer, battlefield, exploratory, mod
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 16:09.