Log In  

Hi everyone,

As exams get closer, for some reason I started getting interested in Pico-8 again (terrible timing), but as a total beginner to programming im not to sure where to start, even when I follow tutorials online I find myself understanding the code (at least how it applies to the rest of the program), but I never manage to really retain the information, sadly looking at source code only gets me so far, understanding a little but not a lot.

There seems to be a huge gap between knowing how to make a breakout clone, and being able to knowing enough tools to make your own game no matter how simple (within the limits of pico 8). That being said, im incredibly glad that there is such an enthusiastic community who is willing to make videos and fanzines that will teach new people how to use pico 8. Another issue is that as soon as I try to deviate from the tutorial I run into issues that I cannot seem to solve, and due to the nature of online teaching it's very difficult to get advice.

As a result I decided that to help me understand how to program I should really get to grips with the syntax. To do this ive set up a long question sheet which looks at the Pico-8 manual, and asks questions on the various parts. Then I use the internet and other resources to find the answers.

I've found it very useful, and I thought I might post it here for other beginners to use, I try to cover as much as possible with the questions, but most are very basic.

If you have any suggestions or amendments, or want to contribute to the more difficult questions, pleasure feel free to edit the list accordingly. I understand that the list doesnt teach you how to actually program and think likea computer, but I hope it goes some way to helping people know what the tools they have at their disposal.

  1. What are the three key functions?
  2. What do they do?
  3. What are the buttons in numbers?
  4. What is a function?
  5. What is a type and assignment?
  6. What is a number?
  7. What is a string?
  8. What is a Boolean?
  9. What is a table?
  10. What is an array?
  11. What is a string?
  12. What is a conditional in code.
    a. What is the syntax?
  13. What is a loop?
    a. What is the syntax?
  14. What is a local variable?
  15. How is it used in a function?
  16. What is indexing in programming?
  17. What do they mean by 1-based indexing?
  18. What notation can we use for an index that is a string?
  19. What are the unary math operators?
    a. What are these in code?
  20. What is clipping?
    a. What is the code for setting clipping in pico 8.
  21. What code do I use to get or set the colour of a pixel at x and y.
  22. What is the code I use to get or set the colour of a sprite sheet pixel?
    a. What is a spritesheet?
  23. What code do I use to get or set the value of a sprites flag?
    a. What is a sprite flag.
    b. What is the value (v) of a sprite flag?
    c. What is the initial state of flags 0/7
    d. What is the meaning of a sprite flag?
    e. What is a bitfield?
  24. How would you print a string?
  25. How would you set the cursor position and carriage return margin in code?
    a. What is a carriage return margin?
  26. How would you set the default colour to be used by drawing functions?
    a. What is drawing functions?
  27. What does cls[col]?
  28. How do we set a screen offset of -x,-y for all drawing operations Camera() to reset.
    a. What is a screen offset?
    b. What is a drawing operation?
  29. What is the syntax used to draw a circle?
  30. What is the syntax used to draw a rectangle?
  31. Explain what is meant by “Draw all instances of colour c0 as c1 in subsequent draw calls”.
  32. What are the two types of pallet, and why might we use them?
    a. What is the syntax used here?
  33. How do we set transparency for a certain colour on the screen (to make sure that a certain coloured pixel doesn’t show).
    a. What is the syntax used to show this?
  34. How would be draw a sprite n at a position in syntax.
    a. How might we flip this sprite on the X and Y axis?
    b. What is the width and height by default?
  35. How would be stretch the rectangle from a sprite sheet.
    a. What is meant by this?
  36. How might we fill a patter of 4x4 2 colour tiled pattern?
    a. What shapes use this?
    b. How can we determine what fill pattern is used?
  37. What is a table?
    a. How do we add a value to the end of a table?
    b. What is the syntax used to create an empty table?
  38. How do we delete the first instance of a value in a table.
    a. What is the syntax used to do this?
  39. What syntax is used to iterate over all items in a table in the order they were added?
    a. Can you give an example of how this would look?
  40. What does the syntax foreach t f do?
  41. How would we check if only a button is pressed, rather than held down.
    a. What might we do this?
  42. How do we play SFX on a certain channel?
    a. How do we stop a sound on that channel.
    b. How do we stop a sound on that channel from looping?
    c. How do we automatically choose a channel that is not being used?
    d. How do we stop the sound from playing on any channel?
  43. How do we start playing music from pattern n.
    a. How do we stop the music.
    b. How do we specify which channels reserve certain music?
  44. What is the grid for the Pico-8 map?
  45. What syntax is used to get or set a map value (v) at x,y.
    a. What is the difference between “get” and “set”.
    b. What is the exception of sprite 0?
    c. Give an example in syntax and explain it.
    d. What are the defaults in cel_w and cel_h are not specified?
  46. How do we return the maximum, minimum, or middle value of a paramenter?
  47. What is in integer?
  48. How do we use flr x and ceil x?
    a. Give some syntax examples.
  49. How do we return the square root of a number?
  50. What is the absolute positive value of a number?
    a. How do we find this in syntax?
  51. How do we return a random number.
    a. How would we make this an integer?
  52. How do we set the random number seed?
  53. How do we add an extra item to the pause menu?
  54. How do we print the length of a string?
  55. How do we join a string?
  56. How do we grab substrings?
    a. What are substrings?
    b. What is grabbing a substring?
  57. How do you return the name of the type of value x as a string?
    a. Why would you do this?
  58. How do you convert a value to a number?
    a. What happens if the value is a string?
    b. What if the conversion fails?
  59. How do you create a save state?

Thanks

P#52531 2018-05-08 11:32 ( Edited 2018-05-24 04:35)

Interesting list but that’s not really how you learn how to program.
Call me old school but copy/pasting bits of code is not how you truly understand what’s going on.
As if you were playing Lego with pre-made chunks of blocks!

My advice for newbie programmers:
Get a good grasp of what is an imperative/functional language, got to know types, algorithms and data structures.
(of course, that can be done with some fun, like make a game but it is going to take time, no matter what).

At this point, every language just looks the same.
Read the doc of the framework you are working on, things will just click (ex: no need to be told how to save state once you know what dset/dget are doing).

My large 2 cents - over ;)

P#52533 2018-05-08 13:16 ( Edited 2018-05-08 17:16)

It's been a while since I've learned how to program and, at this point, it's hard to deconstruct from what I know how I would teach programming to someone else.

Understanding the concepts on your list is certainly helpful and necessary.

When it comes to actually writing a program, there are larger building blocks that programmers use in order to solve problems. These are commonly called data structures and algorithms.

A data structure is just a specific way to store data in such a way that lends itself well for certain applications. Many data structures have real-world counterparts.

For example:

  • A queue is a 1-dimensional array where entries are added at the back and removed from the front. Lines we wait in are queues.
  • A stack is a 1-dimensional array where entries are added on the top and removed from the top. A stack of plates is the general example here as they are added to and removed from the top.

An algorithm is a repeatable sequence of steps we perform with data structures. Any computer program with logic is executing an algorithm to accomplish things. There are many common and basic algorithms which programmers use to accomplish tasks.

Data structures and algorithms are not specific to any particular programming language.

In Lua, the basic data structure is the Table. Using a table, you can simulate most other data structures with some accompanying code.

There are tons of resources online to teach these concepts. Some examples:

https://www.geeksforgeeks.org/data-structures/
https://www.geeksforgeeks.org/fundamentals-of-algorithms/

In terms of game development, you can get pretty far with just a little knowledge but most likely you'd be accomplishing things using a sub-optimal approach. That's fine. As you go, you'll learn and hopefully recognize superior algorithms to accomplish what you want.

Programming is super fun and I feel like Pico-8 has the potential to be a great tool to teach it. Unfortunately, it kind of sucks to debug problems in Pico-8. Runtime errors are frequently obtuse and syntax errors can be hard to find as the reported problem line can frequently be far away from the actual issue.

In terms of learning how to program, I would personally start with a language with a really good IDE (a program in which to write code) which makes syntax (and runtime) mistakes really obvious. TypeScript is one option as it has really good tooling (see Visual Studio Code). It's sort of similar to Lua except it has a lot of syntax to help you define the type of objects. You could use TypeScript like Lua and have no typing but then you'd lose a lot of the utility of TypeScript. Java is not a horrible option as IDEs do a good job in making sure you're doing things correctly. That language is heavily object oriented though and forces you to use paradigms very different from typical Pico-8 code. Python is a little closer to Lua though I'm not aware of any really great IDEs.

Anyways, good luck on your programming journey! It's a fun skill to have :)

P#52538 2018-05-08 15:27 ( Edited 2018-05-08 19:34)

Thanks alot for both of your extensive replies :)

Its something i've always wanted to do but ive always started off well before running into an information overload from expecting too much too soon. Luckily the general enthusiasm of programmers keeps me wanting to get back into it.

I'll definately check out the links you sent me, and once my exams are over I will be finally getting myself to read through the "how to think like a programmer book" and really get to grips with the central ideas before jumping head-first into learning a language again.

Thanks again :)

P#52545 2018-05-08 18:56 ( Edited 2018-05-08 22:56)

When I first started on Pico 8 I made a bunch of wee carts to try out each feature. So I made a cart where button inputs changed a sprite on screen. Then I made a cart where button inputs moved a sprite around on the screen. Then I made a cart where I loaded up map data to the screen. Then I made a cart where I could have one sprite collide with another sprite. Then I made a cart where I would have a sprite collide with a map flag.
My advise is give yourself tiny little exercise so you get used to some of the ropes and then later down the line you will have some reference material of your own when your trying to remember something.
If you don't know how to do something, make a cart that does just that one thing.

Resource wise, Id suggest going through the manual again and making a cart for each feature you think sounds interesting. If you get stuck on something the wiki is great for explaining each function in isolation so just Google "Pico 8 [function name]" and it's always been the first result. Then once you're happy with the chunks of the manual you found interesting you could Google Pico 8 cheat sheet to see what other functions are out there and again check the ones that look interesting on the wiki and make a cart for them.

Once you do that for a while it'll build up your confidence and you'll start getting ideas you have some idea how to execute :D

P#52550 2018-05-09 02:34 ( Edited 2018-05-09 06:52)

@Davbo great suggestion!

I do the same thing. I find when I'm ready to add a new mechanic to a game, it's intimidating to read back over your code and decide where the feature belongs. If you started your game code in pristine condition and accounted for the vast majority of problems, then you can probably throw a feature in willy nilly (and increase your token count since you'd do it naively). I much prefer the "lab" approach.

It's really great to be able to pare a gameplay mechanic down to the bare essentials needed to execute it, then compare side-by-side with existing game code to see how I can factor it in. It feels like I have a better understanding of what I'm doing, what I'm making, and it's teaching me a lot about refactoring, which is an important part of software development. In fact it's probably more relevant for PICO-8 programming since there are technical budget limitations to account for. :)

It's awesome to read about another person with a similar approach.

P#52977 2018-05-24 00:35 ( Edited 2018-05-24 04:35)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 13:05:38 | 0.032s | Q:27