How do I code a social game?

-cracks knuckles- This is about as complex of coding as I’ve ever done, but hopefully I can give you a few tips.

I’ve coded a similar game, it has 3 general parts:

  • Overlay creation—overlays are created based on how far the player has gone in the game
  • Game itself—it’ll need gains to let the app know when the players have already clicked a bubble
  • “Check” sequence where the app checks if the reader is done playing, based on gains earned

Here’s my basic samples of how I coded it:

Sample of overlay creation

label start_social_game

if ( [not bubble_1_complete] ){
@overlay BUBBLE1 create AND BUBBLE1 opacity 1 in 0 AND BUBBLE1 shifts to 100 100 AND BUBBLE1 scales to 1.000 1.000
}
if ( [not bubble_2_complete] ){
@overlay BUBBLE2 create AND BUBBLE2 opacity 1 in 0 AND BUBBLE2 shifts to 200 100 AND BUBBLE2 scales to 1.000 1.000
}

Sample of what a bubble sequence will look like

tappable
“BUBBLE1”{

@overlay BUBBLE1 opacity 0 in 3
@overlay BUBBLE1 clear

PEOPLE
Dialogue and scene here.

gain bubble_1_complete
} “BUBBLE2”{

@overlay BUBBLE2 opacity 0 in 3
@overlay BUBBLE2 clear

PEOPLE
Dialogue and scene here.

gain bubble_2_complete
}

Sample "check" sequence that would go below your game coding

if (bubble_1_complete){
if (bubble_2_complete){
if (bubble_3_complete){
goto continue_story
}}}

goto start_social_game

Putting it all together

EXT. HOUSE POOL - DAY
###Here you set the scene; place characters, place the pool overlays, anything not related to the game. In your script, that looks like everything before “@MAIN is shiftweight”

label start_social_game

if ( [not bubble_1_complete] ){
@overlay BUBBLE1 create AND BUBBLE1 opacity 1 in 0 AND BUBBLE1 shifts to 100 100 AND BUBBLE1 scales to 1.000 1.000
}
if ( [not bubble_2_complete] ){
@overlay BUBBLE2 create AND BUBBLE2 opacity 1 in 0 AND BUBBLE2 shifts to 200 100 AND BUBBLE2 scales to 1.000 1.000
}

tappable
“BUBBLE1”{

@overlay BUBBLE1 opacity 0 in 3
@overlay BUBBLE1 clear

PEOPLE
Dialogue and scene here.

gain bubble_1_complete
} “BUBBLE2”{

@overlay BUBBLE2 opacity 0 in 3
@overlay BUBBLE2 clear

PEOPLE
Dialogue and scene here.

gain bubble_2_complete
}

if (bubble_1_complete){
if (bubble_2_complete){
if (bubble_3_complete){
goto continue_story
}}}

goto start_social_game

Now, that’s only part of it; my game happened in 1 zone. Having 2 zones throws another wrench into it. :slight_smile:

I think the best way to do this is to have 1 tappable game that spans both zones. :thinking:

Putting it all together... with the game happening in 2 zones

EXT. HOUSE POOL - DAY
###Here you set the scene; place characters, place the pool overlays, anything not related to the game. In your script, that looks like everything before “@MAIN is shiftweight”. However, the arrows should be created here, outside of the main gameplay.

@overlay RIGHTARROW create AND RIGHTARROW shifts to 100 200 in zone 1 AND RIGHTARROW opacity 1 in 3 AND RIGHTARROW scales to 1.0 1.0

@overlay LEFTARROW create AND LEFTARROW shifts to 100 300 in zone 2 AND LEFTARROW opacity 1 in 3 AND LEFTARROW scales to 1.0 1.0

label start_social_game

if ( [not bubble_1_complete] ){
@overlay BUBBLE1 create AND BUBBLE1 opacity 1 in 0 AND BUBBLE1 shifts to 100 100 in zone 2 AND BUBBLE1 scales to 1.000 1.000
}
if ( [not bubble_2_complete] ){
@overlay BUBBLE2 create AND BUBBLE2 opacity 1 in 0 AND BUBBLE2 shifts to 200 100 in zone 2 AND BUBBLE2 scales to 1.000 1.000
}
if ( [not bubble_3_complete] ){
@overlay BUBBLE3 create AND BUBBLE3 opacity 1 in 0 AND BUBBLE3 shifts to 200 100 in zone 1 AND BUBBLE3 scales to 1.000 1.000
}

###Bubble 3 is in zone 1, the others are in zone 2.

tappable
“BUBBLE1”{

@overlay BUBBLE1 opacity 0 in 3
@overlay BUBBLE1 clear

PEOPLE
Dialogue and scene here.

gain bubble_1_complete
} “BUBBLE2”{

@overlay BUBBLE2 opacity 0 in 3
@overlay BUBBLE2 clear

PEOPLE
Dialogue and scene here.

gain bubble_2_complete
} “BUBBLE3” {

@overlay BUBBLE3 opacity 0 in 3
@overlay BUBBLE3 clear

PEOPLE
Dialogue and scene here.

gain bubble_3_complete
} “LEFTARROW” {

@MAIN walks to screen center in zone 1

} “RIGHTARROW” {

@MAIN walks to screen center in zone 2

}

if (bubble_1_complete){
if (bubble_2_complete){
if (bubble_3_complete){
goto continue_story
}}}

goto start_social_game

label continue_story

MAIN
Well, I’ve spoken to everyone, let’s go.

So, this is pretty choppy, and I’ve never actually done this over 2 zones before, but that’ll hopefully give you some ideas. :sweat_smile: You can spice this up as needed (decrease the opacity of the arrows during the scene and increase the opacity just before the scene ends) etc.

2 Likes