HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Aesthetics?

10-13-2009, 05:21 PM#1
Cheezeman
Not so sure if this should be posted here, but it kinda involves script.

I've made this script which I plan to release in a few hours (or tomorrow if I don't have the time), which is related to betting. I have two issues with it, of which n.o2 is the most important.

1: I have no idea what to name it. I've called it "BettingUtils" as of now, but I'm not so sure if that's a proper name.
2: If you were to use this betting system of mine, would you prefer passing on a real or an integer when doing bets [call Bet( instance, player, on what, <amount>]? (Consider that the most probable form would be Gold == Integer)
Right now it's taking real as parameter, but what would you prefer?
10-14-2009, 05:08 AM#2
chobibo
2. I would prefer integers. Much simpler in my opinion.
10-14-2009, 08:02 AM#3
cosmicat
If this is a single modular script, I believe Utils is the appropriate convention.

As for betting type, integers are much better IMO for several reasons. As chobibo said, they're a lot simpler than reals. Also, they're more accurate - reals (especially those generated from user input) have horrible precision most of the time, which makes (in)equalities break at times. For instance,
Collapse JASS:
local real r = S2R("90")
if r == 90. then
  call BJDebugMsg ("90. == 90.")
else
  call BJDebugMsg ("Jass reals are suck.")
endif
^Actually, I'm not sure whether that specific case does have problems, but I've definitely had things like that break in the past (most notably Archmage Owenalacaster's custom race system, which has to make room for huge precision error when obtaining the player's handicap).

Say you want players to be able to bet in chat. Red types -wager 50. His wager is then converted to a real and stored. Later, a trigger checks for bets less than or equal to 50. If the player's input of "50" got stored as 50.0000001, the expression fails. Bad.

Besides, in real life everybody bids integers anyway. Even if you bid $0.50, that's technically 50 cents. A 2:1 return would leave a $0.50 bidder with $1.00 (100 cents); a 3:1 return would leave a $1.00 bidder with $1.33 (133 cents), and so forth. You wouldn't have $1.333333... in cash or in betting chips (though you might in a bank account, depending on how that's run). Bets and returns truncate; integers truncate.
10-14-2009, 08:52 AM#4
Captain Griffen
Bear in mind == has some leeway, != has to be exactly the same to go false (I think). So it's possible x == y and x != y. Not sure if it's similar for >= and <=.
10-14-2009, 12:25 PM#5
Cheezeman
Thanks chobibo for opinion, and thank you cosmicat for useful information. I don't doubt it's true because I've heared it being mentioned in other places too.

--

Because I recently got another system approved in hive and don't wish to spam them with scripts,
I might just show you BettingUtil's header and you can tell me if you'd find it easy and useful, or just horrible (yeah, another public-contact question).

Expand JASS:
10-14-2009, 01:27 PM#6
Rising_Dusk
BettingUtils? Utils is shorthand for utilities, which is used primarily for libraries that take something and simplify it or standardize it. Since betting isn't even in WC3 normally, I don't think it's really that applicable. Call it BettingLib or something, or maybe just GamblingScript.

Furthermore, who the heck is actually going to have use for something like that? I mean, random number generator with associated winnings. It'd only be useful in maps that... Err.. Have gambling. That's such a limited scope, and really, it should be easily coded without the library. I wouldn't use a hashtable, I'd just use a struct.
10-14-2009, 02:00 PM#7
Cheezeman
1: Okay, then I'll come up with a better name
2: This was requested by a friend of mine so obviously someone needs it
3: I've played at least 4 maps with gambling, all of them were of the concept "bet 200 gold on a hero and if he wins you get 200% back". I simply wish to enhance this gameplay feature because 1on1 combats are often imbalanced, and thus everyone gets 600 extra gold without actually have done any real betting.
10-14-2009, 02:09 PM#8
Rising_Dusk
Quote:
Originally Posted by Cheezeman
2: This was requested by a friend of mine so obviously someone needs it
A script that instantly kills every unit on the map every 10 seconds was once requested of me, so obviously someone needed it. That doesn't make it useful.
Quote:
Originally Posted by Cheezeman
I simply wish to enhance this gameplay feature because 1on1 combats are often imbalanced, and thus everyone gets 600 extra gold without actually have done any real betting.
So tell me, how is a gambling script going to fix the imbalance inherent to most 1v1 duels in hero arenas and the like?
10-14-2009, 02:43 PM#9
Cheezeman
Quote:
Originally Posted by Rising_Dusk
So tell me, how is a gambling script going to fix the imbalance inherent to most 1v1 duels in hero arenas and the like?
At least they'll get less gold back than normally, perhaps even less than was originally betted because of the bookmarker's share of it.
That'll balance the betting, not the heroes.

And I think that all of those 4 maps need it, which makes it useful, unlike a trigger that kills everyhing in the map. Which I've never seen in a map.
10-14-2009, 02:55 PM#10
Rising_Dusk
Quote:
Originally Posted by Cheezeman
And I think that all of those 4 maps need it, which makes it useful, unlike a trigger that kills everyhing in the map. Which I've never seen in a map.
Irrelevant. I've never actually seen gambling in a map myself, but that doesn't mean it doesn't exist. It was requested of me, so by your logic what I made for him was useful. It's not, just throwing it out there.
Quote:
Originally Posted by Cheezeman
At least they'll get less gold back than normally, perhaps even less than was originally betted because of the bookmarker's share of it.
That'll balance the betting, not the heroes.
Of course, all of those things are user-regulated anyways, so the balance is entirely apart from what this script of yours does. That's my point.

Anyways, all this system has to do is manage two percents and check an integer. I don't think that does enough to even merit a script resource.
10-14-2009, 03:45 PM#11
Cheezeman
I'm not uploading it here anyway, so that's not a problem.

Edit: Wait... You're saying that I shouldn't upload my script because the it's too easy to make? Then why hasn't anyone made (and used) it yet?
10-14-2009, 03:58 PM#12
chobibo
GambleEngine v1.00
10-14-2009, 05:00 PM#13
Rising_Dusk
Quote:
Originally Posted by Cheezeman
Edit: Wait... You're saying that I shouldn't upload my script because the it's too easy to make?
Yes, there's actually a rule in the submission rules about it.
Quote:
Originally Posted by Cheezeman
Then why hasn't anyone made (and used) it yet?
Because it's not (widely) useful.
10-14-2009, 05:06 PM#14
Cheezeman
Sorry chobibo but I can't find it :/

Fine, you win. I won't upload it, but my friend will enjoy it though.
Thanks!