Game Engine for App Inventor

Hi folks,

This is David Kim from MIT App Inventor. I was thinking about creating some game engine functionality to App Inventor. Our Canvas only has rudimental features for people to create more complicated games

Here are some ideas I had, could people give some feedback on what they think?

  1. A real game loop
    Add a GameClock or Canvas-level Frame event with deltaTime, pause/resume, target FPS, and actual FPS. Current sprite movement is interval-based per sprite, which makes coordinated game logic awkward. A shared loop lets users update movement, enemies, timers, scoring, and effects in one predictable place.

  2. Velocity and acceleration properties
    Sprites currently expose Speed, Heading, and Interval. For games, users usually want VelocityX, VelocityY, AccelerationX, AccelerationY, maybe AngularVelocity. This makes platformers, top-down movement, gravity, knockback, and projectiles much easier.

  3. Sprite groups/tags/layers
    Add Tag, Group, or Kind to sprites, plus blocks like:

    • GetSpritesInGroup("enemy")

    • ForEachSpriteInGroup

    • SetGroupVisible

    • RemoveAllSpritesInGroup

    This avoids users manually managing parallel lists of enemies, bullets, coins, etc.

  4. Dynamic sprite creation
    Games need bullets, enemies, coins, particles, pickups, obstacles. Users should be able to clone an ImageSprite template at runtime:

    • CreateImageSpriteFrom(template)

    • DeleteSprite(sprite)

    • CloneSprite(sprite)

    • CreateSprite(picture, x, y, width, height)

    Without this, complicated games become painful very quickly.

  5. Better collision options
    Current collision is useful, but games need more control:

    • collision groups/masks, e.g. bullets collide with enemies but not other bullets

    • CollisionStarted, CollisionEnded, maybe CollisionWithGroup

    • overlap amount or collision normal

    • bounding-box vs circle vs rotated-box vs pixel-perfect modes

    • IsTouchingGroup("enemy")

8 Likes

Game sound is often an afterthought.
A proper sound system would allow cues to be played concurrently, and at real-time-controllable volumes, panning, and speed (allowing 3D effects potentially). It would also allow for events within the cue (start, end, follow amplitude level) that can be triggers for visual effects or other game events.
For an example that was built with Java, see, on github, the project philfrei/audiocue-maven.
I don’t know enough about the underpinnings of App Inventor to know where to begin with incorporating this code. Does App Inventor use OpenGL?

Maybe it's easier to accomplish this from Box2d