> Definitely use JSDoc and be very thorough when documenting the API, but it's not exactly the place for a "Guide". I would recommend running the JSDoc through a tool to get it in HTML format to produce something like I did for our [Source Control API][scDoc]. I did it by hand, because I needed markdown, but I'm sure there are tools out there.
The guide itself could be in the form of a detailed tutorial or as simple as an [example usage][ex].
@Phrancis that needs to be the following: onEndOfTurn: { heal: { value: 1, target: "owner" } }
@Phrancis that is give: { denyCounterAttack: 1 }
@Phrancis yes, please only merge from js-load to js at this moment, not the other direction.
@Phrancis two problems: 1. I have forgotten to implement any kind of onCast feature (will likely be afterPlay) 2. missing comma after a }
@skiwi I think so, yes. The best part is that the JS can be dynamically changable without restarting anything. I started 36 games yesterday, with some changes in each, without restarting.
perhaps you should ask @Phrancis though about what is easier
@skiwi I have not tested the security manager with the new js-load things. Although I doubt it would work on the first try. I like to have the possibility of running the server without the security manager, at my own risk.
@SimonAndréForsberg So in hindsight it would've been better to introduce the security manager later? Assuming we were really limited on time, that time [to setup the security manager] would've been better used for somewhat else
I have the following Java class:
import java.util.Random;
public class RandomNameGenerator {
private Random rand;
private static String[] prefixes = { "Ultimate", "Bloody", "Crooked",
"Hallowed", "Magnificent", "Heavy", "Jagged", "Grand", "Shiny",
"Rusty" };
...
> I'd say that is correct, yes. It's up to you whether or not you want to continue working on this one. I'll remove the "in progress" label as there haven't been any news on this one for a while.
> As the game can get more and more complex, and more and more moddable, it could be helpful to have the possibility to dump ***ALL*** information available about a game, as a way of 'debugging'.
Things like:
- [ ] Entities - [ ] Systems - [ ] Components - [ ] Cards, Zones - [ ] Resources - [ ] Resource Modifiers - see #182 - [ ] Event Listeners - [ ] Actions (which actions are available, where, and **why**)
@SimonAndréForsberg one thing I have been wondering about that you may know about is how to schedule things such that they never occur at the same time. At first I thought it was just a matter of setting them to occur at different intervals (such 30 minutes and 45 minutes, etc), but then I realized that eventually those intervals are going to overlap and happen at the same time
I'm using the built in ScheduleExecutorService thing
On branch js
Your branch is up-to-date with 'origin/js'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: extra-resources/JSGame.js
@SimonAndréForsberg what if the two things are happening on different servers? like server B connects to server A at a specified interval, but server A might be coincidentally writing to the files at that same moment
@bazola if server B connects to server A, you should use synchronization on server A to make sure it doesn't interfere with things. if the servers are unrelated, then why would it matter if something happens at the same time? why do you use the same files for different servers?
@Phrancis what's the most recent message in git log ?
the idea is that server C regularly backs up the game data from memory to disk. every 20 or so times that it does this backup, it also writes them to another directory. Server A is also running in that same location. Server B connects to Server A and requests that it send that backup data
server B is really a client that also generates the web pages based on the player and region data that it gets from server A
my thought was that it would be bad to have the MMO game server also serve up the files for the dynamic web content generation, so i made a separate project. the web content generator is on a different server so that one has to be separate
@Phrancis see the JSGame.js file instead. I did not touch CardData.js (and CardData.js is not used. JSGame.js is the file to edit if you want to see the changes)
@bazola the web server and MMO server should absolutely be different, yes. I think you can use a file lock approach. While you are writing to the files, add a file to the directory that indicates that they are being updated. then remove that file when you are done. whenever you read, check if the file exists.
@Phrancis no need to remove it. PhrancisGame.java depends on that file.
@SimonAndréForsberg thats very interesting. i noticed those being automatically created when my logging library is working, but as far as I know I didn't set it up to do that purposely
/**
* Contains the library of cards available for a Cardshifter game in JSON format.
* See the game documentation for an explanation of the usage of each
* attribute and effect.
* @param {Object} game - An instance of the game.
* @param {Object} zone - An instance of the zones.
* @param {Object} cards - Collection of card attributes, properties and effects.
*/
function addCards(game, zone) {
applyCardKeywords(game, zone, {
cards: [
@Simon ^^ Can the @param descriptions for game and zone be improved somehow? I'm not sure how to word it better
> I don't think this will be needed after all. I think your JS implementation looks good and won't need this particular type of documentation, at least for now.
@Phrancis Just a suggestion: Feel free to always use a comma at the end, even if it is the end of a list or object. It makes it easier to add new things afterwards. JS does not cause an error if there is a trailing comma
> With #182 somewhat applied, I noticed that those modifications are not shown properly to clients. The data being sent to the clients does not take the resource strategy into consideration.
Probably not worth worrying about for now, since there are so few of us working on that aspect, but maybe in the future at some point we can think of adding that, might be useful for larger card libraries.
Well... what would you think of perhaps some way that all the different functions are called and return a log of all the game mapping? (e.g., what things carry what value)
@Phrancis No, in HS you can only attack your opponent creatures and the opponent player (unless there's some secret in play that screws things up, of course...)
Your branch is up-to-date with 'origin/js'.
Francis-Veilleux-Gabourys-MacBook:cardshifter francisveilleux-gaboury$ git merge origin/js-load
Already up-to-date.
Francis-Veilleux-Gabourys-MacBook:cardshifter francisveilleux-gaboury$ git status
On branch js
Your branch is ahead of 'origin/js' by 10 commits.
(use "git push" to publish your local commits)
Francis-Veilleux-Gabourys-MacBook:cardshifter francisveilleux-gaboury$ git push
To github.com/Cardshifter/Cardshifter
! [rejected] js -> js (fetch first)
error: failed to push some refs to 'https://github.com/Cardshifter/Cardshifter'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
Francis-Veilleux-Gabourys-MacBook:cardshifter francisveilleux-gaboury$ git status
On branch js
Your branch is up-to-date with 'origin/js'.
nothing to commit, working directory clean