CodeWalrus

Development => Calculators => Calc Projects, Programming & Tutorials => Topic started by: Unicorn on July 02, 2015, 05:30:23 pm

Title: Game of pig or some other animal. [CSE]
Post by: Unicorn on July 02, 2015, 05:30:23 pm
Well, as a break from MoneyWalrii, I am making the game of pig, link to explanation soon. I have the opening scene done; as seen in the video.

https://m.youtube.com/watch?v=ZSEEa434msk

Oh yeah, and the background noise is a Marx brothers movie ;D

Link to game: http://cs.gettysburg.edu/projects/pig/piggame.html
Title: Re: Game of pig or some other animal.
Post by: alexgt on July 02, 2015, 05:32:17 pm
Awesome!

I thought the background noise was coming from the calc O.O
Title: Re: Game of pig or some other animal.
Post by: Unicorn on July 02, 2015, 05:35:01 pm
That would be bad *.*
Title: Re: Game of pig or some other animal.
Post by: DJ Omnimaga on July 03, 2015, 06:01:06 am
So since all the video shows is an animation for a title screen, mind explaining what this game is about and what has been programmed so far?
Title: Re: Game of pig or some other animal.
Post by: Unicorn on July 03, 2015, 01:33:07 pm
Title screens about it, but I'm going to try to post a link to an explaination, as I don't have copy paste readily available :(

EDIT: Link: http://cs.gettysburg.edu/projects/pig/piggame.html
Title: Re: Game of pig or some other animal.
Post by: DJ Omnimaga on July 06, 2015, 06:37:45 am
Ah I see. Thanks.  So it's more like a dice/guessing/board game?
Title: Re: Game of pig or some other animal.
Post by: Unicorn on July 06, 2015, 02:47:37 pm
Yeah, I'm gonna spice it up to make it look nice with xlibc and such. ;)
Title: Re: Game of pig or some other animal.
Post by: DJ Omnimaga on July 06, 2015, 03:20:21 pm
It would be interesting to see some graphics integrated in it, so it won't be just another clone of WFRNG v1.0000069
Title: Re: Game of pig or some other animal.
Post by: Unicorn on July 06, 2015, 05:14:26 pm
Yeah, I wanted to make up for simpleness with graphics. Anyways, the whole start animation is done and dice rolling is next. Its gonna besimple :P
Title: Re: Game of pig or some other animal.
Post by: DJ Omnimaga on July 09, 2015, 04:51:04 am
On a side note, is the game only known as Game of Pig? Because if it can easily be recognized under a different but similar name, then you could rename it to Game of Walrus and have :walrii: in it.


Also while graphics are good, if you're doing a simple game I would recommend avoiding making it oversized. For example, a guessing game should probably not take 10 KB of memory if it's gonna be like the ones on ticalc.org. :P I doubt anyone wants to waste 10 KB of archive just for a guessing game :P
Title: Re: Game of pig or some other animal.
Post by: Unicorn on July 09, 2015, 01:23:47 pm
But its not a guessing game... Anyways, it shouldn't take up to much space, as the game mechanics are simple.
Title: Re: Game of pig or some other animal.
Post by: DJ Omnimaga on July 10, 2015, 03:15:05 am
Yeah I meant as an example.
Title: Re: Game of pig or some other animal.
Post by: Unicorn on July 10, 2015, 02:34:31 pm
Ok, anyways, I have the two player game starting to work.
Title: Re: Game of pig or some other animal.
Post by: DJ Omnimaga on July 11, 2015, 02:22:31 pm
Is it possible to play vs an AI too?
Title: Re: Game of pig or some other animal.
Post by: Unicorn on July 11, 2015, 04:37:58 pm
I am going to try to implement that, it probably won't be too hard. Anyways, the two player part of the game is done :)
Title: Re: Game of pig or some other animal.
Post by: DJ Omnimaga on July 11, 2015, 05:06:00 pm
Awesome. Do you have any animated screenshot?
Title: Re: Game of pig or some other animal.
Post by: Unicorn on July 12, 2015, 01:08:45 am
Not right now, and I wot upload until the 27th or so, but I can probably take a video soon.
Title: Re: Game of pig or some other animal.
Post by: DJ Omnimaga on July 12, 2015, 06:11:11 am
Ah right you are not home until then. >.<
Title: Re: Game of pig or some other animal.
Post by: Unicorn on July 12, 2015, 03:09:38 pm
But, new vid! This goes through the whole two player game (not until one reaches one hundred but still) read the link I posted above for more information about the game and to follow along

http://www.youtube.com/watch?v=9gQrJs4f2PM
Title: Re: Game of pig or some other animal.
Post by: DJ Omnimaga on July 13, 2015, 05:26:31 pm
Needs more colors. Maybe a dice animation too :)
Title: Re: Game of pig or some other animal.
Post by: alexgt on July 13, 2015, 08:21:32 pm
I would agree with DJ, but good progress so far :)
Title: Re: Game of pig or some other animal. [CSE]
Post by: Snektron on July 13, 2015, 08:39:42 pm
While youre at it, make a 3d dice animation :P (in asm this shouldnt be hard add all since you can pre render the animation. Though i dont know about xlib's capabillities :P)
Title: Re: Game of pig or some other animal.
Post by: Unicorn on July 13, 2015, 10:25:34 pm
Yup, more colors will be coming, but a dice sprite may not happen because od animations. Maybe.
Title: Re: Game of pig or some other animal.
Post by: Unicorn on July 15, 2015, 03:09:02 am
UPDATE!

The AI was way easier to implement, and much smaller, so it'll be fine tuned and released tomorrow! I will also change the player two text colors for better visibility. I will use the XLIBC text command in a future update :)
Title: Re: Game of pig or some other animal.
Post by: Unicorn on July 15, 2015, 05:06:09 pm
Game of Pig is done!

So, head over here (http://codewalr.us/609/18169) to download it. The game has not been approved on Cemetech and ticalc still has the older version up.

Screenshots:
Two Player Game:
(https://codewalr.us/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FlSeD6IL.gif&hash=7d45089642ce9fb9ce89385a502f33bd)
One Player Game:
(https://usercontent.irccloud-cdn.com/file/ceGc1aL7/1436964261.gif)
Title: :walrii:
Post by: DJ Omnimaga on July 16, 2015, 05:21:35 am
Ok I'll give this a try when I have a chance. Although simple as a game, the layout looks quite nice. The only concern I have is the random colors at times, which make text hard to read >.<
Title: Re: Game of pig or some other animal.
Post by: alexgt on July 16, 2015, 02:03:57 pm
On the first gif there is pink o pink text and that is super hard for me to read :(
Other wise good work so far :)
Title: Re: Game of pig or some other animal.
Post by: Unicorn on July 16, 2015, 02:17:18 pm
Quote from: alexgt on July 16, 2015, 02:03:57 pm
On the first gif there is pink o pink text and that is super hard for me to read :(
Other wise good work so far :)

Its Pink on White!!!

You can really see it well on calc anyways. :)

EDIT: I'm in the process of adding dice sprites, and pig sprites. Current progress:
(https://usercontent.irccloud-cdn.com/file/kk2hhDxq/Game%20Of%20Pig%20Sprite%20sheet..png)
Title: Re: Game of pig or some other animal.
Post by: alexgt on July 16, 2015, 05:51:45 pm
Awesome! And I meant after player one went :P
Title: Re: Game of pig or some other animal.
Post by: Unicorn on July 16, 2015, 10:38:28 pm
Oh yeah, those colors are randomized. And adding a pig is the next step :)
Title: Re: Game of pig or some other animal.
Post by: DJ Omnimaga on July 20, 2015, 05:42:39 am
Glad to see graphics being added :D.
Title: Re: Game of pig or some other animal.
Post by: Unicorn on July 20, 2015, 12:19:06 pm
Thanks :) I should wok on them today, instead of failing at ruby. :P
Title: Re: Game of pig or some other animal.
Post by: Unicorn on July 21, 2015, 12:27:16 pm
Bump

Welp, it turns out that those die were NOT 8x8, they were 9x9. So, I remade the spritesheet in to this:
(https://usercontent.irccloud-cdn.com/file/TgtHrrF7/Game%20Of%20Pig%20Sprite%20sheet.png)
I'm not that happy about losing the 3D feel, so pleas feel free to remake the die in 3D. (I don't trust myself to :P)

So yeah. But now, after sending it to my calc, it displays the sprites, just making all the lighter colors a dark shade of  blue O.O
If anyone has any help for that, please tell. :)


:DCS
"33333333333333333B000000000000033B444000000444033B414000000414033B444000000444033B000000000000033B444000000444033B414000000414033B444000000444033B000000000000033B444000000444033B414000000414033B444000000444033B000000000000033B000000000000033333333333333333
If 80>det([[20:Then:Disp "Get Doors CSE to run this:","http://dcs.cemetech.net":Return:End
"GOPSPRT
real(5,0,0
real(0,1,1
real(0,1,0,0
100→T:2→P
DelVar ADelVar BDelVar KDelVar LDelVar MDelVar Y
real(0,3,4,0,1
real(0,3,4,0,0
det(12,255,255,0,0
Output(5,12,"The
While A≠50
A+1→A
End
Output(5,12,"   
For(B,1,10
real(0,1,1
det(12,255,255,randInt(1,255),randInt(1,255)
Output(5,5,"GAME
For(A,1,5
End
real(0,1,0
real(0,3,2
End
real(0,1,1
det(12,0,0,0,0
Output(5,5,"   
det(12,255,255,184,253
Output(4,4,"Of Pig.
For(A,1,15,1
End
real(8,1,0
det(12,52,15,0,0
Output(7,1,"PRESS [ENTER]
Pause
DelVar A
While A<100
A+1→A
getKey→K
If K
100→A
real(4,0,randInt(0,160),randInt(0,240),2,2,0,0,7,0,0,24,25,32,33,40,41
End
Lbl M
real(8,1,0
real(0,3,4,0,0
det(12,154,214,0,0
Output(1,1,"++++MENU!++++
Output(4,1,"1. ONE PLAYER
Output(5,1,"2. TWO PLAYER
Output(6,1,"3. QUIT
DelVar A
While A<5
getKey→K
If K=92
6→A
If K=93
7→A
If K=94
8→A
End
Lbl X
If A=8:Then
real(0,1,0,1
real(0,3,4,255,1
real(0,3,4,255,0
Stop
End
If A=7
Goto P
2→Y:2→E
Lbl P
DelVar IDelVar J
3-P→P
Lbl R
If P=1
DelVar Y
If P=2 and E=2
2→Y
If P=1
det(12,154,214,0,0
If P=2
det(12,174,14,0,0
real(0,3,4,0,0
If M≥100
Goto MW
If L≥100
Goto LW
"P1:
real(6,0,0,5,145,36,0
real(6,1,25,5,145,L,0
"P2:
real(6,0,110,5,145,36,0
real(6,1,135,5,145,M,0
Output(1,1,"++PLAYER:  ++
Output(1,11,P
Output(4,1,"1. ROLL
Output(5,1,"2. HOLD
Output(6,1,"3. QUIT
Output(8,1,"TURN TOTALS
Output(9,1,"P1:
Output(9,5,I
Output(10,1,"P2:
Output(10,5,J
If Y=2 and P=2:Then
For(A,0,400
End
End
If Y=2:Then
real(0,3,4,0,0
randInt(1,7→Q
If Q≥5
7→A
If Q<5
6→A
If J+M<L or J+M≤5
6→A
randInt(1,9→Q
If Q=2 or Q=8
7→A
If J>35
randInt(6,7→A
If J=0
6→A
If A=7
Output(1,5,"Hold!
If A=6
Output(1,5,"Roll!
For(B,0,300
End
End
If Y=2
Goto AI
DelVar K
While K<92
getKey→K
If K=92
6→A
If K=93
7→A
If K=94
8→A
End
real(0,3,4,0,0
If A=8
Goto X
Lbl AI
If A=7 and P=1
I+L→L
If A=7 and P=2
J+M→M
If A=7
Goto P
DelVar A
For(C,0,15
A+1→A
If A=1
DelVar S
If A=2
1→S
If A=3
2→S
If A=4
8→S
If A=5
9→S
If A=6:Then
10→S
DelVar A
End
randInt(1,6→R
real(4,0,75,54,1,1,0,0,7,0,0,S
For(B,0,20
End
real(7,9,75,54,8,8,0
End
randInt(1,13→O
If O=5
1→R
If R=1
det(12,randInt(1,255),randInt(1,255)
If P=1
"P1 Rolled→Str1
If P=2
"P2 Rolled→Str1
Output(1,1,Str1
Output(1,13,R
Output(5,1,"TURN TOTAL
If R=1 and P=1
DelVar IDelVar R
If R=1 and P=2
DelVar JDelVar R
If P=1:Then
I+R→I
Output(5,12,I
End
If P=2:Then
J+R→J
Output(5,12,J
End
If P=1
800→A
If Y=2 and P=2
300→A
For(D,0,A
End
If R=0
Goto P
Goto R
Lbl LW
Repeat getKey
det(12,randInt(1,255),randInt(1,255)
Output(1,2,"PLAYER ONE
Output(2,3,"HAS WON!
End
Goto M
Lbl MW
Repeat getKey
det(12,randInt(1,255),randInt(1,255)
Output(1,2,"PLAYER ONE
Output(2,3,"HAS WON!
End
Goto M
Title: Re: Game of pig or some other animal.
Post by: alexgt on July 23, 2015, 06:58:20 pm
Sorry no help from me :-\ what do you use to display the sprites, can xLib do that I don't know :P
Title: Re: Game of pig or some other animal.
Post by: Unicorn on July 23, 2015, 07:11:08 pm
Oh wow, there's been a ton of progress on this O.O

welp, there's new code, new spritesheets, and new screenshots. Oh yeah, and its pretty much done :P If anyone wants, they can optimize.

Screenshot:
(https://usercontent.irccloud-cdn.com/file/pQCSrMWr/1437567579.gif)

:DCS
"33333333333333333B000000000000033B444000000444033B414000000414033B444000000444033B000000000000033B444000000444033B414000000414033B444000000444033B000000000000033B444000000444033B414000000414033B444000000444033B000000000000033B000000000000033333333333333333
If 80>det([[20
Then
Disp "Get Doors CSE to run this:","http://dcs.cemetech.net
Return
End
"GOPSPRT
real(5,0,0
real(0,1,1
real(0,1,0,0
|E2->T:2->P
DelVar ADelVar BDelVar KDelVar LDelVar MDelVar Y
real(0,3,4,0,1
real(0,3,4,0,0
det(12,255,255,0,0
Output(5,12,"The
rand(45
Output(5,12,"   
For(B,1,10
real(0,1,1
det(12,255,255,randInt(1,255),randInt(1,255)
Output(5,5,"GAME
rand(2
real(0,1,0
real(0,3,2
End
real(0,1,1
det(12,0,0,0,0
Output(5,5,"   
det(12,255,255,184,253
Output(4,4,"Of Pig.
rand(5
real(8,1,0
det(12,52,15,0,0
Output(7,1,"PRESS [ENTER]
Pause
DelVar A
While A<100 and not(getKey
A+1->A
real(4,0,randInt(0,160),randInt(0,240),2,2,0,0,7,0,0,24,25,32,33,40,41
End
Lbl M
real(8,1,0
real(0,3,4,0,0
det(12,154,214,0,0
Output(1,1,"++++MENU!++++
Output(4,1,"1. ONE PLAYER
Output(5,1,"2. TWO PLAYER
Output(6,1,"3. QUIT
Repeat Ans>91 and Ans<95
getKey
End
Ans-86->A
Lbl X
If A=8:Then
real(0,1,0,1
real(0,3,4,255,1
real(0,3,4,255,0
Stop
End
If A=7
Goto P
2->Y:2->E
Lbl P
DelVar IDelVar J
3-P->P
Lbl R
If P=1
DelVar Y
If P=2 and E=2
2->Y
If P=1
det(12,154,214,0,0
If P=2
det(12,174,14,0,0
real(0,3,4,0,0
If M>=100
"   PLAYER 2  ->Str8
If L>=100
"   PLAYER 1  ->Str8
If M>=100 or L>=100
Goto W
"P1:
real(6,0,0,5,145,36,0
real(6,1,25,5,145,L,0
"P2:
real(6,0,110,5,145,36,0
real(6,1,135,5,145,M,0
Output(1,1,"++PLAYER:  ++
Output(1,11,P
Output(4,1,"1. ROLL
Output(5,1,"2. HOLD
Output(6,1,"3. QUIT
Output(8,1,"TURN TOTALS
Output(9,1,"P1:
Output(9,5,I
Output(10,1,"P2:
Output(10,5,J
If Y=2 and P=2:Then
rand(50
real(0,3,4,0,0
min(7,int(6+(J+M>99)+randJ/60(1+(J+M>L->A
Output(1,5,sub("Roll!Hold!",5A-29,5
rand(25
End
If Y=2 and P=2
Goto AI
Repeat A>5 and A<9
getKey-86->A
End
real(0,3,4,0,0
If A=8
Goto X
Lbl AI
If A=7 and P=1
I+L->L
If A=7 and P=2
J+M->M
If A=7
Goto P
DelVar F
For(C,0,20
remainder(C,6:(Ans`1)(16Ans-30+78not(Ans
real(4,0,75,54,2,2,0,0,7,0,0,Ans,Ans+1,Ans+8,Ans+9
End
real(7,9,75,54,16,16,0
randInt(1,6->R
randInt(1,13->O
If O=5
1->R
If R=1
det(12,randInt(1,255),randInt(1,255)
Output(1,1,"P"+sub("12",P,1)+" Rolled
Output(1,13,R
Output(5,1,"TURN TOTAL
If R=1 and P=1
DelVar IDelVar R
If R=1 and P=2
DelVar JDelVar R
If P=1:Then
I+R->I
800->A
Output(5,12,I
End
If P=2:Then
J+R->J
800->A
Output(5,12,J
End
If Y=2 and P=2
300->A
For(D,0,A
End
If not(R
Goto P
Goto R
Lbl W
getKey
While |E2<=max(L,M)not(getKey 
det(12,randInt(1,255),randInt(1,255) 
Output(1,1,"               
Output(8,1,"               
Output(2,1,"               
Output(7,1,"               
Output(6,1,"               
Output(3,1,"               
Output(4,1," PLAYER "+sub("12",1+(L>=|E2),1)+"   
Output(5,1,"   HAS WON!   
End
If |E2<=max(L,M
Goto M


(https://usercontent.irccloud-cdn.com/file/UdGhQh3Z/Game%20Of%20Pig%20Sprite%20sheet.png)
Title: Re: Game of pig or some other animal.
Post by: alexgt on July 23, 2015, 07:26:35 pm
Awesome! glad to see that you have the 3D dice :)
Title: Re: Game of pig or some other animal.
Post by: Unicorn on July 23, 2015, 08:15:52 pm
Quote from: alexgt on July 23, 2015, 07:26:35 pm
Awesome! glad to see that you have the 3D dice :)
Yeah, I had to remke the coord on the xlib sprite command, and it required 6 huge if loops to work, but someone on cemetech made it fast :) And LD's die are going to be decorations :)
Title: Re: Game of pig or some other animal.
Post by: alexgt on July 23, 2015, 09:28:47 pm
Cool, glad to hear it is complete, is it?
Title: Re: Game of pig or some other animal.
Post by: Unicorn on July 23, 2015, 09:54:47 pm
Quote from: alexgt on July 23, 2015, 09:28:47 pm
Cool, glad to hear it is complete, is it?
Yup, I think the guys at cemetech are done optimizing it. :) I'll just need to upload! ")
Title: Re: Game of pig or some other animal.
Post by: alexgt on July 24, 2015, 01:12:47 am
Awesome! :)
Title: Re: Game of pig or some other animal.
Post by: DJ Omnimaga on July 24, 2015, 04:40:48 am
I like the pigs and dices. Also be sure to add everyone who helped to the credits in the readme :)
Title: Re: Game of pig or some other animal. [CSE]
Post by: Snektron on July 24, 2015, 11:47:10 am
Whoa that dice looks good! Nice work :3
Title: Re: Game of pig or some other animal.
Post by: Unicorn on July 24, 2015, 03:38:15 pm
Quote from: DJ Omnimaga on July 24, 2015, 04:40:48 am
I like the pigs and dices. Also be sure to add everyone who helped to the credits in the readme :)

Yup, I'll do that to :)
Quote from: Cumred_Snektron on July 24, 2015, 11:47:10 am
Whoa that dice looks good! Nice work :3

Thanks!

Now, I just have to add LD Studios die for the decoration, and I'm done! And the readme :P
Title: Re: Game of pig or some other animal.
Post by: Unicorn on July 24, 2015, 08:25:59 pm
Bump!

The game is done! Head over here  (http://codewalr.us/index.php?topic=609.msg19269#msg19269)to try it out! And please, I do need to know how good the AI is, I just want to make sure it works out. ;)
Title: Re: Game of pig or some other animal.
Post by: DJ Omnimaga on July 31, 2015, 05:33:30 pm
Glad to see it released. I'll give it a try when I have a chance. Have you fixed the unreadable text colors, though?
Title: Re: Game of pig or some other animal.
Post by: Unicorn on July 31, 2015, 05:56:03 pm
Quote from: DJ Omnimaga on July 31, 2015, 05:33:30 pm
Glad to see it released. I'll give it a try when I have a chance. Have you fixed the unreadable text colors, though?

No, but they only show up once in a blue moon. Once I convert to the XLIBC DrawString, It'll be gone though.
Title: Re: Game of pig or some other animal.
Post by: DJ Omnimaga on August 02, 2015, 02:26:56 pm
Oh ok I thought that particular text always showed the same colors. If you ever make a more elaborate game you should definitively avoid randomized text colors, though, because that might be seen as bad game design practices.
Title: Re: Game of pig or some other animal.
Post by: Unicorn on August 02, 2015, 10:29:38 pm
Yeah, Ill be careful of that :)