Background:
This is a question asking for a good example of SpriteKit from a very new iOS developer who is investigating for starting an iOS 2D game project.
As I explored in the official apple development doc, to dev a 2D game SpriteKit is the very framework I am looking for.
There have been some clear and succinct words for any API and class documented in the reference spec when I started a project in Xcode. However I haven't been able to finish the project as having no any general idea about what is always needed of a typical game using the framework.
Question:
As an experienced Java Spring programmer I believe that I am needed a brief example to get started with the SpriteKit framework which provides me an idea of necessary steps for a 2D game.
Delve into the world of graphics and game development. Discuss creating stunning visuals, optimizing game mechanics, and share resources for game developers.
Post
Replies
Boosts
Views
Activity
Hi everyone,
This happens with Xcode 15.3 (15E204a) and visionOS 1.1.2 (21O231).
To reproduce this issue, simply create a new VisionOS app with Metal (see below).
Then simply change the following piece of code in Renderer.swift:
func renderFrame() {
[...]
// Set the clear color red channel to 1.0 instead of 0.0.
renderPassDescriptor.colorAttachments[0].clearColor = MTLClearColor(red: 1.0, green: 0.0, blue: 0.0, alpha: 0.0)
[...]
}
On the simulator it works as expected while on device it will show a black background with red jagged edges (see below).
When developing a VisionPro application, I need to first move and then rotate the Entity in RealityView.
How can these two animations be executed sequentially? (I tested it and executing it simultaneously would result in incorrect animation positions)
Working on a vision OS app. I've noticed that even when castsShadow is false, performance goes down the drain when there are more than a few dozen entities that have GroundingShadowComponent. I managed to hard crash the Vision Pro with about 200 or so entities that each had two ModelEntities with GroundingShadowComponent attached but set to castShadows = false.
My solution is to add and remove the GroundingShadowComponent from entities as needed, but I thought maybe someone at Apple might want to look into this. I don't expect great performance with that many entities casting shadows, but I'd think turning the shadow off would effectively disable the component and not incur a performance penalty.
I use ScreenCaptureKit, CoreVideo, CoreImage, CoreMedia frameworks to capture screenshots on macOS 14.0 and higher.
Example of creating CGImageRef:
CVImageBufferRef cvImageBufferRef = ..;
CIImage* temporaryImage = [CIImage imageWithCVPixelBuffer:cvImageBufferRef];
CIContext* temporaryContext = [CIContext context];
CGImageRef imageRef = [temporaryContext createCGImage:temporaryImage
fromRect:CGRectMake(0, 0,
CVPixelBufferGetWidth(cvImageBufferRef),
CVPixelBufferGetHeight(cvImageBufferRef))];
I have the next results of profiling with XCode Instruments Memory Leaks & Allocations:
there is constantly increasing memory usage, but no memory leaks are detected, and there are many calls to create IOSurface objects, that have been never released.
The most part of memory - All Anonymous VM - VM: IOSurface.
The heaviest stack trace:
[RPIOSurfaceObject initWithCoder:]
[IOSurface initWithMachPort:]
IOSurfaceClientLookupFromMachPort
I don't have any of IOSurface objects created by myself. There are low-level calls to it. In Allocation List I can see many allocations of IOSurface objects, but there are no info about releasing it.
Due to this info, how can I release them to avoid permanent increasing memory consumption?
Hey everyone,
My game got rejected due to Guideline 4.3. Here's the gameplay video:
https://www.youtube.com/watch?v=Vb6uBUsOSDg
Does anyone have experience dealing with Guideline 4.3 and can share some insights?
I already appealed, explaining that my game has online multiplayer battles, but no response yet.
Feeling frustrated after spending six months on this game.
Any advice or suggestions would be appreciated. Thanks!
Hi all, I am trying to measure the performce of my video game in iOS platform.
After launching the debugger and caputre GPU workload (with "frame" selected as scope), I can not do performance profiling. The error message is: "Failed to enable shader profiler. (516)".
And if I export the GPU trace and reopen it, the Xcode can not find any compatible devices connected. However, the same device used for capturing is connected.
Device informations are:
Mac device: MacBook Air M2, 2022
Mac OS version: Sonoma 14.4
XCode version: 15.2 (15C500b)
mobile device: iPhone 13 Pro Max
iOS version: 15.0
GPU performance counter can be performed using the same mobile device in my colleague's Mac. So I think there might be something wrong with my Xcode.
Looking for info on the best way to convert a MTLTexture to SKTexture.
I am migrating a project where a SpriteKit scene is rendered in an SKView - and relies heavily on SKView.texture(from: SKNode) API
I am trying to migrate to an SKRenderer based SpriteKit scene - and wondering the best way to grab an SKTexture from an SKNode when rendered in a MTKView instead of SKView?
when i install game porting toolkit 1.1 ,i got an error as below:
Error: Failure while executing; patch -g 0 -f -p0 exited with 2
==> Installing game-porting-toolkit from apple/apple
==> Staging /Users/***/Library/Caches/Homebrew/downloads/bf215bb93a68251243c69e19a3ba0d670aa82daad63a2bfe24d7ff0a11c2c969--crossover-sources-24.0.2.tar.gz in /private/tmp/game-porting-toolkit-20240520-35139-asrgp4
==> Patching
Error: Failure while executing; patch -g 0 -f -p0 exited with 2. Here's the output:
patching file 'wine/include/distversion.h'
patching file 'wine/configure
guys who knows how to fix it?
when i installed Game porting toolkit 1.1, i got an error such as below:
error: assignment to 'DWORD64' {aka 'long long unsigned int'} from 'PVOID' {aka 'void *'} makes integer from pointer without a cast [-Wint-conversion]
anybody who knows how to solve it
I get a crash every time I try to swap this texture for a drawable queue.
I have a DrawableQueue leftQueue created on the main thread, and I invoke this block on the main thread. Scene.usda contains a reference to a model cinema. It crashes on the line with the replace().
if let shaderMaterial = try? await ShaderGraphMaterial(named: "/Root/cinema/_materials/Screen", from: "Scene.usda", in: theaterBundle) {
if let imageParam = shaderMaterial.getParameter(name: "image"), case let .textureResource(imageTexture) = imageParam {
imageTexture.replace(withDrawables: leftQueue)
}
}
One weird thing, the imageParam has an invalid value when it crashes.
imageParam RealityFoundation.MaterialParameters.Value <invalid> (0x0)
Here is the stack trace is:
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x9)
frame #0: 0x0000000191569734 libobjc.A.dylib`objc_release + 8
frame #1: 0x00000001cb9e5134 CoreRE`re::SharedPtr<re::internal::AssetReference>::reset(re::internal::AssetReference*) + 64
frame #2: 0x00000001cba77cf0 CoreRE`re::AssetHandle::operator=(re::AssetHandle const&) + 36
frame #3: 0x00000001ccc84d14 CoreRE`RETextureAssetReplaceDrawableQueue + 228
frame #4: 0x00000001acf9bbcc RealityFoundation`RealityKit.TextureResource.replace(withDrawables: RealityKit.TextureResource.DrawableQueue) -> () + 164
* frame #5: 0x00000001006d361c Screenlit`TheaterView.setupMaterial(self=Screenlit.TheaterView @ 0x000000011e2b7a30) at TheaterView.swift:245:74
frame #6: 0x00000001006e0848 Screenlit`closure #1 in closure #1 in closure #1 in closure #1 in TheaterView.body.getter(self=Screenlit.TheaterView @ 0x000000011e2b7a30) at TheaterView.swift:487
frame #7: 0x00000001006f1658 Screenlit`partial apply for closure #1 in closure #1 in closure #1 in closure #1 in TheaterView.body.getter at <compiler-generated>:0
frame #8: 0x00000001004fb7d8 Screenlit`thunk for @escaping @callee_guaranteed @Sendable @async () -> (@out τ_0_0) at <compiler-generated>:0
frame #9: 0x0000000100500bd4 Screenlit`partial apply for thunk for @escaping @callee_guaranteed @Sendable @async () -> (@out τ_0_0) at <compiler-generated>:0
Dear all,
I have several scenes, each with it’s own camera at different positions. The scenes will be loaded with transitions.
If I set the pointOfView in every Scene to the scene-camera, the transitions don’t work properly. The active scene View switches to the position of the camera of the scene, which is fading in.
If I comment the pointOfView out, the transitions works fine, but the following error message appears:
Error: camera node already has an authoring node - skip
Has someone an idea to fix this?
Many Thanks,
Ray
Does anyone know what this might be?
/private/tmp/game-porting-toolkit-20240516-2293-dagdsr/wine/dlls/wow64cpu/cpu.c:356:18: error: assignment to 'DWORD64' {aka 'long long unsigned int'} from 'PVOID' {aka 'void '} makes integer from pointer without a cast [-Wint-conversion]
356 | context->Rsp = NtCurrentTeb()->TlsSlots[2]; / WOW64_TLS_WINEHYBRID_RESERVED_R14 */
| ^
make: *** [dlls/wow64cpu/cpu.cross.o] Error 1
make: *** Waiting for unfinished jobs....
Path: /usr/local/Homebrew/Library/Taps/apple/homebrew-apple/Formula/game-porting-toolkit.rb
==> Configuration
HOMEBREW_VERSION: 4.3.0
ORIGIN: https://github.com/Homebrew/brew
HEAD: 8378cc825d83acffd125fb0fec041793df378a57
Last commit: 3 days ago
Core tap JSON: 17 May 05:28 UTC
Core cask tap JSON: 17 May 05:28 UTC
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 10
Homebrew Ruby: 3.1.4 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: 10-core 64-bit westmere
Clang: 15.0.0 build 1500
Git: 2.39.3 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 8.4.0 => /usr/bin/curl
macOS: 14.4.1-x86_64
CLT: 15.1.0.0.1.1700200546
Xcode: 15.1 => /Users/raiderpig/Downloads/Xcode.app/Contents/Developer
Rosetta 2: true
Hi,
in this WebGPU example: https://skal65535.github.io/curl/index_bug_safari.html
the lighting is wrong compared to Chrome's reference version.
I narrowed the problem to the uniform value 'params.specular' at line 515 not being equal to the expected value 1.2f. The value is set a line at line 1078 in the uniform buffer.
Platform: MacBook M1 Pro Sonoma 14.4.1 (23E224)
Safari Technology Preview: Release 194 (Safari 17.4, WebKit 19619.1.11.111.2)
Works ok with Chrome 124.0.6367.156 (Official Build) (arm64).
Hi,
I am developing Cordova apps/games with in-app purchase products as well as an initial product as non-paid (Free) tier: New users will be able to play freely for a set of games as default at the beginning. Then, if they would like to have more games with different set of attributes or themes, they can add more games with in-app purchases. It is similar to a game called Subway Surfers in App Store I would play in the past.
A new player initiates games as Free Tier. After, let us say 3 games, the user is asked if he/she would like to have more games to play with different scenes/themes in different Tiers, in addition to their disposal: Tier 1, Tier 2 and Tier 3. For example Tier 1 adds 3 more games into the Free Tier games so they can play 6 games in the set;Tier 2 add 6 more games and so 9 games they can play and so on. Each individual game in their set is a variant of others in differing Tiers. If they don't wish and play Free Tier games, they may play them too, with limited set of themes but infinite times.
If a user chooses a tier, let us say Tier 1, and when they play 6 games, they are asked if they would like advance to Tier 2 or Tier 3. If they choose Tier 2, as they complete the respective games they will be asked for Tier 3. However, if they don't wish to advance, again they can play current Tier games as many times as they wish.
It is like non-subscription apps then converted to subscription-based ones. In App Store Connect, I created a number of products for in-app purchases for an app.
How I can deliver this Free Tier games in the app and let users try it and allow them to choose in-app purchase products available in AppStore Connect.
I would appreciate response and support.
Best
Lexxyacc
I am trying to build a website where I would like to render the USDZ 3D model on the browser without the AR feature. The user should be able to interact with the 3D model using a pointing device (mouse). If the user wants to see the 3D model in AR she/he can do so by loading the page on a compatible device where the 3D model can be projected in AR.
I am looking for an answer to how to display the USDZ 3D model on the browser without the AR feature.
I want to transfer this video stream to another device and then view it on the other device. But I did not see any development information related to the camera by checking the VisionOS documentation information, so I would like to ask if anyone knows how to do it?
Thank you.
I'm creating a full immersive app of a large 3d environment in which I need to be able to move the player with different options like, hand gestures, game controller and teleporting.
I have worked with unreal engine in which moving the player is easy and well documented. But I have not been able to find any information on how I could achieve this in visionOS.
Has anyone done something similar that could give me some advice or sample code?
any help appreciated
Guillermo
I have a unity scene which i have created for vision pro and i have also created a biomatric authentication application for vision os using Xcode and swift. What i want to do is call unity scene after the authentication has taken place form the xcode. now i have seen medium post but it only shows how we can do that for apps, I am not bale to do that for vision Pro
I have followed this post : https://medium.com/mop-developers/launch-a-unity-game-from-a-swiftui-ios-app-11a5652ce476
All this i am doing because as far as i know Apple vision pro is not currently supporting optic id authentication with unity's polyspatial plugin.
Any help on this will be appreciated.
Thank you in advace.
Hi,
Since iOS 17, when setting weight on a SCNMorpher, the normals become completely wrong. As you can see below it only happens when there are vertices along an edge.
Has anyone encountered that problem and found a solution?
Thanks
Reported: FB13798652