[Game]Pokittobloids

micropython
puzzle
release
game

#61

You’re confusing the emulator with the simulator.
The emulator runs bin files, just like a real Pokitto. If you put a file.bin in the same folder as the PokittoEmu.exe, it will run that by default.

The simulator is actually a way of compiling your game in a way that is compatible with your PC. You’ll need to convert your python source into mpy files, then compile it all into an exe.


#62

If you put the sources available, I could check what the problem is.


#63

Do you mean that the font is still the same? That is weird. Did you try to rebuild everything?


#64

@Hanski Unsure how to rebuild or what to rebuild. Are you saying I should download the Micrpython github repo and build that? Again this is all new to me so I’m not sure.

@FManga Thanks for clarifying. All I want is to run my game with the emulator (simulator - I didn’t know they weren’t the same thing).It does not work as you say. All I get is a blank screen:


#65

Try this, then: PokittoBloids.zip (1.6 MB)


#66

Thanks @FManga - I have questions:

  1. That worked! Even the font was right. Why did it work?
  2. The audio doesn’t work. Tried putting the audio files in the root folder there and in subfolder as on the real h/w and it still won’t play music or sfx.
  3. What did you do to get it to run? Different exe?

#67

That’s the emulator, same as the one in the online IDE, except compiled as an EXE instead. It has all the same behaviour as the online one: font looks the same, audio still not supported.
I had to make a little change to the exe so it would run without an SD card, that’s what was making it freeze for you before.


#68

Ah thanks mate. So no audio as of yet but at least it runs now. It did highlight an issue to me where the game is too fast on the emulator, so I should probably implement delta timing…


#69

Unless you’ve got a really fast PC, the online emulator is a lot slower than hardware. The EXE is much more accurate.


#70

Thanks for helping guys. I’ve updated the first post with the updated Pokitto .zip and the Windows emulation version.

Re framerate, I wasn’t sure how to implement a timer on the Online IDE, so instead used some simple code to
use the wait() method to “set” the framerate slightly faster on the Pokitto version and slightly slower on emulation.


#71

Updated the emulator: PokittoBloids.zip (1.6 MB)


#72

Works perfectly! Good job @FManga and @jvdw007!


#73

@FManga - mate! Thanks so much! We now have audio in the emulator!! Saying that, mine is very choppy/stuttery, ie the sounds. Does anyone else have that issue? I tested it with a mate of mine and he’s reporting the same thing…

I also see that F2 gives you a png screenshot and F3 seems to start recording a gif, but do you stop it with F4 or F5? When I hit F5 it crashes with a lot of write to flash errors.

Thanks for this. I really do appreciate it. :slight_smile:


#74

Sorry about that, it’s mainly because I’m really bad at audio-related code. If the emulator isn’t running at full speed, it’s going to chop a lot. If it is at full speed, it’s going to chop less. :stuck_out_tongue:

F3 toggles the recording, so just press it again for it to stop. F5 was for debugging and probably doesn’t make sense anymore. I should probably remove it.


#75

Thanks mate. I’m amused though, as I run a core i5 CPU, 16gb ram and a gtx 1070. Didn’t think the emulator would run slow on my hardware hehe.

I wonder if frameskips would be possible to code in?
Anyway I’d rather you spend your time better on the femto IDE with python so I can use it!!! :slight_smile:


#76

Emulating a gamesconsole based on a microcontroller is surprisingly hard for a normal computer. Other than the actual clockspeed, PCs are faster because they have lots of hardware specifically for doing certain tasks like rendering video and playing audio.

In the case of audio, the CPU gives your soundcard 4kbytes of data at once, then forgets about it until its time to get another chunk.
The Pokitto, on the other hand, outputs sound one bit at a time. The emulator receives that data bit-by-bit and has to try to assemble a buffer that your soundcard can be happy with.
If the bits don’t arrive fast enough, you get a skip.

In the mean time, your videocard is just sitting there, thinking why’s the CPU doing my job? Same situation: 619520 bits of image data, every frame, and the emulator can’t use the PC’s extra hardware at all.

Since all the emulator sees is bits coming in, its impossible to do things like frameskip and it wouldn’t help much anyway.


#77

How would it sound if you just duplicate the latest sample if the new value does not come in time? I suppose it is not more than two times slower, so you would need max 2 identical samples. Maybe it sounds a bit like there was a DJ doing beatmatching :wink:


#78

It wouldn’t, you’d get silence. Samples describe a wave and if you have duplicated samples the result is a flat line.
Supposing it were two times slower, that doesn’t mean you have every other sample, it means you only have the first half of the 4kB buffer. I could duplicate the entire first half of the buffer in the second half, but that sounds pretty bad too.

The thing I’m planning on doing first is pausing the sound when the buffer gets empty, then resuming once it’s full. That way you’ll get one slightly longer pause and, hopefully, the buffer won’t get empty again.


#79

Would it just make the pitch lower? Think about a sine wave, instead of a 10 kHz sine wave you get 5 kHz if you duplicate each 8-bit sample. You can average the in-between samples to get a smoother wave.


#80

I can give it a shot, but our ears are really good at picking up any attempts to cover up flaws.