flashjaysan
Posts: 5
Joined: Fri Dec 21, 2018 5:08 pm

Questions about programmable handheld console

Fri Dec 21, 2018 5:36 pm

Hello everyone!
Do you know the french project Gamebuino? It's a programmable handheld console based around an Arduino.
Though the concept is awesome, it lacks some serious horsepower having only 32KB of RAM, some slow CPU and limited library.
However, the device is well designed and the quality of its building is awesome. Its resolution is really low for my taste and it misses more buttons but overall it's wonderful.
I'm currently using a Raspberry Pi 3 with the game library raylib (that uses openGL behind the scene) and it works like a charm. It's very powerful yet remains simple to use for beginners.
So I was wondering if using a Raspberry pi (zero probably for its reduced size) would be a good choice for building a project like the Gamebuino but more powerful.
Most of the handheld built upon pis are for emulation but I'm pretty certain that it could be used for developing games on them too.
There are many open consoles projects : raspy boy, minty pi, gameboy zero, gameboy null, freeplay zero, gamepi, pigrll ...
All thoses projects seems to cost around 100$/€ per device. Could that cost be reduced while maintaining a good quality and how would that be?
Finally, do you have any advice on that project and are there already people who work on that kind of project?
Thanks to all who read this!

Guntha
Posts: 4
Joined: Tue Dec 25, 2018 9:43 pm

Re: Questions about programmable handheld console

Tue Dec 25, 2018 10:33 pm

Hello flashjaysan,

I too would be interested in building a handheld Raspberry Pi that isn't completely dedicated to emulation. Being a professional game developer, it makes me sad to see so much horsepower and cases people put a lot on work into only to be locked in older games.

Software-wise, what I would like is build a lighter os that would only take a few seconds to boot before you're able to run a game.

The most extreme project, which had been announced in Handmade Hero (not sure it will ever be made), would be to build an os around a single game.

Form-factor-wise, I would be more interested in the "handheld linux terminal" by NODE:
https://www.youtube.com/watch?v=aZc5gUK ... s&index=13

Currently, I'm more a software guy, and I joined the Raspberry crowd only recently, so I wouldn't be able to tackle such a project immediately, but I would love to try it in the future.

I've never used raylib, but it sounds like a good choice :)

PhatFil
Posts: 1197
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Questions about programmable handheld console

Tue Dec 25, 2018 11:05 pm

for a dual use portable solution for playing games And providing a programming tool.

I would suggest building the best game solution you can, the hand feel and game button positions would need to take precedence in the build to make the project useful, a game pad with awkward to use controls would not get played much..

then to provide the programming interface buy a nice wireless portable keyboard and perhaps mouse, and source an 'old' kindle paperwhite and emulate this project.
https://maxogden.com/kindleberry-wireless.html
to provide a wireless keyboard and screen interface to the cli requiering No physical mods to your gamepad. (beyond the accommodation of the keyboard mouse usb dongle)

flashjaysan
Posts: 5
Joined: Fri Dec 21, 2018 5:08 pm

Re: Questions about programmable handheld console

Thu Dec 27, 2018 2:48 pm

Thank you for your replies!
The idea of a lightweight OS with minimal functionnalities would appeal to me but I'm wondering if others would rather choose a more conventional approach instead for development (like raspbian with a desktop code editor). The concept of a one game OS is not something I'd consider though because I think it would be more useful to have an OS that allows to boot multiple games we might develop. After all, not everyone is working on a single project at a time.
The Gamebuino Meta needs a computer to compile the sources then the games need to be transfered to be tested or played. This is cumbersome. At the time of writing this, there is no useful emulator to test the games outside the console itself. Since the transfer takes time, it is not very convenient. If we could develop on the same device it is meant to be played on, it would improve rapid iterations testing. However, I assume most people would rather develop on a desktop computer much more powerful then transfer the final game on the raspberry.
The main problem with this approach is managing the inputs. I assume inputs would be via GPIO pins so if we develop on another device we'd need to simulate those inputs as the handheld would do it.
I'm not really interested about an embedded portable keyboard though because it would hinder the compactness of the device. Also, using a small keyboard would not be really pactical on the long run. I'd rather go with a classic approach : a handheld console with a directional cross and some buttons (2 seems a little too little, I'd say at least 6). Since the raspberry pi zero exists as a version W which allows to connect to wifi, there is no need for any cable. For mouse/keyboard used for development, the USB port could easily be used with wireless devices.
There are also some choices to make about the parts that would be used for that project. For the screen, what size would you choose? Resolution? Touchscreen or not? GPIO/HDMI/DSI (not on a pi zero)? Any shops where to look for cheap but quality products? I haven't found any screen without a large circuit board. Any idea?
Would you rather put a DPad or a analog stick? Buttons like an arcade stick or more like a gamepad (with shoulder buttons)? I'd choose DPad with arcade stick buttons configuration for simplicity but maybe this is a mistake...
There needs to be at least one speaker, a power button, and a battery... So are there other parts missing? I read that we need a control voltage part to regulate the power of the battery. Any advice on that?
Maybe all those compromises aren't realistic. Can the project still be cheap?
What do you think about it? I'd love to ear other points of view on those ideas.

hippy
Posts: 5164
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Questions about programmable handheld console

Thu Dec 27, 2018 7:22 pm

flashjaysan wrote:
Thu Dec 27, 2018 2:48 pm
If we could develop on the same device it is meant to be played on, it would improve rapid iterations testing. However, I assume most people would rather develop on a desktop computer much more powerful then transfer the final game on the raspberry.
The main reason people prefer to develop on a PC rather than a handheld is that a handheld screen is often simply too small to be productive with.

One solution there would be to have the handheld dual use; a full HDMI monitor environment for development and a smaller screen for game play.
flashjaysan wrote:
Thu Dec 27, 2018 2:48 pm
The main problem with this approach is managing the inputs. I assume inputs would be via GPIO pins so if we develop on another device we'd need to simulate those inputs as the handheld would do it.
If developing on a separate PC to the handheld itself it should be easy enough to download some program into the handheld which can report button pushes on the handheld back to the PC which is emulating a game under development. It should even be possible to send the PC's emulation screen to the handheld screen. Perhaps not at full FPS rates but enough to get a good feel for how it will look on the actual handheld.

The handheld effectively becomes a control terminal and display for the emulator. Once a game iteration is complete, just download it to the handheld and it should run just as it did under emulation.

Emulation doesn't have to be true emulation as such. If using a Pi as the PC and a Pi in the handheld you can run the same game code on either. Just that the PC puts its display up in a window on the HDMI screen rather than a connected physical LCD.
flashjaysan wrote:
Thu Dec 27, 2018 2:48 pm
Can the project still be cheap?
I would doubt it. But what is "cheap" is subjective.

What target cost would you want to aim at ?

User avatar
Imperf3kt
Posts: 2238
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: Questions about programmable handheld console

Fri Dec 28, 2018 12:06 am

What sort of games do you want to play/make? The Pi Zero is rather weak compared to other computers.
I'd personally suggest you try using a Pi2b for this.
(I've built this sort of thing for exactly this purpose, but I used a modified Pi3b to do it and am still trying to sort out some minor power troubles I've been fighting for over a year)
Google is ubiquitous - Try it today, it's free!
https://opensource.com/life/16/10/how-ask-technical-questions

Guntha
Posts: 4
Joined: Tue Dec 25, 2018 9:43 pm

Re: Questions about programmable handheld console

Fri Dec 28, 2018 1:54 am

@flashjaysan: When I was mentioning NODE's device, I was thinking more of the foldable, DS-like format than the embedded keyboard. I was thinking of doing pretty much the same thing, but with a gamepad instead of the keyboard. I would like to know if it's possible to put at least one stick as a pressure pad, like the right stick of the "New 3DS" (it seems a lot of people dislike it, but I like it, and it means less moving parts).

I remember finding a screen without a large PCB on the back a while ago on Adafruit, I think it was this one? https://www.adafruit.com/product/2109
And if it's not, I think a 5" 800x480 is a pretty good resolution/size ratio for a handheld screen (It's close to the Vita)

For the OS, I admit I didn't know about Buildroot, and it seems to work pretty well: https://www.youtube.com/watch?v=4Fjfqz6FxC8
Personally, I'm used to develop games mainly on desktop, and test them on the target device only when necessary.
Last time I worked using a commercial game console, the most common process was to compile the executable on desktop, have it automatically sent to the device through LAN network by the IDE, and when launched, the game would read the game data, which was still on the desktop machine, through LAN. And debugging with the IDE was possible with this process, which made the whole development painless.
I believe doing a similar thing would be a whole project in itself...

@Imperf3kt: Correct me if I'm wrong, but I believe the focus on emulation has skewed our views on what a Pi is capable of, even a Pi zero. In my opinion, if you can make environments as intricate as the first Quake (runs on a single core Pentium, < 500Mhz, and there was a software rendered version) or systems as complicated as Roller Coaster Tycoon (which I used to play hours and hours on a 233Mhz Cyrix 2 with no GPU), you can make any game entertaining enough for a handheld device.
And I don't mention the GTA games on the PSP, because their development teams were much bigger than those of the first 2 games I mentioned, so we don't know how much time and budget they had to extract every bit of power of the 333Mhz CPU and 32MB of RAM of this small device (all while not draining the battery too much, given the fact the game data was read from an optical disc :p )
Also, since the resolution of most handheld screens we can find doesn't go higher than 800 pixels wide (and we don't really need more than that), that's a little bit of power saved.
And with the release of the Pi3A+, you can get pretty much the power of a Pi3 on a board smaller than any Pi2 :)

I would be pretty happy to play this on a handheld (and this was on the Pi 1).

tucker
Posts: 5
Joined: Sun Mar 10, 2013 8:35 pm

Re: Questions about programmable handheld console

Sat Dec 29, 2018 5:00 pm

Handhelds and small consoles are a bit of thing I fiddle with. I like the software and hardware. I tend to like minimal OS and bare metal and a simpler hardware layer. I have used PI Zero for a few and it is great - super powerful when connected to small screens.

I have several Makerbuino which are based on Gamebuino. Work well and good for a bit of fun.

Also have several ODroid Go which are based on ESP32 and add useful case, lipo battery, 2.4 320x240 screen and decent library and “OS” support. Very handy ESP32 processors which is powerful, decent flash capacity and decent SRAM. Surprising powerful and very easy to program.

I also like the various virtual consoles such as Pico-8 and have had a bit of fun moving some of these onto various boards and displays plus tweaking for my own use. Pico-8 on a PI0 is a nice combination and easy to develop on desktop and run on handheld.

flashjaysan
Posts: 5
Joined: Fri Dec 21, 2018 5:08 pm

Re: Questions about programmable handheld console

Thu Jan 03, 2019 5:02 pm

All your comments are very interesting! Thank you all!

The most sensible question is this : is the Pi zero powerful enough to be used as a programmable handheld game console? Are there some things that we should be aware of before beginning this project? Can it run at 60 FPS 2D games? 3D games? Does it even make sense to ask this question (do small displays support that frequency)? I suppose (naively) that it depends on the end resolution too... Am I right? As of the sound, does playing sounds would impact the performance of the rest of the game?
I've not received my Pi zero yet so I can't start experimenting on this but if you have some feedback, i'm all ears!

As of the features of the device I plan to make, I think I'd stay with something like a gameboy micro (the latest less known Nintendo game boy advance model) with some modifications. If I wanted to take the 3D road, an analog stick would be nearly mandatory but for plain old 2D games (my main target) a directional cross would be enough I think. Also, I want more buttons than the Gamebuino Meta or the GB Micro so I'd go with 8 buttons (2 shoulder ones, 4 main ones and 2 for start/select (are those later really necessary?).

I think we should stay with what already exists (DIY handheld projects for emulation) and then alter them to our needs (developing games).
So as of now, I'm planning to build somethink like this :
https://www.threedprintspace.com/introduction/
or this one (I prefer the former layout though) :
https://www.raspberrypi.org/blog/game-boy-zero/
Those project are almost perfect to my needs but they are not cheap. I think it is inevitable : a project like this will be expensive...
By almost I mean that I have no idea what OS I'll use on it. Surely Raspbian to begin with but maybe something much smaller like tinycore or other.

For its ease of use, I plan to use raylib, and this lib along with graphics and sounds manages keyboard, mouse and gamepads, but I'm not sure how to manage GPIO specific data coming from the input.

@hippy: Based on your comments, it seems a bad idea to use the final device screen as a development station. Since my target product would have a small resolution, it wouldn't be pleasing to code on it. Maybe it should only be used as a test/playing device and the development should be made on a desktop Pi. Or we could use a secondary screen to develop and use the embedded one only to playtest games but can we switch form one screen to another easily? I don't know... Or at least is it possible to duplicate the video output to GPIO embedded screen and to HDMI output (for a bigger screen)? I heard that it was really slowing things down. Or maybe use a button command to switch between the two at startup? I haven't really understood what you had in mind about emulating the pi on a PC. Are you refering to SSH distant control? All you suggested is nice but can it really be done? I have no idea how to make an emulator that would push the display on the device from a development computer.

@PhatFil: For the wireless keyboard, I think people should have the choice to use a wireless or a USB one if they want. After all, we don't know what gear people own. So I think we should keep the micro USB port available.

@Guntha : As of the idea of an OS that automatically launches a game, I'm not sure it's wise. Even if the concept of a one game per MicroSD is appealing to a 16 bit cartridge console nostalgic I think the OS should allow users to choose a game to launch from a list of many ones. And that would remove the development aspect from the device altogether.
Since you're already a professional game developer, maybe you'd like a bigger resolution or other controls. What would be best for you?
Thanks for reminding me of Handmade Hero, I planned to follow his playlist and forgot about it...
OK, so you want a folded handeld console. Something like the PSP Go maybe? Since I'm not that good with building things, I'd stay with a simple flat design and I wouldn't try to make a sliding case or even a 2-parts foldable one (like the Nintendo DS).
Buildroot seems great but do you know if it supports openGL (the main base of raylib)?

@Imperf3kt: I plan to roughly make 16/32 bits era 2D games. So, no 3D but rich sprites and effects are a must. The Gamebuino allow for 8 bits era 2D games and that is not to my taste. It seems the Pi zero would be a good candidate, don't you think? So, as you can see, I don't need a big display. However, even if I'm not into 3D, I'd like to use the capabilities of openGL (and the GPU of the Pi) to play with shaders, or cameras. Effects like the SNES Mode7 (zooms, distortions, rotations, or affine transforms) would be the best but we shouldn't be able to do it at the expense of the frame rate. Does the Pi Zero could handle that easily?

@tucker: from what I saw of all those devices, they all support 8 bits era kind of games (very few colors, low resolution, low memory, poor sounds). I'm more into 16-32 bits era. I want more colors, visual effects like SNES, and CD quality playback. Can the pi zero handle it with its massive RAM (compared to others) and powerful CPU?

Thanks again for all your replies. It helps me narrow my needs and understand better constraints of a project like this.

Guntha
Posts: 4
Joined: Tue Dec 25, 2018 9:43 pm

Re: Questions about programmable handheld console

Sat Jan 05, 2019 6:36 pm

Hello,

@flashjaysan: I'm not sure I can find where I mentioned "an OS that automatically launches a game". All I'm talking about is minimizing the time between powering-up the device and giving control to the user.

For the screen: taking the PS Vita specs as reference:
https://www.playstation.com/en-us/explo ... tem-specs/
I think a resolution of 800x480 (which is the "high definition" we find the most in shops for small-sized screen) should be enough for every need, for a screen up to 5". I think anywhere between 3.5" and 5" is a good size of a handheld console screen.
Beware: I've seen screens that display 18-bit colors instead of 24-bit. It might not be a problem depending on the game (after all, many games from the late 90s-early 2000s displayed 16-bit colors to save some VRAM), but it's something to keep in mind. Using it as an incentive to use fewer-color textures, and therefore save some VRAM, might be a good idea actually :) Aiming for a lower-resolution screen is also a good way to get a bit more performance. Down to 480x272 would still give a good result I think. Also, a lower resolution means a lower framerate is less "noticeably" slow.
Many screens of this size have a refresh rate of 60hz.

For the price, some screens are sold with or without touch capabilities, which makes a difference of around 10$.

Also note that the Vita has 512MB of RAM, just like the Pi Zero, but with an additional dedicated 128MB of VRAM.

For a foldable console: I asked another maker why there are so few handheld projects with foldable parts, and he told me he tried, and 3D-printed mechanical parts had to be thicker than what he needed. He might try something like that with a wooden box in the future.

From what I found on the web, Buildroot should support OpenGL and OpenGL ES. But it looks like a pain to configure :/ I've taken a look at RISC OS, and while it looks light enough for our purpose, I'm not sure about how well it is maintained and how well hardware acceleration works (it should support OpenGL ES from what I've read). I've also taken a look at includeOS, which should support the Raspberry Pi starting somewhere in 2019, but rendering or sound doesn't look like a concern to them, it's oriented more towards cloud services.

hippy
Posts: 5164
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Questions about programmable handheld console

Sun Jan 06, 2019 6:59 pm

Guntha wrote:
Sat Jan 05, 2019 6:36 pm
From what I found on the web, Buildroot should support OpenGL and OpenGL ES. But it looks like a pain to configure :/ I've taken a look at RISC OS, and while it looks light enough for our purpose, I'm not sure about how well it is maintained and how well hardware acceleration works (it should support OpenGL ES from what I've read). I've also taken a look at includeOS, which should support the Raspberry Pi starting somewhere in 2019, but rendering or sound doesn't look like a concern to them, it's oriented more towards cloud services.
Regardless of where you finally end up I would recommend starting with a Pi and Raspbian, and developing code which runs on that.

With an LCD added, buttons attached to GPIO, you have both the game console and the development machine with full-size HDMI, though you can develop remotely and copy code or source to it if you prefer.

Using a smaller or cheaper Pi, going to a more esoteric OS or buildroot, putting it in a purpose designed case, making it battery powered, minimising costs, then becomes optimisation steps.

My opinion is the easier and quicker you can get something working the more likely it is to carry you through to completion. Try and do everything at once, or having too much to do and solve before really getting started, and it may all grind to a halt without having gone anywhere or having achieved much at all.

tucker
Posts: 5
Joined: Sun Mar 10, 2013 8:35 pm

Re: Questions about programmable handheld console

Mon Jan 07, 2019 4:38 pm

@flashjaysan I agree the emulators support mainly 8-bit era. However the ESP32 hardware is a dual core 32-bit processor with a decent specification including flash and SRAM. On tests I have run it is really quite fast. The display in the Odroid is 320x240 and seems to support at least 16-bit colour. If you wanted to write native code in C/ASM rather than emulated code it would seem to meet your needs and easily surpass the raw CPU performance of the 16-bit console era. Being dual core you are free to implement your own GPU/rendering on one core and main game code on the other core. The console adds controls, battery charging, decent case and some IO expansion so allows for all sorts of options. My main interest in the device is not as an emulator but for native code and I can report it works very well.

PhatFil
Posts: 1197
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Questions about programmable handheld console

Mon Jan 07, 2019 6:10 pm

tucker wrote:
Mon Jan 07, 2019 4:38 pm
@flashjaysan I agree the emulators support mainly 8-bit era. However the ESP32 hardware is a dual core 32-bit processor with a decent specification including flash and SRAM. On tests I have run it is really quite fast. The display in the Odroid is 320x240 and seems to support at least 16-bit colour. If you wanted to write native code in C/ASM rather than emulated code it would seem to meet your needs and easily surpass the raw CPU performance of the 16-bit console era. Being dual core you are free to implement your own GPU/rendering on one core and main game code on the other core. The console adds controls, battery charging, decent case and some IO expansion so allows for all sorts of options. My main interest in the device is not as an emulator but for native code and I can report it works very well.
pop over to utube and look for esp8266/esp32 speed comparisons.. https://www.youtube.com/watch?v=GQUHymJ_YPw&t=1605s






.

tucker
Posts: 5
Joined: Sun Mar 10, 2013 8:35 pm

Re: Questions about programmable handheld console

Tue Jan 08, 2019 1:43 pm

While not a cased solution the Gameduino 3 display is easily programmed. It is based on the FTDI FT81x display chip which offers a very capable LCD controller. You can get non-Arduino focused FT81x displays that work fine from Raspberry PI Zero. I have found it a lot easier and pleasant to work with compared to the framebuffer or various libraries for graphics on Linux/PI. There are some nice demos on the Gameduino and several library projects to port the GD3 library to generic displays along with a growing support for games and apps. The Arduino demo code works on PI with very little work needed to port it over. Maybe an option and would easily work in a case with a LiPo boost charger, LiPo battery and GPIO connected game controls.

I have quite a few of the various FT81x displays of various sizes and resoltuions. I have several of each size of “official” GD3 along with a range of displays from hotmcu and similar. I have liked (and backed) the Gameduino since the FPGA based Gameduino 1 (which I still like and use) and like the decent balance between capability and lightweight libraries.

flashjaysan
Posts: 5
Joined: Fri Dec 21, 2018 5:08 pm

Re: Questions about programmable handheld console

Wed Jan 09, 2019 8:20 pm

Hi everyone!
I've found a product that corresponds to what I'm looking for. It's not the ultimate solution but it is a very good starting point and I'm planning to start with that and see what it will allow me to create.
The product I'm referring to is the Waveshare GameHat:
https://www.waveshare.com/game-hat.htm
It has a very good hdmi 3.5" screen and integrated controls via GPIO (I don't know how to access them from gcc yet). It can be powered from a 18650 battery or from a micro USB power supply. Also, it can work with the Pi zero or the Pi 3. External gamepads can be connected to the pi to play with another player. And it's not that expensive.
So I'm planning to buy one and do some tests. I'll probably make some videos about it in the future.

@tucker: Well, I want some easy to use library like raylib (that uses openGL internally). I'm no engineer and I don't want to do the low level stuff. I only want to build something that would enable any beginner to code its own games and using the power of the device (that exclude the toy lib Pygame coming with the raspbian distro).
I don't see the point of using a powerful display + GPU on a rather limited resources Arduino. It doesn't make sense. However, for a Pi, it would be awesome, yes!
You seem to be quite expert in electronics. That's not my case. I'm a standard programmer.

@hippy: You're quite right and that's why I'm going with the Gamehat now. Building something from scratch would take more time and won't allow to play with the basic concepts soon enough to keep the motivation.

flashjaysan
Posts: 5
Joined: Fri Dec 21, 2018 5:08 pm

Re: Questions about programmable handheld console

Fri Jan 18, 2019 10:05 am

I received my Game-HAT device and I'm still testing things out to make it properly work.
So far I've installed Raspbian, and it works without any problem on the Game-HAT. I've also compiled raylib and tried to access the GPIO ports related to the buttons with the pigpio library.
After some testing, I can access UP, DOWN, LEFT, RIGHT and SELECT buttons but not the other ones.
I've managed to compile some programs that use raylib and pigpio and I can move a circle with the directional stick.
I'm currently working on writing a document about this project and here are the WIP versions.
First, in French :
https://docs.google.com/document/d/1BXF ... sp=sharing
Then in english (still in its early stage) :
https://docs.google.com/document/d/1E45 ... sp=sharing
There are some issues and it's not perfect so I hope that people will build upon this project in order to make something better.
If some of you could help me with accessing the missing buttons or some minor issues (when I created my first game, it didn"t took all the screen although I set the resolution to its entire size).

Guntha
Posts: 4
Joined: Tue Dec 25, 2018 9:43 pm

Re: Questions about programmable handheld console

Wed Jun 19, 2019 9:10 am

Hello,

Unfortunately, I didn't have time to go further with making games on a Raspberry Pi, I've been taken with other projects.

I just found this via Pimoroni:
https://www.kickstarter.com/projects/pi ... ref=7qos05

It's more for inspiration (it doesn't use a Pi but custom hardware).

I like the form factor, not sure we could fit a Pi in there without cutting some things.
The point mostly relevant to this topic is that it aims to be programmable.

It's nice to see that a company is interested in the same subject :)

Return to “Gaming”