Post

Replies

Boosts

Views

Activity

Does SpriteKit physics have a maximum velocity?
I am making a game with spriteKit that involves applying very large impulses to certain nodes. However throughout testing I have seen that some numbers seem to be too big. This lead me to dig around and I found that when I apply a very strong impulse, it will move the sprite forward at the correct velocity for one frame, before brining it down to a much smaller number. For example I would apply an impulse of one million and by the second frame the velocity is 300,000 For these tests I have turned off linear and angular dampening, made the SpriteNode indifferent to gravity and gave it a mass of zero. The line of code used to run the impulse is: ball.physicsBody?.applyImpulse(CGVector(dx: 0, dy: 100000000)) where "ball" is an SKSpriteNode, and 100000000 is an arbitrary large number. Running this and printing the velocity.dy per frame, I see the first frame is 100000000.0, as expected, but the following frames the velocity changes and stays at 35999.99609375, a seemingly random number. I am wondering how I can fix this, are there any hidden maximums to velocity I must change, or any further dampening settings I must change? All help is greatly appreciated! :)
7
0
850
Aug ’20
Removal of GKMatch sendData:toPlayers:dataMode:error: method
I am working on a game that involves gameCenter and by extension sending data with Game Center. Before iOS 14 betas began coming out, the GKMatch sendData:toPlayers:dataMode:error:  method worked great however, the console is now telling me that this method has been removed. This would not be a problem but it does not tell me what method to replace it with, and I am unable to find it anywhere in apple's developer documents. If anyone knows of a good replacement function so I can once again send and receive data, and have updated apps, that'd be much appreciated!
2
0
544
Jul ’20
matchmakerViewController:didFindMatch is not being called after accepting Invite
I am making a real time Game Center game, with GameKit as a new programmer, however I have run into a few road blocks. I am able to properly initialize the local player, present the matchmaking viewController, and receive and accept invites, however, even after I accept the invite  matchmakerViewController:didFindMatch  is not called and no match is returned to me. There is a high likelihood that I did not accept the invitation correct, but according to apples developer forums I have. If someone could review this code and let me know how to have that method be called that'd be great! let request = GKMatchRequest() class SecondScreenViewController : UIViewController, UINavigationControllerDelegate, GKMatchmakerViewControllerDelegate, GKLocalPlayerListener {     let button = UIButton()     let softRed = UIColor(red: 1, green: 61 / 255, blue: 61 / 255, alpha: 1)     let softblue = UIColor(red: 38 / 255, green: 149 / 255, blue: 1, alpha: 1)     let TestMatchMaker = GKMatchmaker()     let TestMatch = GKMatch()     var TestViewController = GKMatchmakerViewController(matchRequest: request)     var player = GKLocalPlayer.local     override func viewDidLoad() {         super.viewDidLoad()         player.register(self)         setupButton()         SetupRequest()         view.backgroundColor = softblue     }     func matchmakerViewControllerWasCancelled(_ viewController: GKMatchmakerViewController) {        dismiss(animated: true, completion: nil)         print("cancelled")     }     func matchmakerViewController(_ viewController: GKMatchmakerViewController, didFailWithError error: Error) {         print(error.localizedDescription + "THIS IS AN ERROR FROM THE VIEWCONTROLLER")     }     func matchmakerViewController(_ viewController: GKMatchmakerViewController, didFind match: GKMatch) {         print("Found Match Successfully")         let TestMatch = match         print(TestMatch)     }     func player(_ player: GKPlayer, didAccept invite: GKInvite) {         print(invite)         print("Aceppted Invite")         TestViewController?.setHostedPlayer(player, didConnect: true)     }     func player(_ player: GKPlayer, didRequestMatchWithRecipients recipientPlayers: [GKPlayer]) {         print("Requested Match")     }     func SetupRequest() {         request.minPlayers = 2         request.maxPlayers = 2         request.inviteMessage = "test Invite"     }     func setupButton() {          button.backgroundColor = UIColor.white          button.setTitleColor(softblue, for: .normal)          button.setTitle("MatchMake", for: .normal)          button.addTarget(self, action: #selector(ButtonTapped), for: .touchUpInside)          view.addSubview(button)          setupButtonConstraints()      }      func setupButtonConstraints() {          button.translatesAutoresizingMaskIntoConstraints = false          button.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 30).isActive = true          button.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -30).isActive = true          button.heightAnchor.constraint(equalToConstant: 100).isActive = true          button.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: 0).isActive = true      }      @objc func ButtonTapped() {         present(TestViewController!, animated: true, completion: {             self.TestViewController!.delegate = self})         TestViewController?.matchmakerDelegate = self      } }
0
0
349
Jul ’20
Methods “matchmakerViewControllerWasCancelled” and “matchmakerViewController” not being called inside of GKMatchmakerViewControllerDelegate
I am making a real time multiplayer game with swift, SpriteKit and most importantly GameKit, however I am fairly new to swift and swift UI. I have initialized my GKMatchmakerViewController  with a GKrequest , and believe that I have set that particular view controller's delegate to be the view controller it is inside of. Doing this required me to conform the larger view controller to the protocol of GKMatchmakerViewControllerDelegate  which gave me the functions matchmakerViewControllerWasCancelled  and matchmakerViewController:didFailWithError:  which should be called when either I cancel out of the matchmaking controller or it crashes with an error. My problem is that neither of these functions seem to be getting called unless I do it manually. I am not entirely sure if I have properly set the controller delegate, which I believe to be the root of the problem, however if anyone has any, more experienced, insight I would gladly appreciate it. The conforming View Controller's code is shown below. All help is appreciated! let request = GKMatchRequest() class SecondScreenViewController : UIViewController, UINavigationControllerDelegate, GKMatchmakerViewControllerDelegate { 		let button = UIButton() 		let softRed = UIColor(red: 1, green: 61 / 255, blue: 61 / 255, alpha: 1) 		let softblue = UIColor(red: 38 / 255, green: 149 / 255, blue: 1, alpha: 1) 		 		let TestMatchMaker = GKMatchmaker() 		let TestMatch = GKMatch() 		var TestViewController = GKMatchmakerViewController(matchRequest: request) 		override func viewDidLoad() { 				super.viewDidLoad() 				 				setupButton() 				SetupRequest() 				view.backgroundColor = softblue 		} 		 		func matchmakerViewControllerWasCancelled(_ viewController: GKMatchmakerViewController) { 			 dismiss(animated: true, completion: nil) 		} 		 		func matchmakerViewController(_ viewController: GKMatchmakerViewController, didFailWithError error: Error) { 				 		} 		 		func matchmakerViewController(_ viewController: GKMatchmakerViewController, didFind match: GKMatch) { 				print("yess") 		} 		 		func SetupRequest() { 				request.minPlayers = 2 				request.maxPlayers = 2 				request.inviteMessage = "test Invite" 		} 		 		func setupButton() { 				 button.backgroundColor = UIColor.white 				 button.setTitleColor(softblue, for: .normal) 				 button.setTitle("MatchMake", for: .normal) 				 button.addTarget(self, action: #selector(ButtonTapped), for: .touchUpInside) 				 				 view.addSubview(button) 				 setupButtonConstraints() 		 } 		 		 func setupButtonConstraints() { 				 button.translatesAutoresizingMaskIntoConstraints = false 				 button.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 30).isActive = true 				 button.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -30).isActive = true 				 button.heightAnchor.constraint(equalToConstant: 100).isActive = true 				 button.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: 0).isActive = true 				 		 } 		 		 @objc func ButtonTapped() { 				 				 				present(TestViewController!, animated: true, completion: nil) 				TestViewController!.delegate = self 				 		 } }
0
0
365
Jul ’20
Issues when loading Adds
I have made a game that when a button is clicked an Interstitial ad pops up, however whenever the button is clicked I get this in the terminal output: 2020-07-15 22:40:26.977714-0400 Pong - Remastered[560:35584] WF: _userSettingsForUser mobile: {   filterBlacklist =   (   );   filterWhitelist =   (   );   restrictWeb = 1;   useContentFilter = 0;   useContentFilterOverrides = 0;   whitelistEnabled = 0; } and then when I click out of it, I get the error message: 2020-07-15 22:40:27.591267-0400 Pong - Remastered[560:35772] [general] Connection to daemon was invalidated 2020-07-15 22:40:29.427685-0400 Pong - Remastered[560:35584] [ProcessSuspension] 0x1163de010 - ProcessAssertion::processAssertionWasInvalidated() 2020-07-15 22:40:29.427939-0400 Pong - Remastered[560:35584] [ProcessSuspension] 0x1163df5a0 - ProcessAssertion::processAssertionWasInvalidated() 2020-07-15 22:40:59.303123-0400 Pong - Remastered[560:35584] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service I do not know what either of these mean as I have not imported nor used WebView. I am relatively new to coding in swift and would like help for addressing these daunting messages! Thanks in advanced.
0
0
385
Jul ’20
Google AdMob ads not showing up in my app
I am developing an app, as of now it is not released to the app store, and I wanted to add a button to show an ad when clicked. I setup my account this morning, and got all the code setup. It worked completely fine with the test ads, but as soon as I replaced the test unit ID with the real one, it didn't show the ad. I read somewhere that my account needs to be verified but I have now received the verification email from google saying my account is certified but still no ad. If you need any additional details feel free to ask!
3
0
4.4k
Jul ’20
Local Multiplay Game recommendations
Over the past year, I have taught myself python stemming from a desire to make a multiplayer game for some of my friends. The process went fairly successfully as I learned the pygame framework and was able to make my game which involved two controllers playing off the same device. However, recently I wanted to branch out and make more sophisticated games in the same genre of local multiplayer. Over the past month, I have been becoming comfortable with swift and developing apps for Apple devices and after learning some basic syntax I feel confident enough to begin working on larger projects. However, I do not know good frameworks that allow me to make local multiplayer games with swift, (SpriteKit). So far I have learned of the Multi Peer connectivity framework, but as I dive deeper into it, it seems to be more geared towards sending data for UI based apps instead of games. I was wondering if any of you experienced folks have any more practical frameworks for building games. All suggestions would be appreciated!
2
0
747
Jul ’20
Showing Recent Issues Communication with Apple failed: Your maximum App ID limit has been reached. You may create up to 10 App IDs every 7 days.
I have been working on a few test project for the past while now as I learn swift. Today I was working with the Multi Peer Connectivity framework; something that requires me to have a copy of the app I am developing on my phone, when I went to run it on my phone, a fully updated iphone 11, it gave me the error listed above. It could be possible that I have created 10 apps over the past week, but I believe I have only downloaded around 4 or so onto my phone, while the rest have just been run on the simulator. As of now I am unable to download and run the app onto any device I own, however I can run it from the simulator. I am wondering if there is any work around to this issue so I can get back to development as soon as I can!
0
1
426
Jul ’20
Not seeing Cocoa framework when starting a newproject
I am fairly new to coding with swift and in xcode, so forgive me if there is a simple solution here, but I can't seem to find any of the cocoa resources. It is to my understanding that it is all native to the mac, yet when I create a new project in xcode, there is no option for Cocoa touch static library, or cocoa app or even cocoa framework. I am wondering how I may access these features and file formats? Any and all help is appreciated!
5
0
1.3k
Jul ’20