Game dev question


#1

Hey guys,

I recently bought a Pokitto and love it. There’s a fun game that I’d love to make for the Pokitto, but since I’m new to the Pokitto and Micro Python in general, I was wondering if you could help answer some questions I have.

I’m interested in using the Online MBED editor found at https://pyinsky.herokuapp.com/ as it makes it easy for me to code wherever I am, however I’m not sure of its limitations…

My questions are:

  1. Do I need to learn Micro Python elsewhere first to know how to use it in this IDE as the IDE has zero documentation from what I can tell…
  2. What/where can I find documentation on how to do things like change the screen mode (in particular) for the Pokitto using the IDE?
  3. What’s the (sd) disc space and ram/memory space for games and how will I know if I run out?

I’m going to look around on Youtube and elsewhere to get more familiar with Micro Python in the meantime, but thought I’d ask these questions above anyway!

For a bit of background, I am an indie game dev on the side and have made several games before on other systems along with a good mate of mine, so I’m pretty familiar on how to build games. I just need guidance on the machine’s limitations really.

Thanks in advance guys!

Regards,
Jaco


#2

In the bottom right if the pyinsky editor there are a few different tabs you can switch to. One of them being ‘help’ with links to
good documentation

There are also some topics here in the forums with amazing documentation and such, and can be found pretty quickly with the search button in the top right.

Welcome to the Pokitto community! Awesome to have more members :slight_smile:


#3

Hi,

Online Python Editor is different from Online MBed environment. The latter is ment for C++ coding. Python Editor is by far the easiest way to make games for Pokitto, but if you know C++, that is much more versatile and powerful. .C++ is the “native” language of Pokitto.

In Python Editor you can select the high resolution screen mode (220x176) from the “Flags” tab in the bottom right window. The RAM size in Pokitto is 36 kb, but for Python games there is less than 20 kb free. You can check the.free memory in Python like this:

import gc 

# Collect all freed memory. 
gc.collect()
# Print free memory amount 
print ("free:",gc.mem_free())

The size of SD depends how big SD you have. Usually many gigabytes. The flash ROM size is 256 kb, but in practise the maximum binary size must be somewhat smaller (because of the loader code)

Did this answer your questions? If you have further questions do not hesitate to throw them here!


#4

Hi guys,

Thanks very much for that info, it’s great!
I plan to start with Micro Python as I’ve been meaning to learn Python for many years now, eventually moving up to C++ I hope.

Hanski, I presume the 20kb free limit is due to the Python runtime taking the rest of the space I imagine and is also the limitation on the real hardware?

I think the code for the game idea I have in mind should fit in 20kb, but not sure. I suspect after this first game, I will look into MBed as the next step. I presume it is this you’re talking about? https://www.mbed.com/en/

Thanks!


#5

I will be patiently waiting for that moment.
(It’s very likely I’ll be one of the ones answering your questions when that time comes.)

As @Hanski said, you don’t need to use the Mbed online compiler for making Python games, it’s only for C++ code.

That said, personally I recommend against using Mbed online for C++ development because it only implements the old C++03 standard.

The other options (mainly Embitz, which is Windows only, and PlatformIO, which is multiplatform but a bit more difficult to set up) support C++11 (and later) standards.

C++11 was a big step forward for the language and many of the added features provide big benefits.
(Not to mention the fact there’s a very long list of them.)
Just something to consider for when you do cross that bridge.

That’s the site, but not quite where the compiler is.
I think you need to create an account before you can access the compiler.


#6

Your code does not have to fit in 20kb. Unlike regular computers, code does not need to loaded into RAM to run, it’s executed directly from flash. Things like code, images and sound effects only take up flash space. RAM is only for storing variables.

As @torbuntu said, the help tab has links to lots of documentation. The IDE also has a bunch of examples that can help you get started.


#7

As far as I understood, Micropython code is compiled to a “regular” binary, so there is no actual Python runtime on the little Pokitto.

However, the RAM is actually limited to 20kb, so you’ll need to do some clever coding if you want to make huge open world game. :wink:

Additionally, the binary file (the .bin file that Pynski offers for download after you press “play”) should not be larger than about 200kb - otherwise it may run in the online editor (and offline emulator) but it won’t fit into the Pokitto’s ROM.


#8

Right, but the program is actually interpreted as Python bytecode which is frozen in ROM by Python Editor. It is possible also to use interactive REPL and give python commands or scripts from the terminal application.


#9

Thanks very much for all this information guys.

The online editor seems to be a great starting point, and seeing assets don’t need to be loaded into RAM as such, I think my game should fit in the space available both in binary size and ram size.
Now it’s just getting more familiar with Micro Python.

I’m going on holiday for 2 weeks, so will use that time to get more familiar with the language.
I’m keen to get proper familiar with Python as I want to make games both for the Raspberry Pi and Clockwork Pi in addition to the Pokitto, so it’ll make life easier for the various platforms to have a very similar or same code-base so I don’t spend forever re-coding stuff too much.

Will start a new thread with my game once I have something up and running!

Regards,
Jaco


#10

Here are plenty of examples made for the Python GameJam we had some time ago.