Delphi Boot Camp Day 4 - Game Development with Delphi

Posted by on in Programming



 
This page contains resources and the replay for day 4 (September 8th, 2016) of the Delphi Boot Camp.

Trainer

Eli M.

Eli M.
Developer & Entrepreneur
FMXExpress.com

Agenda

  • Game loop
  • Using TRectangle
  • Frames UI
  • Motion Sensor
  • High Scores via SQLite & LiveBindings
  • Object Pooling
  • Sprite Sheet Animation
  • App Tethering
  • Cross Platform Sound

 

 

Download the Delphi source code for free:

http://embt.co/DelphiGames2016

Download the C++Builder source code for free:

https://github.com/EmbarcaderoPublic/CppArcadeGames

 
 

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.

 

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.

 

Bio

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&A Logs

1st Session

Q: What tool was used to create the graphics?

A: Adobe Flash

 

Q: can I somehow use google maps ?

A: There is a TMapView yes for mobile. You can also use location component on Windows and use the TWebBrowser component to display google maps - check out the sample - C:\Users\Public\Documents\Embarcadero\Studio\18.0\Samples\Object Pascal\Mobile Snippets\Location

 

Q: Can the games scale properly in iPad Pro 12.9" ?

A: It should scale properly, as the interface is totally responsive. However, the real estate of the game will increase. Rocket Ship Delta is the only one which may not scale right. It depends on the screen ratio. Can probably be tweaked as well.

 

Q: Can I develop an iOS app using Windows 10?

A: Yes, but to deploy to the device you need at least a MacMini or you can use MacInCloud.

 

Q: What about an older iPad or older android device is it possible to deploy directly to these devices and if so what do you need to do to configure the device to accept the executable?

A: The device in the video is an iPad 2 which is pretty old. Delphi Berlin supports Android 4.x+. Nothing special to deploy to any of those.

 

Q: Are there any beginners tutorials on the Embarcadero YouTube site for Delphi? C++ for that matter ?

A: Lots and lots. Check the HowTo playlist.

 

Q: Could you use a datasnap server to store/retrieve the game’s score data?

via TCP/port etc.

A: you can - if you have enterprise edition

 

2nd Session

 

Q: How can I create and use buttons which have another shape like a circle and a bitmap in it?

A: With a PNG you can have any shape because it has transparency and you can just load that in TRectangle like normal. If you need the actual shape there is also a TCircle and then if you look in GetIt there is a Radiant Shapes component suite with a whole bunch of other shapes.

 

Q: What was the URL for creating the sounds?

A: http://www.superflashbros.net/as3sfxr/

 

Q: Is there a component for In-App purchases in Delphi?

A: yes - Advertising and In-App Purchase included built in - and there are third party components.

 

Q: When checking for collisions, you checked if the rectangles intersected. What about irregular shapes, such as a weird blob? How do you ensure the pixels collide and not just the rectangle that encompasses them?

A: How extreme the shapes are might lead you to use pixel by pixel collision detection. you can check the distance between the two objects.  Depends on your game. Enable pixel collision detection when the objects get close enough together - to save calculation times.

 

Q: Can you explain steps to make a multiplayer game?

A: Depends on the game. AppTethering is one way to hook multiple players. another would be to use network or Bluetooth to connect multiple devices and players. You could have a "global world" on the internet as a server side process - and then have clients to let client games live and interact with that common world.



About
Gold User, Rank: 90, Points: 5
600+ blog posts about Delphi Firemonkey.

Comments

  • Manfred F18578
    Manfred F18578 Friday, 9 September 2016

    Hi, manny thanks for the demo. I get the same error like Roland. Is there a fixed version available?

  • Eli M
    Eli M Friday, 9 September 2016

    I updated the code. Let me know if it fixed or didn't fix the issue. Thanks.

  • Manfred F18578
    Manfred F18578 Sunday, 11 September 2016

    Super, its working now :-) Thanks again

  • Roland Hülsmann
    Roland Hülsmann Thursday, 8 September 2016

    Yes, thank you. The dialog didn't poop up, if i loaded the Projectgroup. If I then tried to load a single game (*.dpr), the dialog popped up and i could remove the Rectangle2, to compile an run the game!

  • Eli M
    Eli M Friday, 9 September 2016

    I updated the code. Let me know if it fixed or didn't fix the issue. Thanks.

  • Roland Hülsmann
    Roland Hülsmann Thursday, 8 September 2016

    Only the first game will run. All others did compile, but crash at start: "Vorfahr für rectangle2 nicht gefunden". Something not found. I've tried to close the project and loaded it again. The same error. I closed RAD-Studio (Starter), started it again. The same error. What can I do, to run the games?

  • Eli M
    Eli M Thursday, 8 September 2016

    Yeah I see an error with the Starter version. We're going to upload a fixed version of that. Will get back to you. On my end when I pressed Okay to remove in that that dialog about Rectangle2 that was all it took to get them to compile.

  • Please login first in order for you to submit comments
  • Page :
  • 1

Check out more tips and tricks in this development video: