Log In  

Cart #operation_pico_v1_2-0 | 2023-02-23 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
17


Video of the gameplay

Version Update

Version 1.2

  • Improved Gameplay

Version 1.1

  • New Label
  • Improved Gameplay
  • Change of Controls
  • Improved Graphics
  • New End of Game
  • Improved code

Thanks to Freds72 and Heracleum for all the great suggestions.

Background of Operation Pico

Operation Pico is based on an old favourite of mine, Operation Wolf first released in 1987. I enjoyed playing it at my local arcades and on my ZX Spectrum 128k with the best of gameplay on my great Commodore Amiga 500.

In Operation Pico there are six stages and 3 levels of gameplay to sink your teeth into.

Controls

Use the cursor keys to navigate the menu. ( X or left mouse button to select start )

Select (Normal / Hard / Insane) for the game play intensity.

Select mouse or keyboard ( cursor keys ) to move the crosshair.

Left mouse button = Shoot
Right Mouse button = Grenade

OR

Z = Shoot
X = Grenade

Rules

The object of the game is to rescue as many hostages as you can without getting killed. Use all your ammunition you have to kill the soldiers, tanks, helicopters, birds and chickens but try to avoid the hostages. Sometimes you might get extra ammo, free bullets, grenades or TNT if you shoot a bird or chicken.

Behind the scenes

I had a lot of fun coding Operation Pico. I think it captures the Operation Wolf gameplay in somewhat of a small form factor. I made a timer function that helped a lot with the animation of the entities. I will release a full version of the timer function soon. I ran out of Tokens so the game is not as I wanted, particularly at the end of the game. I have not coded for a long time so please forgive the messy code and lack of comments.

A side note : There still may be many bugs, please let me know when you find one. Also a big thank you to Youtube's Lazy Devs for the great videos on Pico-8.

Many thanks.

Have fun playing.

Antony

P#124218 2023-01-13 15:29 ( Edited 2023-02-23 17:11)

1

Excellent - one of my fav Amiga game!

Couple of remarks:

  • show mouse cursor in menu
  • level selection takes ages to skip
  • mouse buttons are not working
  • ground color tone could possibly be more brown than sand? (to make enemies stand out more clearly?)
  • death warning tone is perhaps to early (can last several minutes)
  • game title may be a bit "bland": Operation Wolpi? (Jelpi :) or something less 100% pico
  • add a label (you've got good art)
P#124230 2023-01-13 17:49 ( Edited 2023-01-13 17:50)

Thanks for your comments.

I will take your comments onboard. I ran out of tokens so without a complete overhaul of the code this might be a bit tricky. But will try something. It was my first time coding with Pico-8 found it a nice experience. Thanks again

P#124233 2023-01-13 18:06
1

understood - though you have many options to reduce token usage:

  • most of the tostr() calls are useless (pico automatically converts numbers to string)
  • use more local variables to remove duplicate access to tables values
    ex:
local x,y=panel_placment["x"],panel_placment["y"]
rectfill(x,y,x+117,y+20,3)
spr(64,x+40,y-32,4,4)
  • panel_placment["x"] is equivalent to panel_placment.x (1 less token)
  • remove duplicate code!
    ex:
sprite_split = split(entitie.anim_1["frame_" .. tostr(entitie.anim_1_frame)],"_")
-- store direction test
local is_flipped = entitie.move_direction == 0
-- reuse to flip sprite
spr(sprite_split[1],entitie.x,entitie.y,sprite_split[4],sprite_split[5],is_flipped,false)
-- reuse to set talking location
hostage_talking_location    = is_flipped and 0 or 12
  • and many more you will learn with experience and reading other's cart code!
P#124236 2023-01-13 18:35 ( Edited 2023-01-13 18:36)
1

I agree, first of all on the game experience being nicely recreated and good graphics 👍.

But yes I scrolled the code and there's a lot of tokens you can save in different ways and places.
At a glance, one of the top token-killer is the 'draw' section in _stage_helper: around 500 tokens 👀 that could be brought down to 60 or less, because you're basically repeating SIX times the same code with different numbers (units and coordinates). For instance having a single function rendering a single stage info-card in a box at x,y and making the coordinates relative using camera(-x,-y) even better if you had 'stage' objects (tables) with their properties.

Also even very quick habits or tricks to gain a few tokens per line (but it could make a remarkable total gain of tokens overall), a few examples:

  • no need to check if var == true on booleans if var is good enough (and common practice in all languages);
  • same for false instead of if var == false use if not var;
  • again on booleans, once you've removed all instances of direct boolean value checking (as above) you can even avoid having a return false at the end of a function, since if you don't return anything it will return NIL (which is a 'falsey' value); when you invoke that function e.g. has_value() if it returns NIL in your code it'll be if has_value() then it will work as false;
  • invoking any function that takes a single string as argument doesn't require parentheses (-1 token) and you have a lot of them, e.g. _menu("init") to _menu"init"

Also I see a lot of single prints, you can save a lot of tokens moving the cursor in the same printed string (and do other wonders using p8scii and control codes, worth the read on manual/wiki)

P#124258 2023-01-14 00:13 ( Edited 2023-01-14 00:19)

Hi,
Thanks for the time you both put in to write your answers. You have made me think, I will do as you have suggested. Never thought about how you said do draw in the stage_helper.

With the above suggestions I can do a good ending ;-)

Thanks to you both. ( Freds72 and Heracleum )

Will do above suggestions soon.

P#124289 2023-01-14 13:15 ( Edited 2023-01-14 13:54)

Busy doing your suggestions, Freds72 can you explain about "add a label", I have one on the pico-8 cart, is there another one? Done the mouse keys and death tone. Next to get the code as you both said.

Should I rename it the game? Operation Pico / Operation Wolp. Have you any suggestions on this. If I do can I rename it in this post?

P#124293 2023-01-14 14:25

a label image can be anything- not only a screenshot of the game
suggestion was to take something like the Operation Wolf box art to have a more catchy thumbnail

As for the name, your call (Operation Wolp is interresting!)

P#124295 2023-01-14 15:14

Got it thanks, will do ;-)

P#124296 2023-01-14 15:48

Heracleum, can you explain about :

"Also I see a lot of single prints, you can save a lot of tokens moving the cursor in the same printed string"

Thanks

P#124299 2023-01-14 17:27

Just to ask how can I print the score and high score as 0000 not 0, so a score of 10 would look like 0010.

Thanks

Antony

P#124302 2023-01-14 18:39

convert score to string (tostr is useful here!) and take the required number of characters from a "pattern" string: "000000"

P#124308 2023-01-14 20:14

bug on level 2? - a chopper keeps appearing every other second!

P#126219 2023-02-23 22:39

OK Will Fix Soon, Just looked yep I need to fix the x position of the Helicopter, it keeps in the same place not a random place.

P#126438 2023-02-28 21:01 ( Edited 2023-02-28 21:05)

not easy
ill give you that

P#128910 2023-04-23 03:38

[Please log in to post a comment]