GithubHelp home page GithubHelp logo

stregasgate / gateenginedemos Goto Github PK

View Code? Open in Web Editor NEW
26.0 2.0 4.0 333 KB

Example projects for GateEngine, a cross platform game engine for Swift developers.

License: Apache License 2.0

Swift 100.00%
2d-game-engine 2d-game-framework 3d-game-engine 3d-game-framework engine2d engine3d game-development gamedev spm swift swift-lang swift-package-manager swift5 swiftlang

gateenginedemos's Introduction

GateEngine Demos

Example projects for GateEngine, a cross platform game engine for Swift developers.

CI

Navigating this Package

Projects are organized as their own executable. Each project is a single swift source file.
There are no "helper" functions or dependences.

Available Examples

General

  1. User Input: Show text when using certain user inputs.
  2. Multiple Windows: Open multiple windows on compatible platforms.
  3. Save State: Save and restore game state.

2D

  1. Animated Sprite: An animated sprite loaded from assets.
  • Pong: A virtual table tenis clone.
  • JRPG: Uses Sprite, TileMap, Scripting, and StateMachine.

3D

  1. Rotating Cube: A textured cube loaded from assets.
  2. Skinned Character: An animated character loaded from assets.
  3. Mouse Picking: Changes the color of an object under the mouse cursor.
  • First Person: Move around a level with mouse and keyboard controls.

Support GateEngine!

If you appreciate this project, and want it to continue, then please consider putting some currency into it.
Every little bit helps! Support With: GitHub, Ko-fi, or Patreon.

Community & Followables

Discord Twitter YouTube Reddit

gateenginedemos's People

Contributors

strega avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gateenginedemos's Issues

CodeSign error when compiling for iOS simulator

CodeSign /Users/admin/Library/Developer/Xcode/DerivedData/GateEngineDemos-eysqrhopcpvdfdbownbigsjgzdig/Build/Products/Debug-iphonesimulator/2D_01_AnimatedSprite.app (in target '2D_01_AnimatedSprite' from project 'GateEngineDemos' at path '/Users/admin/Documents/xcode_projects/GateEngineDemos/Xcode/GateEngineDemos.xcodeproj')
    cd /Users/admin/Documents/xcode_projects/GateEngineDemos/Xcode
    
    Signing Identity:     "-"
    
    /usr/bin/codesign --force --sign - --entitlements /Users/admin/Library/Developer/Xcode/DerivedData/GateEngineDemos-eysqrhopcpvdfdbownbigsjgzdig/Build/Intermediates.noindex/GateEngineDemos.build/Debug-iphonesimulator/2D_01_AnimatedSprite.build/2D_01_AnimatedSprite.app.xcent --timestamp\=none --generate-entitlement-der /Users/admin/Library/Developer/Xcode/DerivedData/GateEngineDemos-eysqrhopcpvdfdbownbigsjgzdig/Build/Products/Debug-iphonesimulator/2D_01_AnimatedSprite.app

/Users/admin/Library/Developer/Xcode/DerivedData/GateEngineDemos-eysqrhopcpvdfdbownbigsjgzdig/Build/Products/Debug-iphonesimulator/2D_01_AnimatedSprite.app: code object is not signed at all
In subcomponent: /Users/admin/Library/Developer/Xcode/DerivedData/GateEngineDemos-eysqrhopcpvdfdbownbigsjgzdig/Build/Products/Debug-iphonesimulator/2D_01_AnimatedSprite.app/Assets.car
Command CodeSign failed with a nonzero exit code

Crashing on Linux

I'm in WSL, but have no trouble running other graphics examples, like raylib stuff and xclock. I even made a test X11 app that calls __strlen_avx2 (which is crashing in your example), and that works. Any ideas? Lots of dumps attached

โฏ swift run 3D_01_RotatingCube
Building for debugging...
[6/6] Linking 3D_01_RotatingCube
Build complete! (1.36s)
[GateEngine] Loaded static resource search paths: (GameDelegate search paths not included)
  "[MainBundle]/GateEngineDemos_2D_01_AnimatedSprite.resources",
  "[MainBundle]/",
  "[MainBundle]/GateEngine_GateEngine.resources",
[GateEngine] No Game State "SaveState.json" found. Creating new Game State.
[GateEngine] No Game State "GateEngine.json" found. Creating new Game State.
swift-runtime: unable to suspend thread 8033
swift-runtime: unable to suspend thread 8033

๐Ÿ’ฃ Program crashed: Bad pointer dereference at 0x0000000000000000

Thread 0 "3D_01_RotatingC" crashed:

0 0x00007fe8b54467fd __strlen_avx2 + 29 in libc.so.6

Backtrace took 0.61s
โฏ swift run 2D_Pong
Building for debugging...
[630/630] Linking 2D_Pong
Build complete! (15.23s)
[GateEngine] Loaded static resource search paths: (GameDelegate search paths not included)
  "[MainBundle]/GateEngineDemos_2D_01_AnimatedSprite.resources",
  "[MainBundle]/",
  "[MainBundle]/GateEngine_GateEngine.resources",
[GateEngine] No Game State "SaveState.json" found. Creating new Game State.
[GateEngine] No Game State "GateEngine.json" found. Creating new Game State.
swift-runtime: unable to suspend thread 7893
swift-runtime: unable to suspend thread 7893

๐Ÿ’ฃ Program crashed: Bad pointer dereference at 0x0000000000000000

Thread 0 "2D_Pong" crashed:

0 0x00007ffb1d06f7fd __strlen_avx2 + 29 in libc.so.6

Backtrace took 0.61s
* thread #1, name = '2D_Pong', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
  * frame #0: 0x00007ffff695d7fd libc.so.6`__strlen_avx2 at strlen-avx2.S:74
    frame #1: 0x00007ffff7e7ff32 libX11.so.6`___lldb_unnamed_symbol1648 + 98
    frame #2: 0x00007ffff7e80df1 libX11.so.6`XrmGetStringDatabase + 65
    frame #3: 0x00005555559af3d9 2D_Pong`X11Window.updateStoredMetaData(pixelSize=nil, self=0x0000555556cfd420) at X11Window.swift:30:32
    frame #4: 0x00005555559b04e8 2D_Pong`X11Window.init(window=0x0000555556cc6f40, self=0x0000555556cfd420) at X11Window.swift:90:9
    frame #5: 0x00005555559afe14 2D_Pong`X11Window.__allocating_init(window:) at X11Window.swift:0
    frame #6: 0x0000555555a08250 2D_Pong`Window.windowBacking.getter(self=0x0000555556cc6f40) at
 Window.swift:51:58
    frame #7: 0x0000555555a08523 2D_Pong`Window.renderTargetBackend.getter(self=0x0000555556cc6f40) at Window.swift:54:9
    frame #8: 0x0000555555a0887a 2D_Pong`Window.renderTargetBackend.modify at <compiler-generated>:0
    frame #9: 0x0000555555a0acd9 2D_Pong`protocol witness for _RenderTargetProtocol.renderTargetBackend.modify in conformance Window at <compiler-generated>:0
    frame #10: 0x00005555559fbedd 2D_Pong`_RenderTargetProtocol.clearColor.setter(newValue=(red = 0, green = 0, blue = 0, alpha = 1), self=0x0000555556cc6f40) at RenderTarget.swift:164:44
    frame #11: 0x0000555555a09d3f 2D_Pong`Window.init(identifier="main", style=system, options=(rawValue = 8), self=0x0000555556cc6f40) at Window.swift:127:25
    frame #12: 0x0000555555a09bd2 2D_Pong`Window.__allocating_init(identifier:style:options:) at
 Window.swift:0
    frame #13: 0x0000555555a0d24c 2D_Pong`WindowManager.createWindow(identifier="main", style=system, options=(rawValue = 8), self=0x0000555557155590) at WindowManager.swift:56:30
    frame #14: 0x00005555557c0024 2D_Pong`GameDelegate.createMainWindow(game=0x0000555556cdae80, identifier="main", self=0x0000555556cc3e10) at GameDelegate.swift:78:39
    frame #15: 0x0000555555c92661 2D_Pong`protocol witness for GameDelegate.createMainWindow(game:identifier:) in conformance PongGameDelegate at <compiler-generated>:0
    frame #16: 0x00005555557bd79e 2D_Pong`Game.didFinishLaunching(self=0x0000555556cdae80) at Game.swift:62:34
    frame #17: 0x00007ffff763c54d libswift_Concurrency.so`swift::runJobInEstablishedExecutorContext(swift::Job*) + 349
    frame #18: 0x00007ffff763cd7c libswift_Concurrency.so`swift_job_run + 92
    frame #19: 0x00007ffff73cc8c8 libdispatch.so`_dispatch_main_queue_callback_4CF + 504
    frame #20: 0x00007ffff70ab728 libFoundation.so`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
    frame #21: 0x00007ffff70a74b9 libFoundation.so`__CFRunLoopRun + 1705
    frame #22: 0x00007ffff70a6b6e libFoundation.so`CFRunLoopRunSpecific + 510
    frame #23: 0x00007ffff6ffccf2 libFoundation.so`Foundation.RunLoop.run(until: Foundation.Date) -> () + 226
    frame #24: 0x00005555559ad105 2D_Pong`LinuxPlatform.main(self=0x0000555556cc3e30) at LinuxPlatform.swift:58:26
    frame #25: 0x00005555557c1863 2D_Pong`static GameDelegate.main(self=@thick _D_Pong.PongGameDelegate.Type) at GameDelegate.swift:154:30
    frame #26: 0x0000555555c924c3 2D_Pong`static PongGameDelegate.$main(self=@thick _D_Pong.PongGameDelegate.Type) at <compiler-generated>:0
    frame #27: 0x0000555555c9e128 2D_Pong`_D_Pong_main at Pong.swift:46:13
    frame #28: 0x00007ffff67e9d90 libc.so.6`__libc_start_call_main(main=(2D_Pong`_D_Pong_main at Pong.swift), argc=1, argv=0x00007fffffffdfa8) at libc_start_call_main.h:58:16
    frame #29: 0x00007ffff67e9e40 libc.so.6`__libc_start_main_impl(main=(2D_Pong`_D_Pong_main at Pong.swift), argc=1, argv=0x00007fffffffdfa8, init=<unavailable>, fini=<unavailable>, rtld_fini=<unavailable>, stack_end=0x00007fffffffdf98) at libc-start.c:392:3
    frame #30: 0x00005555555eb6f5 2D_Pong`_start + 37
(lldb)

Assertion Failure Upon Launch for one 2D and All 3D Demos

Project cloned from this repository. Running 2D_01_AnimatedSprite executable runs into assertion failure upon launch:
GateEngine/Entity.swift:50: Assertion failed: Component "SpriteComponent" is not a member of this entity.

Stack trace:

* thread #2, queue = 'com.apple.root.user-initiated-qos.cooperative', stop reason = Assertion failed: Component "SpriteComponent" is not a member of this entity.
    frame #0: 0x00000001b58c896c libswiftCore.dylib`_swift_runtime_on_report
    frame #1: 0x00000001b59719f8 libswiftCore.dylib`_swift_stdlib_reportFatalErrorInFile + 208
    frame #2: 0x00000001b5567330 libswiftCore.dylib`closure #1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in closure #1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in Swift._assertionFailure(_: Swift.StaticString, _: Swift.String, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 104
    frame #3: 0x00000001b5566428 libswiftCore.dylib`Swift._assertionFailure(_: Swift.StaticString, _: Swift.String, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 260
  * frame #4: 0x0000000100054b2c 2D_01_AnimatedSprite`Entity.subscript.getter(type=GateEngine.SpriteComponent, self=0x0000600000c75800) at Entity.swift:50:13
    frame #5: 0x0000000100055604 2D_01_AnimatedSprite`Entity.configure<T, ResultType>(type=GateEngine.SpriteComponent, config=0x100c93dd8, self=0x0000600000c75800) at Entity.swift:100:29
    frame #6: 0x00000001000072ec 2D_01_AnimatedSprite`AnimatedSpriteSystem.setup(game=0x000060000330c460, input=0x000060000175c080, self=0x0000600000246d80) at AnimatedSprite.swift:55
    frame #7: 0x00000001000600a8 2D_01_AnimatedSprite`System.willUpdate(game=0x000060000330c460, input=0x000060000175c080, deltaTime=0.0280027911, self=0x0000600000246d80) at System.swift:31
    frame #8: 0x0000000100050bd0 2D_01_AnimatedSprite`ECSContext.shouldRenderAfterUpdate(deltaTime=0.0280027911, self=0x000060000290c380) at ECSContext.swift:251
    frame #9: 0x0000000100076c4c 2D_01_AnimatedSprite`closure #1 in Game.gameLoop(self=0x000060000330c460) at Game.swift:141
    frame #10: 0x0000000100077284 2D_01_AnimatedSprite`partial apply for closure #1 in Game.gameLoop() at <compiler-generated>:0
    frame #11: 0x000000010005d5fc 2D_01_AnimatedSprite`thunk for @escaping @callee_guaranteed @Sendable @async () -> (@out A) at <compiler-generated>:0
    frame #12: 0x000000010005dbd4 2D_01_AnimatedSprite`thunk for @escaping @callee_guaranteed @Sendable @async () -> (@out A)partial apply at <compiler-generated>:0

Similar crashes for all 3D demos, but rather with component Transform3Component:
GateEngine/Entity.swift:50: Assertion failed: Component "Transform3Component" is not a member of this entity.

Crashes occurred on simulator as well, so I'm hoping it's just an issue with the logic. Nonetheless here is machine details:
2021 MacBook Pro (M1 Pro chip)
macOS Ventura 13.5.1
Swift version 5.7.2
Xcode 14.2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.