How to detect "has current player won" using JavaScript only.

Game development with Board Game Arena Studio
User avatar
Tisaac
Posts: 2736
Joined: 26 August 2014, 21:28

Re: Probably the dumbest question I'll ever ask here...

Post by Tisaac »

JonChambers wrote: 14 July 2021, 10:37
Tisaac wrote: 13 July 2021, 14:30
JonChambers wrote: 13 July 2021, 12:47

And I’m not going to create a client side scoring system just for that one issue.
What are you talking about ?? The BGA framework already do that for you, that's the little stars right next the player names. They get automatically initialized with the value from the DB that is send in getAllDatas without you having to do anyting.
You can access basic player infos by using this.gamedatas.players
I'm talking about exactly what you think. I've read the documentation too. I know exactly how to do everything you suggested. But I won't.

Partly because it's a couple of lines longer, but more because the score doesn't get involved until the last second (1 for winner, 0 for loser) and I want to avoid displaying said score to the player as much as possible. I know veteran players know what 0 stars mean, but for me it's just clutter. Dash-star isn't much better, but it's a mild improvement.

Also, my solution is slightly shorter.
I sometimes wonder why you keep posting question here since you basically always end by saying "i will do it myself without using anything given by the framework".
Also, maybe it could help others if you post your "easier" solution, but you should first edit the thread title to make it clearer what this discussion is about.
User avatar
JonChambers
Posts: 97
Joined: 03 July 2021, 11:40

Re: Probably the dumbest question I'll ever ask here...

Post by JonChambers »

Tisaac wrote: 14 July 2021, 14:30
JonChambers wrote: 14 July 2021, 10:37
Tisaac wrote: 13 July 2021, 14:30 What are you talking about ?? The BGA framework already do that for you, that's the little stars right next the player names. They get automatically initialized with the value from the DB that is send in getAllDatas without you having to do anyting.
You can access basic player infos by using this.gamedatas.players
I'm talking about exactly what you think. I've read the documentation too. I know exactly how to do everything you suggested. But I won't.

Partly because it's a couple of lines longer, but more because the score doesn't get involved until the last second (1 for winner, 0 for loser) and I want to avoid displaying said score to the player as much as possible. I know veteran players know what 0 stars mean, but for me it's just clutter. Dash-star isn't much better, but it's a mild improvement.

Also, my solution is slightly shorter.
I sometimes wonder why you keep posting question here since you basically always end by saying "i will do it myself without using anything given by the framework".
Also, maybe it could help others if you post your "easier" solution, but you should first edit the thread title to make it clearer what this discussion is about.
It's not a general solution, it's a solution that fits within my specific game and attaches itself to specific functions I have already written for other things.

I was very clear with my question. It was "is there a JavaScript only solution?" The answer is "no". Done.

If there was a JavaScript only solution, I would have used a JavaScript only solution. There isn't, so I'm adding an extra line of PHP. I didn't want to add an extra line of PHP, but it looks like I have to.

I'm guessing here, but did you help to write the framework? Because you always sound very salty whenever I avoid using it. It's nothing personal, and I have nothing against the framework in the general sense. It's just coding decisions I continue to make on a case by case basis.
User avatar
robinzig
Posts: 459
Joined: 11 February 2021, 18:23

Re: Probably the dumbest question I'll ever ask here...

Post by robinzig »

JonChambers wrote: 16 July 2021, 05:52 I'm guessing here, but did you help to write the framework? Because you always sound very salty whenever I avoid using it.
As far as I know - although I could be mistaken - Tisaac had nothing to do with writing the framework, and is just a (very experienced) user of it for developing games on BGA.

I must say though - and this is my real reason for posting - I understand why he is "salty" because I get a similarly bad taste from reading your posts. Now I don't know you and like to always assume the best of people - you're probably a great guy and a really amazing developer. But the attitude I pick up from reading your posts here is that of someone who isn't really interested in BGA as a service but just wants to use it as a "playground" for developing your own game(s) (I seem to recall you posting somewhere to complain that you had to play a single game on the platform before being allowed to develop anything, meanwhile talking about some grandiose plan to make loads of money from your game by hosting it here), and isn't interested in listening to advice from those who are more experienced on the platform, instead crowing about how great your own solutions are and how stupid the framework is.

Don't get me wrong, I get frustrated by the framework too (I'm also though pretty new to it, still developing my first game here although hopefully pretty close to having it ready for Alpha) - in particular as a somewhat-experienced Javascript developer I think a lot of what it makes you do on the client side is frankly dumb. But I don't go around making snide forum posts about it. Perhaps if you expressed your frustrations in a more constructive way, without implying you always know better, you might get a better reaction?

Just friendly advice though, I'm not going to come back on this if, as I half suspect, you're going to make some snide comment in response.
User avatar
JonChambers
Posts: 97
Joined: 03 July 2021, 11:40

Re: Probably the dumbest question I'll ever ask here...

Post by JonChambers »

Okay, using the word "salty" was out of line, and I was a bit sleep deprived while I wrote it.

Ever since my game design was first an idea, it has been very difficult to get any sort of focus when asking for help. I exaggerate, but if I were to ask "Should I use Areal or Times New Roman?" the response would typically be "The game needs to be rethemed to include dinosaurs in space!"

"No, I'm not including Dinosaurs in space, I'm just trying to work out the best font."

"Well why even ask for help if your not going to accept it!?"

Over and over and over. It has completely worn me down.

Then:
I sometimes wonder why you keep posting question here since you basically always end by saying "i will do it myself without using anything given by the framework".
It all came back to me at that point. Every single "Forget what you asked, why not change your game to include this? Why ask a question at all if you're not going to do what I say? Don't ever speak to me again unless you build all of my feedback into your game!"

This game should have been under everyone's Christmas tree last year. The print files are done. I've neglected my family to make it happen. I still need to storyboard the script for the KS video. I've spent thousands of dollars of my own money, and here I am defending my moral character to some people online I've never met because I didn't want to include someone else's line of code in my work when I should be working.

I don't want anyone to be upset, not just with me, but at all. I genuinely want every single one of you here to have a happy and glorious life. I want every interaction you have with me to be a positive on your life. I genuinely do.

I want to make everything right, but I've also got work to do.

I've spent at least 15 minutes just editing this last paragraph. What do I have to say to make this community not hate me? I'm sure this is all a misunderstanding, but I don't know how to make myself correctly understood.
User avatar
JonChambers
Posts: 97
Joined: 03 July 2021, 11:40

Re: Probably the dumbest question I'll ever ask here...

Post by JonChambers »

False alarm.

I posted recently thinking I had found a JavaScript only solution.

I was mistaken, so I have taken my solution down.
User avatar
robinzig
Posts: 459
Joined: 11 February 2021, 18:23

Re: Probably the dumbest question I'll ever ask here...

Post by robinzig »

JonChambers wrote: 17 July 2021, 03:25 Okay, using the word "salty" was out of line, and I was a bit sleep deprived while I wrote it.

Ever since my game design was first an idea, it has been very difficult to get any sort of focus when asking for help. I exaggerate, but if I were to ask "Should I use Areal or Times New Roman?" the response would typically be "The game needs to be rethemed to include dinosaurs in space!"

"No, I'm not including Dinosaurs in space, I'm just trying to work out the best font."

"Well why even ask for help if your not going to accept it!?"

Over and over and over. It has completely worn me down.

Then:
I sometimes wonder why you keep posting question here since you basically always end by saying "i will do it myself without using anything given by the framework".
It all came back to me at that point. Every single "Forget what you asked, why not change your game to include this? Why ask a question at all if you're not going to do what I say? Don't ever speak to me again unless you build all of my feedback into your game!"

This game should have been under everyone's Christmas tree last year. The print files are done. I've neglected my family to make it happen. I still need to storyboard the script for the KS video. I've spent thousands of dollars of my own money, and here I am defending my moral character to some people online I've never met because I didn't want to include someone else's line of code in my work when I should be working.

I don't want anyone to be upset, not just with me, but at all. I genuinely want every single one of you here to have a happy and glorious life. I want every interaction you have with me to be a positive on your life. I genuinely do.

I want to make everything right, but I've also got work to do.

I've spent at least 15 minutes just editing this last paragraph. What do I have to say to make this community not hate me? I'm sure this is all a misunderstanding, but I don't know how to make myself correctly understood.
Hey, thanks for the thoughtful reply. Shows how easy it is to misjudge someone from just their online posts (which I feared I may be doing), and I apologise for questioning your "moral character".

For what it's worth, while I can't speak for others and know it wasn't aimed at me, I couldn't care less about the word "salty" and don't consider it remotely rude or offensive. What I was referring to was what I perceived to be a general attitude in all your posts, which came across as "I know best", "I don't care what other people advise me to do, that's stupid", and "I don't care about BGA anyway, I just want to use its services to make money for myself". (Forgive me for being blunt and exaggerating, but that's definitely an only slightly crude summary of what I picked up from your posts. Perhaps I'm alone in having perceived this, but it seems not from what others have posted.)

Now I had no idea you were spending all this time and money on actually designing a game AND preparing a KS campaign for it - man I would have no idea where to even start with either of those things, and I can well imagine the stress. And I can understand why you might think that having an already-playable version, free for all on BGA, ready for the KS launch, would help you - so you can tell people to try it online. But I must say there are I think good reasons why the vast majority of games on BGA are adaptations of already-existing, long-since released games that are already popular. For one, there are a lot of games here, the vast majority of people aren't going to play every game that exists on the platform and just want to play ones they already know and like, or learn a game that they already know is well-regarded. Small games from small companies unfortunately don't get much traction - even if the game is incredible. For another, as you've no doubt discovered, it's a lot of effort for a single developer - particularly one new to the platform - to implement a game on BGA, and it's also a lot of effort to design a game, and a huge amount of effort to market the game through KS and guide it through to production/shipment. I don't think you're doing yourself any favours by trying to combine the two at once! You might be better off leaving the BGA implementation until your game is released and at least moderately successful - or asking another developer, perhaps one with more experience of the platform, to do the development for you. (The forums are full of posts from small publishers asking for developers to help bring their game to BGA.) Even if you have the development experience/expertise to be able to do the implementation yourself, trying to do that at the same time as all the marketing etc is likely to result in you getting overstretched and not doing any of the jobs as well as your game would deserve.

It's not my intention to lecture anyone, I have no idea how to run a KS campaign, so please take this as it is: random advice from a stranger on the internet, which you are perfectly free to ignore :D

Take care, try to catch up on some sleep - and as a favour, if you give me the name of your game I will look it up on BGG/KS. (Not promising I'll be interested, let alone back it, but I feel invested enough now to at least give you the time of day! :) )
User avatar
Benoit314
Posts: 82
Joined: 02 April 2020, 22:12

Re: Probably the dumbest question I'll ever ask here...

Post by Benoit314 »

robinzig wrote: 17 July 2021, 12:14 But I must say there are I think good reasons why the vast majority of games on BGA are adaptations of already-existing, long-since released games that are already popular. For one, there are a lot of games here, the vast majority of people aren't going to play every game that exists on the platform and just want to play ones they already know and like, or learn a game that they already know is well-regarded. Small games from small companies unfortunately don't get much traction - even if the game is incredible.
I think it depends. You won't get a lot of attention from the BGA side, as robinzig said, there are a lot of games here.
It may help in your campaign by letting potential backers play the game.
But it is a double-edged sword, sometimes a game looks really cool, you back it then receive it and realize it is kinda boring or not for you. So if people try it first...
User avatar
JonChambers
Posts: 97
Joined: 03 July 2021, 11:40

Re: How to detect "has current player won" using JavaScript only.

Post by JonChambers »

Benoit314 wrote: 17 July 2021, 13:55
robinzig wrote: 17 July 2021, 12:14 But I must say there are I think good reasons why the vast majority of games on BGA are adaptations of already-existing, long-since released games that are already popular. For one, there are a lot of games here, the vast majority of people aren't going to play every game that exists on the platform and just want to play ones they already know and like, or learn a game that they already know is well-regarded. Small games from small companies unfortunately don't get much traction - even if the game is incredible.
I think it depends. You won't get a lot of attention from the BGA side, as robinzig said, there are a lot of games here.
It may help in your campaign by letting potential backers play the game.
But it is a double-edged sword, sometimes a game looks really cool, you back it then receive it and realize it is kinda boring or not for you. So if people try it first...
Yup, you get it. My assumption is that absolutely no one will discover my game through the platform. The customer experience goes:
Advertising -> Kickstarter Page -> BGA link -> Play game -> Purchase game

Don't get me wrong, I'd love it if people discovered my game through BGA, but that's about as likely as playing in the middle of a busy shopping centre and expecting passing shoppers to stop what they're doing and join in. Sure, I might get a couple, but that's not what I'm here for.

I have a learning style that's a little confrontational, and I respect people who don't want to get involved. If I'm not sure if X is true or not, I publicly declare that it is and wait for the hate to pile on me for believing in X. Sometimes I'm told I'm a bad person, I get disinvited from board game tables in other countries apparently, accused of being toxic, and among all that sometimes I get good reasons for me to stop believing in X (at which point I publicly declare X to be false and start the cycle all over again).

I do my very best to stick to X and not talk about people, like calling them salty or anything. (Again, sleep deprivation. My son is teething. My daughter's on her 16th day of school holidays. And with my day job... business keeps picking up even though I wish it would die down so I can launch this damn game already!)

It gets the better of me.

Also when I'm trying to ask a question "sorry, you haven't played any games. Play a game and wait 24 hours." I haven't played a game other than my own for like three years! Don't rub it in, it hurts! I literally avoid making eye contact with my board game collection these days. That entire game of Yahtzee, I was thinking "I should be doing something useful right now". I'm not even making this up. Half way through, my wife came in and asked me what I was doing because she had chores for me to do. I had to tell her I was playing Yahtzee to support the stupid card game she doesn't believe will be successful. It was the most painful game of Yahtzee in my life! I don't even like Yahtzee normally!

(Oh yes, a new part of the story: I'm only allowed to spend as many minutes developing the game as she spends with her feet up relaxing, because both are deemed equally productive. What makes me angriest about this is she's probably right. She doesn't go into thousands of dollars worth of debt when she puts her feet up. Writing this response now is on that minute quota mentioned.)

Oh, also, I think there's a bug. When I test, player 2 goes first like 80% of the time. I tried to report it, but I need to play TWO games to report bugs and I don't have time for a second game. If anyone here has played two games and would like to report that bug for me, please do. But I'm dying over here. Sorry for everyone who feels I'm exploiting the services for not playing games. I'll just wear that hate on the chin.

I'll address the vibes I've been giving off and assess them for truth:

"I know best", "I don't care what other people advise me to do, that's stupid"

When I have a question about coding, usually I already have three or four ways of doing it in mind, but none of them feel clean enough. When my solutions seem to have redundant code, or rely too much on the server side or client side than they need to, or require me to write features the framework already has, I reach out for more options.

Yes, in my early days my questions would be along the lines of "I have absolutely no idea how to do X. Is there any way at all that X can be done!?" I'd like to thing everyone got themselves banned from stackoverflow when they were starting out. We all need to start somewhere. But the days of not being able to complete something at all are long behind me now. These days I only concern myself with doing it the cleanest way possible, and will only consider options that are cleaner than the ones I already have.

Is that an arrogant view to take? I don't know. Maybe. It's just my experience of coding these days. In a few years when I get better at it, my outlook will probably be completely different again, which will again be reflected in some new type of questions I'll start asking. Hopefully those questions will be better received, but I have no idea. (They'll probably be around writing the best tests for Test Driven Development. Not doing that yet, but I want to.)

"I don't care about BGA anyway, I just want to use its services to make money for myself"

That one's actually fair. I still plan on attracting thousands of new players to the platform, and offering up cash prize money for my tournament which will probably end up being claimed by a veteran player here adding value to the community overall, but it's not because I care. I've only just got enough energy left to care about my wife and two kids. In my current mental state, pure self interest and greed is the only thing that's keeping me going. If I ever run out of greed and self interest, I'll probably collapse asleep in the middle of the floor.

And I don't expect any care in return. Let me do my thing. Answer my questions if you feel up to it. Or don't if you don't. Refrain from calling me toxic, and wait for all the new players to come to the platform, to play my "prototype" as someone called it.

Or maybe they won't. Maybe this will all explode in my face and was a complete waste of thousands of dollars and years of my life. Watch this space. We'll find out together.

Sure, I've got like a passive care thing going. Like I'd never wish any harm on anyone, and if there was a button that said "make everyone on BGA live a happy life" I'd push the button a few times, but that's about as much care as I can muster right now. Please forgive that.

Also, the game isn't anywhere yet. I'm not a fan of pre-launch advertising. But when it's released for free here I'm sure you'll find out about it.
Post Reply

Return to “Developers”