Author: Aidan K7359
11-August-2016 / Day 4 of C++ Boot Camp is C++ Game Development hosted by Eli M., MVP, Developer and Entrepreneur from FMXExpress.com
Four different games with classic game mechanics will be demonstrated.
We will be also be covering topics such as App Tethering, utilizing TFrames to build your UI, using TRectangle as a light weight image object, accessing the device motion sensor, simple object pooling, cross platform sound, sprite sheet animation, and building a high score system with SQLite across Android, IOS, OSX, and Windows with a single source code.
Source code is available now at:
In Alien Invasion you will learn how we used TRectangle as a light weight image object and about utilizing TFrames to build your UI.
In Mars Rocket you will learn accessing the device motion sensor and building a high score system with SQLite and LiveBindings.
In Rocket Ship Delta you will learn how we used simple object pooling and sprite sheet animation.
Finally, in Space Rocks you will learn how we used App Tethering to build a gamepad for playing the games on a remote device and built a cross platform sound class.
Eli has deployed over 300 mobile games across Google Play, Apple App Store, Amazon Appstore, and Samsung Apps. He has also aggregated over 80,000+ flash games to 120+ million players worldwide reaching over 210+ million gameplays. And he has reached over 400,000 developers with hundreds of tips and tricks for Firemonkey through FMXExpress.com.
Q: Do you have sample games projects?
A: Yes! And they will be available for download soon, we’ll have a link in the blog post for today’s session – keep an eye on blogs.embarcadero.com and https://github.com/EmbarcaderoPublic/CppArcadeGames
Q: Are there any books that any of the experts recommend we get if we want to create a game in the future? If so what are they?
A: I mainly use blogs. This one is good. Not Delphi specific but the information transfers over. http://www.emanueleferonato.com/
Q: Yes. It’s an excellent intro. Are there ways to create using C++ Builder & OpenGL for 3D Games?
A: FMX uses DirectX on Windows (Direct3D or Direct2D, depending what you want) and OpenGL on other platforms
Q: I may have missed this question… what are the requirements to develop ios device?
A: You need the Pro+Mobile edition of C++Builder. You also a Mac and an iOS device, and an Apple dev account if you want to put your app on the App Store. We often run C++Builder in a Windows VM on a Mac. http://docwiki.embarcadero.com/RADStudio/Berlin/en/Supported_Target_Platforms http://docwiki.embarcadero.com/RADStudio/Berlin/en/IOS_Mobile_Application_Development
Q: FireDAC is not available in the starter?
A: FireDAC is not available in Starter. you’ll need to update to Professional at least.
Q: The source code for these games are available?
A: Available on GitHub – https://github.com/EmbarcaderoPublic/CppArcadeGames
Q: Excuse me if this was already asked, but what if you want to just deploy on desktop (Win|Mac) how does one code for game controllers?
A: That would depend on the game controller. In our case, we use Android and IOS devices as the game controller. But you could connect to controllers via serial port if they supported that.
Q: what it is better to useTStringList or TDictionary for store objects
A: I like TStringList. I use it for everything. Maybe too much.
Q: Sprite sheet explanation confusing. How big can they be?
A: The sprite sheet needs to be the width of each frame times the number of frames. Same goes for the height. The height of each frame times the number of frames. In this case, it is 3 frames by 3 games. So if the frames are 50px it would be 150×150.
Q: Very nice examples. Will there be Steam SDK support ? Or examples soon ? We highly need that.
A: As long as the Stream SDK has normal Windows bindings it should integrate without much of a problem. May take some work.
Q: how to handle irregular shapes?
A: Irregular shape collision detection is expensive. You could use a TRectangle until an entity gets closer. And then you could switch to a more expensive (pixel to pixel collection detection). Generally, in these games I just use a TRectangle for all collisions.
Q: Can you use a different database other than SQLite? Oracle, MySQL, SqlServer?
A: SQLite and InterBase are the only databases available on all platforms. You could use DataSnap to talk to a remote database, or you could use the REST components to talk to a web service. Starter doesn’t include databases though.
Q: What modules or libraries do you use for game development in C++?
A: These games just use the Firemonkey (FMX) which is a layer on top of OpenGL/OpenGL ES/Direct 2D/GDI+. Box2D (a physics engine) also comes with the product.
Q: does the starter edition provide disk access? I know published database integration requires pro for local and higher more expensive editions are required for multi-computer database support, however, could one create their own limited database access with starter?
A: Yes, you can certainly write to file
Q: Can Starter version use boost library through GetIt package manager?
A: Yes, Boost should be in GetIt. I saw a report a couple of days ago it wasn’t showing for uses of Starter but does for Pro and above, but you can always manually install it : http://docwiki.embarcadero.com/RADStudio/Berlin/en/Boost_Libraries
Q: Thank you for offering complete games as part of the bootcamp because this helps us to understand the range of techniques needed for game development. It’s a good demonstration of C++ Builder capabilities.
A: You’re welcome. We have a lot of demos and samples, not just for games – see games here: github.com/EmbarcaderoPublic but also other demos here: https://sourceforge.net/p/radstudiodemos/code/HEAD/tree/branches/RADStudio_Berlin/
Q: According to your roadmap, when will C++ Builder support Linux? I will keep the secret if you tell me 🙂
A: Linux Server support will be in the next release!
Q: do the games exists as Delphi too?
A: Yes they do – C++ and Delphi versions of these games can call be downloaded here: https://sourceforge.net/p/radstudiodemos/code/HEAD/tree/branches/RADStudio_Berlin/
Q: Can you also create 3D games with C++ Builder?
A: Yes, sure 🙂 FMX has 3D support, and you could use any game engine too if you want
Q: What about loading times in games?
A: These ones have no level loading time, all the resources are built in. The apps will start quite quickly on mobile, too, as in the live demo of using them
Q: Can you read/write to other game engines? Blender? Unreal?
A: We don’t ship with Blender or Unreal currently, but are investigating it… No reason you can’t do so yourself though, our compilers are very standards-compliant so should work fine
Q: Can you have multiple tablets/devices tethered as controllers at the same time?
Q: What are the restrictions on reusing the sound and graphics?
A: They can be re-used just like any other Embarcadero demo. The license on those covers these sounds, graphics, and music.
Q: I created a small program in Starter. When the project was opened in RAD XE8, only system32 was possible. All other platforms were no longer there. Do I have to create the project again?
A: create a new project and add your source code files.