Tag Archives: game

Top Ten Video Roundup Of Awesome Connected Devices Integrated With Firemonkey

Programmable and internet connected devices like the Arduino are exploding in popularity. There are quite a few videos on up YouTube showing fun integrations between Delphi and various bluetooth, wifi, and serial connected devices. Here are the top 10 Delphi device integration videos I’ve seen.

Some of them utilize Delphi XE8 Firemonkey apps on Android and IOS while others are simple Delphi 7 VCL apps using a COM port. There are three different Arduino integrations, two different drone integrations, a brain interface integration, a robot arm integration, a depth sensor integration, an animatronic head integration, an integration with beacons and mobile devices, and a gesture control integration. Three runner ups are listed at the end and they are a swimsuit integration, IP camera integration, and a temperature sensor integration.

Add your favorite Delphi hardware integration videos I’ve missed in the comments below!

#1 Animatronic Terminator Head Controlled Via A Delphi XE8 Android App

There are four different servo motors that control this creep animatronic head. Is that the Firemonkey light in his eyes?

#2 Delphi Firemonkey Android App Controlling LED Lights In The Room

This is a slick looking control interface for changing the room lights by sliding the colored bars in this Delphi app. Another similar video is here.

#3 Audience Member Controls A Drone Using His Brain Via Appmethod App And An Emotiv Headset

Nothing says this is the future like watching a guy fly a hovering vehicle with his mind. There is a second longer video with more explanation and background that you can watch here.

#4 Robot Arm Sketches Letters Via An Arduino And Delphi Control App

The Delphi app in this video is actually playing back a list of commends to create the sketch.

#5 Demonstration Of Accessing Microsoft Kinect Depth Data From Within Delphi

You can see the depth data made available via the Kinect SDK in this video. Includes sample source code.

#6 Ultrasonic Ping Pong Game Build In Delphi And Controlled Via An Arduino

This one is awesome because of the ultrasonic controllers. The Delphi and Arduino source for this integration is available in the YouTube description. The runner up to this video uses a knob but it also has a speaker (check it out here).

#7 Appmethod Control App Used To Pilot A Parrot AR Drone Around The Office

It’s hard to top a brain controlled drone but sometimes you just need the drone to go where you want and that’s where controlling it with a Delphi app comes in.

#8 Medical App Built In Delphi On Android And IOS Utilizes Check Ins Via Beacons For Distance

I believe the apps demonstrated in this video were covered in a webinar by Embarcadero and you can find all the resources for building the apps here.

#9 Appmethod Reads Data From A Myo Gesture Control Armband To Move A TRectangle

There is also a second video here where the armband is used to control a photo app in Delphi with gestures.

#10 Slick Looking Delphi App Used To Control An Arduino Via Wifi And Bluetooth

You can test out this app demo yourself and get the Arduino side of the source code here.

BONUS: Connected Swimsuits That Monitor (Via Delphi) How Much Sun They’ve Received

It isn’t quite clear how Delphi (or Appmethod) is used. I assume it is used by the sunlight monitoring device as the control app on a tablet or phone.

DOUBLE BONUS: IP Cameras And I/O Controllers Connected And Controlled Via An A Delphi Android App

This video is good but it is someone long as it contains a lot of technical details and a lot of connected devices. Really good showcase of technology.

TRIPLE BONUS: Read Temperature Data From An Arduino Device Using Delphi And Display It In An App

This integration with Delphi is achieved via simple serial port interface.

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Ten Tips For Creating Professional Android Apps With Firemonkey

#1. Save A Shortcut To The Home Screen After Install

If you want users to be able to find your app again after they first install it you should add your icon to the user’s home screen. The user can remove it or it will automatically be removed if they uninstall your app.

#2. Secure Your App’s Data Connections With SSL

Users are connecting from public hotspots these days and you need to secure those data connections to keep the data safe. Some app stores like Amazon App Store will deny your app if you don’t use secure connections for your user’s login data.

#3. Create And Deploy Icons For Your App

You will need to create a good number of different icon sizes to deploy with your app and to upload to each different app store. There is a free utility available which makes this easier.

#4. Handle App Activate And Deactivate System Events

When users multitask using Android there are specific system events that will be fired. You should add these events to your app and take action as needed.

#5. Add An App Loading Splash Screen

Android apps can take a few seconds to load where the user may be confused on what your app is doing. You can set up a splash screen so the user sees your logo or something similar while your app loads. You can also try this new method of using the Android Manifest to add a splash screen.

#6. Keep The Focused Edit Field Visible Above The Virtual Keyboard

When the virtual keyboard pops up it will by default cover the box that is being edited if it is below the bottom half of the screen. You can scroll your form so that the field being edited stays visible.

#7. Use Progress Dialog Boxes To Keep Your App Responsive

If your app is doing a task which will take some time like downloading or saving a file you should show a progress dialog to the user so that your app doesn’t look frozen. You can use either a multithreaded, native dialogs, or single threaded dialog.

#8. Check Network Connectivity Before Trying To Connect

You should check if a user is connected to the internet before making any opening any connections that attempt to connect using the internet. This way you can notify the user if they do not have connectivity and your app can handle that accordingly.

#9. Handle The Android Hardware Back Button

Android devices have a back button which you should handle so your users have a correct flow inside of your application.

#10. Save Settings Between Sessions

You can use both TIniFile and TMemIniFile to save settings on Android just like you would on Windows. Be sure to use TPath.GetDocumentsPath + PathDelim to get the right location to save your Ini file to. A second way to save settings would be with SQLite.

BONUS TIP: Google Cloud Messaging Push Notifications

If you want to keep connected to your users and increase retention you can use push notifications. On Android there is a push notification API from Google called Google Cloud Messaging. It is pretty closely tied to Google and you have to have API keys but keeping connected to your users is worth it. Push notifications are similar to an email newsletter.

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Ten Tips And Tricks For Building Games With Delphi XE5 And XE6 On Android And IOS

Game Loop. Using a game loop to handle game state updates is one method for architecting your game. The basic idea behind a game loop is that you have one function that executes each frame and inside of that function you handle character movements, projectile movements, enemy movements, collision detection, and pretty much every other action that needs to happen at an interval within your game. There are two different Flappy Firemonkey game loop examples with source code. The original example that I created uses a timer for the game loop and the second modified example uses a thread for the game loop function.

Sprite Animation. One method of doing fast image animation is with sprite sheets. Sprite sheets are all of the frames of an animation contained within the same image. The sprite component copies each frame from the bitmap and paints it in the same place over and over creating an animation. There is a TSprite component for Delphi Firemonkey that does this for you. Bitmaps are generally faster than vector drawing every frame on mobile devices.

Drawing & OpenGL. Most games have custom drawing of some kind. If you are looking to do any kind of custom drawing with Delphi Firemonkey there is a drawing example app available with quite a few functions implemented and there is also a native drawing API demo for IOS. If you want to do drawing using OpenGL directly and not just the Firemonkey functions Jim McKeeth has a blog post up with a roundup of using OpenGL with Delphi XE6. Lastly the Box2D physics engine for Firemonkey has extensive drawing examples using a TPaintBox.

Bitmap Caching. Whether you are moving one Firemonkey control around the screen or hundreds of controls around the screen you can probably benefit from image caching. On mobile devices moving bitmaps around is generally faster than letting Firemonkey manually draw every frame when nothing changed from the previous frame. Drawing your control once and then caching it as a bitmap for each additional draw is one method to accomplish this. There is a component called TImageCacheLayout that does this for you automatically. One other trick you might try to get faster drawing with Firemonkey is using a TRectangle instead of a TImage for a lighter bitmap control.

Collision Detection. Collision detection is the backbone game mechanic behind a lot of games. Every time two different objects intersect each other collision detection occurs. There are three different collision detection examples which include point based collision detection, rectangle based collision detection, and finally automatic collection detection with the Box2d for Firemonkey physics engine.

Physics Engine. Using a physics engine can greatly speed up game development because you don’t have to manually code things like gravity, buoyancy, and collision detection. You can also build complex objects that mimic real world functionality. There is a Firemonkey version of the Box2d physics engine with over 60 different demos to base a game off of including vehicle simulations, bridge simulations, an Arkanoid demo, and many more. There is a visual world editor for Box2d called RUBE which exports it’s world as JSON which can easily be imported into Delphi Firemonkey.

Artificial Intelligence. If you are looking for the characters in your games to have some kind of intelligent response to the players you need artificial intelligence algorithms. There are two different Delphi Firemonkey component suites that implement artificial intelligence functionality like neural networks. One component suite is called IntelligenceLab and the other is called Inference Engine from RiverSoftAVG.

Data Files. Most games use data files of some kind to either store levels, save the game state between play sessions, or even just storing settings of the player. In Delphi Firemonkey there are a lot of choices on how you can store your data. You can read and write simple text based files using TIniFile or you can use robust databases like SQLite for reading and writing blob data like images using FireDAC. If your game has some kind of online element to it you can use the TRESTClient controls for loading and saving data from a server.

Monetization. If you want to be able to monetize your games on mobile there are two different methods for doing so which are ads and in app payments. In Delphi XE5 there are some third party ad components for IOS and an AdMob component for Android. There is also a third party in app payment component for IOS. Delphi XE6 ships with AdMod and iAd components for Android and IOS in addition to an in app payment component which works for both Android and IOS.

High Score Systems. One thing that keeps players interested in a game is being able to compare their score against other player’s scores. Once a player has mastered a game a high score system can still keep them coming back again and again to see if they can beat the high score of other players. There is a Firemonkey example for saving user scores in the cloud using the Delphi XE5 TRESTClient components. There is also a PHP or ASP.NET server side high score system you can host yourself that can save and retrieve user scores from a MySQL database. Lastly on IOS you can plug into the Apple GameCenter API for storing high scores and other game data.

BONUS TIP: Third Party Libraries. You can always augment your Object Pascal development on Android and IOS by using existing third party libraries which may have been written in a lower level language. There are literally hundreds of existing third party libraries out there for you to access from Delphi Firemonkey. For Android devices you can load JAR files which contain Java libraries (.jar) and Android NDK libary files (.so). On IOS devices you can load static libraries (.a) to get access to additional functionality. For example, you could rapidly prototype with Box2d for Firemonkey and then if you need more speed you could import the Java version of Box2d or the C++ version of Box2d on Android.

Finally I have some advice for you on what kind of games you should build with Delphi XE5/XE6. Don’t try to build the next big 3D shooter or other super high frame rate games for hard core gamers because there are better tools to build those kinds of games (like Unity3D or Adobe Flash). Instead focus on casual games for mobile devices that Delphi Firemonkey can build well like dress up games, turn based games, classic adventure games, hidden object games, basic arcade games, drawing games, or board games using the camera. Delphi Firemonkey can excel at doing rapid application development for these types of games.

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , ,