![]() |
#1 | |
Lead Admin / Retired EMC CO
![]() ![]() ![]() ![]() ![]() Join Date: Aug 2014
Location: Wiesbaden
Posts: 2,369
|
PR Damage Calculator
Just for those curiously inclined, I'm currently working on another small tool:
Super-early alpha damage calculator Currently it only shows info about materials, so it's not really a damage calculator yet. A short summary about how PR actually calculates damage (it's logical, but not trivial): A firearm emits a projectile. That projectile has the following important parameters: - raw damage - material Said material defines how the projectile reacts when hitting another material. All soldiers, vehicles, statics, even terrain also have materials assigned (objects can have them assigned per-polygon, meaning it is important where you hit the target). The relation of "offensive" material vs "defensive" material is assigned a damage modifier (among other properties), which is a multiplier applied to the raw damage value of the projectile. Quote:
Currently, you have to look up the firearm name and projectile information yourself in the game files. So the logical next step for this tool is to add projectile and gun information, and allow selecting guns/projectiles and target objects. I have all that information present, but sadly it's ~20MB of data. Don't want to force clients to load that via JScript everytime they open the webpage. So I have to delve into PHP coding, another new topic for me. The expected benefit is that users will not have to download the entire dataset, but will only request the tiny snippet of information they actually need (the server will select and send it). As I just restrict it to materials right now, Jscript is fine, though it's still ~2MB of data (which explains why it takes a couple of secs to fill the list). Also, no styling yet. Barebone HTML ftw. It'll probably take a while until I have this PHP stuff sorted out, hence a barebone release now.
__________________
|
|
![]() |
![]() |
![]() |
#2 |
C11 Member
![]() ![]() Join Date: Sep 2014
Location: United States, Indiana
Posts: 252
|
Re: PR Damage Calculator
Senshi, the maker of random useful tools we didn't know we needed until he made them.
__________________
![]() ![]() ![]() ![]() Raid git gud.
|
![]() |
![]() |
![]() |
#3 |
Retired EMF SCO
![]() Join Date: Sep 2014
Posts: 785
|
Re: PR Damage Calculator
That is an interesting project. I will be following your progress.
__________________
![]() |
![]() |
![]() |
![]() |
#4 | |
Task Force Member
![]() ![]() ![]() ![]() Join Date: Sep 2014
Posts: 388
|
Re: PR Damage Calculator
Looks very interesting.
Quote:
If that, for some reason, shouldn't be an option for you the next best thing I can think of right now would be to compress the data before sending it. Although a DB would still be the better solution imo.
__________________
![]() Let's go. In and out. 20 minute adventure. |
|
![]() |
![]() |
![]() |
#5 |
Lead Admin / Retired EMC CO
![]() ![]() ![]() ![]() ![]() Join Date: Aug 2014
Location: Wiesbaden
Posts: 2,369
|
Re: PR Damage Calculator
Don't think a full-scale SQLDB is necessary, the parsing is pretty simple and still lightning-fast. "Just" have to figure out how to do all that on the server and send back the generated HTML table
![]() EDIT: To clarify, the "select the correct data" requires a one-time loop over the objects with a simple Code:
if object.id == searchid return object The longest delay is caused by currently having to transfer 20MB of JSON data before that. I still believe I merely am lacking some fundamentals in Ajax to get on the right track. But I also just started this project a couple hours ago, so I'm not worried too much ![]()
__________________
Last edited by Senshi; 2016-01-30 at 21:39. |
![]() |
![]() |
![]() |
#6 |
C11 Member
![]() ![]() Join Date: Oct 2014
Posts: 38
|
Re: PR Damage Calculator
You could use the file system as your database. Split the 'materials' array into files for each object and rename it to material id. Then request only those who you need.
|
![]() |
![]() |
![]() |
#7 |
Lead Admin / Retired EMC CO
![]() ![]() ![]() ![]() ![]() Join Date: Aug 2014
Location: Wiesbaden
Posts: 2,369
|
Re: PR Damage Calculator
That would work, but it'd lead to ~12.000 tiny files, because that's how many objects PR consists of. I'd rather not do that, simply because it'd take a lot of HDD space and more importantly: I only have FTP access, so I cannot zip-upload&extract. Uploading/overwriting all files individually via FTP would take days.
__________________
|
![]() |
![]() |
![]() |
#8 |
Task Force Member
![]() ![]() ![]() ![]() Join Date: Sep 2014
Posts: 388
|
Re: PR Damage Calculator
Alright.
I'd just use a simple html get request, process the request in the back-end (e.g. with php) and then return the output to the client. This means you don't have to send your json file over the network.
__________________
![]() Let's go. In and out. 20 minute adventure. |
![]() |
![]() |
![]() |
#9 |
Lead Admin / Retired EMC CO
![]() ![]() ![]() ![]() ![]() Join Date: Aug 2014
Location: Wiesbaden
Posts: 2,369
|
Re: PR Damage Calculator
That's exactly what I said I am planning to do in all previous posts
![]() The materials.json is just one tiny file, there's still a couple other, larger files. Which is why it's a little bit more complicated, but I'm making progress already.
__________________
|
![]() |
![]() |
![]() |
#10 |
Task Force Member
![]() ![]() ![]() ![]() Join Date: Sep 2014
Posts: 388
|
Re: PR Damage Calculator
Yeah I know
![]() Like I said I'd still go with a small database like sqlite or similar that doesn't need much setup really. That would reduce the server load and access time quite a bit imo ![]()
__________________
![]() Let's go. In and out. 20 minute adventure. |
![]() |
![]() |
![]() |
|
Tags |
calculator, damage |
Thread Tools | |
|
|