SRL Archive - Research & Development Lounge

Black jack game for Simba


rj

2013-11-11 20:54:00

So… I couldn't hold it any longer. The past month I have been developing a game using Simba. The name of the game: BlackJack. For those of you that don't know, BlackJack is the most popular American casino card game (http://en.wikipedia.org/wiki/Blackjack)


I was originally going to make a text base dicing game with the lape interpreter (https://github.com/officerBarbrady/Simba-BlackJack/commit/b3c8b9a360b83b889c5b5dec5ed95f5766a5ba71 aqs you can see it was called dicinggame lol). I got bored of that quick and wanted to make a more advanced gambling game. So then I thought to make a text based Blackjack game, (I wanted to Utilize Lape). I soon realised how boring, confusing and godawful the game play would be, and how annoying it would be to program it. So then I switched to pascalscript and began work on making a form based game.



Things that has been accomplished

- Card drawing. I have completed the card drawing portion, I tested it using a tlabel to draw a random card. This proved to be a challenge at first with many annoying bugs like this

[spoiler=media]
Eventually I got it
[/spoiler]

After aiming to have better graphics, and fixing a ton of range checks I added the card type:

[spoiler=media]

[/spoiler]

- Card adding, this was a challenge at first. These are the default values for cards

function getValue(card:string):Integer;
begin
case card of
'2': result := 2;
'3': result := 3;
'4': result := 4;
'5': result := 5;
'6': result := 6;
'7': result := 7;
'8': result := 8;
'9': result := 9;
'10', 'Jack', 'Queen','King': result := 10;
'Ace': result := 11;
end;
end;

BUT the value of ace can also be 1. But the player would only benefit from the value of Ace being 1 if he/she goes over 21.. So I wrote up this bad boy

function cardTotal(cardArray:TIntegerArray):Integer;
var
aceCount, i:Integer;
begin
for i := 0 to high(cardArray) do
result := result + TDeck[cardArray[i]].value;
for i := 0 to high(cardArray) do
begin
if (TDeck[cardArray[i]].name = 'Ace') then
aceCount := aceCount + 1;
end;
if (result > 21) then
begin
for i := 0 to (aceCount - 1) do
begin
result := result - 10;
if (result <= 21) then
exit;
end;
end;
end;

It gets the best value of the players cards.


- Load players, the script (or program not really a script) creates a folder called 'BlackJack'. Inside this folder it saves all of the player profiles
[spoiler=media]
[/spoiler]

it successfully loads the players information.



- Cash stacks, I decided to make the cash var int64… just for shits and giggles… you can get up to 9,223,372,036,854,775,807 coins lol. Depending on how much cash you have, the cash color changes




I plan on finish this game within the next month, the amount of time I have available has been fluctuating


Lol.

I would say that I'm about 80% done all I have to do it add actual gameplay

Commits: https://github.com/officerBarbrady/Simba-BlackJack/commits/master
Source: https://github.com/officerBarbrady/Simba-BlackJack/tree/master/src

Credits

Janilabo Ofc for Count function

Janilabo

2013-11-11 21:01:04

I know you have been working pretty hard for this game these last weeks, and it is great to see you managed to get all this stuff together in the time you were planning.
Very nice release Officer, good work man! :p

Of course, still some work to do, but it is getting there! It's has progressed a lot since the first stages. ;)

rj

2013-11-11 21:06:26

From: Janilabo
I know you have been working pretty hard for this game these last weeks, and it is great to see you managed to get all this stuff together in the time you were planning.
Very nice release Officer, good work man! :p

Of course, still some work to do, but it is getting there! It's has progressed a lot since the first stages. ;)

Thanks, It's been a pleasure to use more of your string functions :p

Wanted Returns

2013-11-11 21:49:36

Really nice.. and interesting

Back in the day I had a signature that parsed global stats from SRL stats and put them on top of a signature with actual in game pictures of money etc. (Thanks AWKWARD To SAW) As apart of the RCrB project

Try that with the cash stacks and use 'SmallChars'? ;

rj

2013-11-11 21:52:59

From: Wanted Returns
Really nice.. and interesting

Back in the day I had a signature that parsed global stats from SRL stats and put them on top of a signature with actual in game pictures of money etc. (Thanks AWKWARD To SAW) As apart of the RCrB project

Try that with the cash stacks and use 'SmallChars'? ;


Tried to change fonts already but it seems to only support preloaded ones

Wanted Returns

2013-11-11 21:54:51

From: Officer Barbrady
Tried to change fonts already but it seems to only support preloaded ones


I forgot… what is possible in PHP isn't in Simba etc. hmmm

I want to say use TBitmaps etc. but I'm not familiar with Simba's system enough

rj

2013-11-11 21:58:48


vs


Weird.

Wanted Returns

2013-11-11 22:00:23

From: Officer Barbrady

vs


Weird.


Why not use actual in game pictures and edit out the black etc. to make it look more clean?

rj

2013-11-11 22:02:04

From: Wanted Returns
Why not use actual in game pictures and edit out the black etc. to make it look more clean?


Because when I made the bitmap I thought that the black would default and be ignored by mufusa/ bitmaps/TImages don't do that I guess? (First time working with them)

Not a priority to change atm

Ian

2013-11-11 22:03:31

From: Wanted Returns
I forgot… what is possible in PHP isn't in Simba etc. hmmm

I want to say use TBitmaps etc. but I'm not familiar with Simba's system enough


I had a paint proggy that would change money text colors was amount increased, so you could do that but also change the bitmaps I think.


The values were faked for testing (Clay := 173000 sort of thing), but the color and symbol changes were automatic.

Wanted Returns

2013-11-11 22:04:06

From: Officer Barbrady
Because when I made the bitmap I thought that the black would default and be ignored by mufusa/ bitmaps/TImages don't do that I guess? (First time working with them)

Not a priority to change atm


Users love GUIs etc. ;)

The Killer

2013-11-12 12:28:30

From: Wanted Returns
Really nice.. and interesting

Back in the day I had a signature that parsed global stats from SRL stats and put them on top of a signature with actual in game pictures of money etc. (Thanks AWKWARD To SAW) As apart of the RCrB project

Try that with the cash stacks and use 'SmallChars'? ;


srl stats are fairly bugged iirc, an alternative would be: http://villavu.com/forum/showthread.php?t=94643&highlight=