fuhrmanator / melee-sim-js

Simulator for The Fantasy Trip Melee
https://fuhrmanator.github.io/melee-sim-js/www/
3 stars 2 forks source link

Still active? #1

Open fletcher opened 5 years ago

fletcher commented 5 years ago

It looks like you're still tinkering with this as of April (based on commits), so I wanted to reach out.

I haven't cloned on Github so can't give a pull request, but two things:

  1. index.html links to the MedievalSharp font using an incomplete URL (it's missing the http:

  2. Any plans to update for the new version of Melee/The Fantasy Trip? (since Steve Jackson reacquired the rights and re-released this.) There are some new items, and it looks like stats for armor have changed. Figured I would check on your plans before doing a lot of custom changes that would be duplicated or never merged.

  3. Actually, three things... Do you manually generate the list in HeroesSingleton.js? It seems ripe for a templating/scripting system to automatically generate that based on available weapons/armor/shields, especially if adding new options from the new rules.

As an aside -- I just recently discovered Melee and was interested in playing around with it as a game, but also considering experimenting with some software ideas. I was looking for something to try out a Monte Carlo simulator, and Melee seemed like a good option. (I wanted to develop something that incorporated more options than just attack each round, to at least find out if other strategies might be useful (e.g. defend more if losing in hopes that opponent breaks a weapon??)) But the first step was something to just compare different stat/weapon options -- and this suits that perfectly! Thanks for creating and releasing it!

fuhrmanator commented 5 years ago

Hello and thanks for the kind words.

It's possible to modify a file directly on GitHub, which will automatically create a Fork and PR if you let it, all via the web interface. I think you can try with fixing the missing http in the MedievalSharp font problem.

As for point 2, I thought about it, but don't have time for such an undertaking right now. Melee was one of the pet projects I started to code back in the 1980s, so I've always used this project to get into new programming languages (this particular repo was how I dove into JavaScript), etc. I'd say don't worry about duplication/merging -- GitHub is pretty powerful to manage those things.

As for point 3, indeed that code was generated (albeit manually, I can't remember what tool I used, but maybe it was Microsoft Word's Mail Merge, since I'm old and that still works, LOL). So, yes, feel free to make that step more repeatable.

fletcher commented 5 years ago

Ok. Just for grins, I did the following:

  1. Used tab-separated files to store raw data for ST/DX, Armor, Shield, Weapon. (Swords only thus far).

  2. Use two of my utilities to convert the TSV into JSON, and then use a template to convert the JSON into the javascript files.

  3. Then merge all of the JSON into a single aggregate object, and then use a template to create HeroesSingleton.js. Instead of manually building the heroes list, it iterates through the above data to create each possible combination (verifying that ST >= minimum ST for each weapon.)

  4. A single build.sh file handles all of the above.

Using just the swords and axes/hammers/maces, all of the new armor/shield options, and ST/DX from 8-16 results in 3241 different combinations. Obviously this will be much larger when adding the additional weapons.

Trying to run all of those variations against each other (just 1 match each) took a while, but my browser seemed to freeze when trying to summarize the results (the progress bar was complete.) With this many options, there might need to be a different interface.... Maybe a set of checkboxes to choose a range of attributes, and a selection of weapons, armor, and shields.

I still need to clean this up a bit, and then will create a fork on github and you can do what you like with it.

fletcher commented 5 years ago

Deleted my repo to further consider copyright issues. I am interested in this as an experiment for other things, and definitely not interested in a copyright fight. As much as like many of SJ Games' products from when I was younger, a company that thinks there is something fundamentally different about software that runs on a computer vs that which runs on a mobile device probably does not understand much in the way of the nuances of software.... ;)

Maybe I'll repost all the templates and build chain, but leave out the actual data, leaving that "as an exercise for the user"?

fuhrmanator commented 5 years ago

Very cool! I had no idea there were so many options with the new rules. A new interface is definitely needed. I just didn't have enough time.

One thing: tabular (.tsv) content in the repo risks a request for take-down, because of these rules that explicitly state it's a violation of copyright to do so. I commented on one of your commits in your fork.

Do you know of the TFT Helper app? It has an implementation of the combat in new TFT, but it's pretty buggy. There's a lot of complexity in the new rules, especially when you consider all the talents, the special weapons, and movement (even simplistically) like that app does. Seems ambitious to try to make a simulator that does all that.

I forgot to mention that four months ago, I started an add-tests branch, but never merged it, mostly because I wasn't happy with bunit (it can't be easily integrated into Travis-CI as far as I know). Tests are crucial for this kind of project. I think I would move the tests to Karma as it's actively maintained.

fletcher commented 5 years ago

I have seen the TFT Helper app and played with it. Does a good job of handling 1v1 or 1v2. But not quite up for the 1842 v 1842 round I just tried. ;) On the other hand, it does allow some options besides attack every round. ;)

A few notes:

  1. With large groups (e.g. 1842 x 1842), generating the "Matched up wins" table becomes too slow. I had to comment out that section to have any hopes of actually finishing the simulation. Not sure if it's the actual table generation or the sort algorithms? Either way, I didn't need that data so I skipped it for the sake of efficiency. I guess the next step could be a check box to enable/disable this.

  2. I think you swapped some variables in the weapon code? -- it looks like isTwoHanded and isThrown are swapped comparing the Weapon() function and the actual weapons in lines 58+.

  3. I'll need to dig into code to see where this issue actually resides, but some lighter weapons can be thrown. I set true for those weapons, but it seemed to cause errors (maybe the hero threw his dagger and then was empty-handed?) I just set isThrown to false for all weapons for now, and this fixed the errors I experienced...

  4. Scrolling through the list of 1842 variations to see which ones fared the best was interesting. Seeing that my early design for a "tank" fighter was in the top 35 of those variations was fun. (With the obvious caveat that changing the type of opponent could have a significant effect on which "design" survives the best.

Again -- thanks for putting this out there!

fuhrmanator commented 5 years ago
  1. With large groups (e.g. 1842 x 1842), generating the "Matched up wins" table becomes too slow. I had to comment out that section to have any hopes of actually finishing the simulation. Not sure if it's the actual table generation or the sort algorithms? Either way, I didn't need that data so I skipped it for the sake of efficiency. I guess the next step could be a check box to enable/disable this.

Good idea.

  1. I think you swapped some variables in the weapon code? -- it looks like isTwoHanded and isThrown are swapped comparing the Weapon() function and the actual weapons in lines 58+.

Haha... when I wrote the tests in that branch, I found and fixed the bug. Check https://github.com/fuhrmanator/melee-sim-js/commit/5492cc464f337448b1c3bb9772cf28c23fffa9fb?diff=unified#diff-85bfb31f3d9fb76acf729af36b8c7c40

I should merge that into the main branch.

  1. I'll need to dig into code to see where this issue actually resides, but some lighter weapons can be thrown. I set true for those weapons, but it seemed to cause errors (maybe the hero threw his dagger and then was empty-handed?) I just set isThrown to false for all weapons for now, and this fixed the errors I experienced...

That might be another bug I found at SMALL_AX definition. But I never merged these changes, so maybe it causes bugs in the full simulator (the unit tests pass, but they aren't complete tests).

  1. Scrolling through the list of 1842 variations to see which ones fared the best was interesting. Seeing that my early design for a "tank" fighter was in the top 35 of those variations was fun. (With the obvious caveat that changing the type of opponent could have a significant effect on which "design" survives the best.

I had some posts on Google+ that used data inside of Google sheets to look at finding the best rival, but I think they died with Google+. The spreadsheet and chart are still there, however.

fletcher commented 5 years ago

My next idea was to consider something like a Glicko rating for the various combinations that would allow more comparison between groups. But mainly because I'm intrigued with ways of using rating systems like that... ;)

fletcher commented 5 years ago

Created a new version of my repo that includes fake data for the various tables. One can include whatever information one wishes for the Armor.tsv, Shield.tsv, and Weapon.tsv files to replicate the modern information in Melee/The Fantasy Trip.

fuhrmanator commented 3 years ago

Just wanted to let you know @fletcher I converted this to a TypeScript version at https://github.com/fuhrmanator/melee-sim-ts

I put (some) of the tests in Jest format, updated to Bootstrap 5, and got the simulator to run in a Web Worker. It's not so different functionally, but I find TypeScript easier to maintain these days. I finally went with Web Pack because it just worked (I tried with a couple of other vanilla typescript ways but got stuck).

fletcher commented 3 years ago

Thanks for the update. I haven't put any more time into this one (busy with other side projects, and never ended up putting much time into playing Melee either...), but maybe I'll pick it back up again.