Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Hot answers tagged

19 votes
Accepted

Using L-Systems to procedurally generate cities

L-Systems, from what I can tell*, are a set of grammar-like substitution rules that you can apply recursively to get interesting, "organic" results. Plants are where L-Systems are often used, as they ...
user avatar
  • 14.5k
17 votes
Accepted

How do I create a simple RPG game server?

You're on the right track. The gist of the client-server networking model is that a server is that it's a central point of knowledge that clients connect to. A game server typically contains an in-...
user avatar
  • 13.3k
14 votes
Accepted

Why does Unity let you install iOS Build Support on Windows?

As far as i know when you build for IOS on windows it will generate an Xcode project that you then need to build on mac. As you can't make IOS bundles on windows the only thing you can do is to make ...
user avatar
  • 3,516
14 votes

Can you show rng code running in real time in a game?

Yes, you can. There are already online platforms that are doing exactly that, by providing you the hash of the online secret key that is used as the seed for the random generation. Same seed = same ...
user avatar
  • 2,305
10 votes
Accepted

How to implement color changing fragment shader?

Here's how I would do this. First, make sure you have the object's UVs or world coords (which you can pass through from your vertex shader) available to you. If it's just a background, you could also ...
user avatar
10 votes

Train-like movement in a 2D game

I'm not used to Cocos2D engine, but I can suggest this solution for you to apply to your game. Naive implementation The simplest way to implement a train wagon can be making an object which follows a ...
user avatar
  • 3,914
8 votes
Accepted

How do I pixelate a scene with SceneKit and Metal, in Swift?

I don't think this is going to be quite as easy as you'd like, that said you should be able to copy/paste the code below to get something going. There might be a better way to approach this, but as I ...
user avatar
  • 231
6 votes
Accepted

How to detect collision on specific part of the sprite node

Remember that SpriteKit's physics system is based on "SKPhysicsBody"s, which are added to "SKSpriteNode"s. Those physics bodies, however, needn't be attached to visible nodes. The simplest method is ...
user avatar
  • 2,169
6 votes

Cross-platform C++/OpenGL ES development (iOS/Android)

You may find my answer to a similar question here to be helpful. You may also find it helpful to look into the source code of other solutions. The Godot Engine for example is a cross platform open ...
user avatar
6 votes

Should I patent game before putting it on Apple App Store?

You can't patent a game. You might pattern a particular algorithm but it's unlikely to be of benefit to you to do so because of a couple reasons. Patents are highly specific. I was worried I was ...
user avatar
  • 965
5 votes
Accepted

How to get the complete width of SKSpriteNode which has many child nodes

To get the complete bounding rectangle of a node and its child nodes you use the calculateAccumulatedFrame method. It's a member of SKNode. I ran into this when ...
user avatar
5 votes

Does SpriteKit follow the MVC pattern?

Your question is a good one. I've had exactly the same question regarding SpriteKit and have been very confused about the lack of information on the web about this. SpriteKit seems to encourage you ...
user avatar
4 votes
Accepted

difference between cocos2d-x vs cocos2d-js

It's quite simple actually: cocos2d javascript is the join up of cocos2d-x's JSB and cocos2d html5. It's just a name given to that mix up. JSB is a set of Javascript native function overwrites that, ...
user avatar
4 votes

Offset a camera/render without changing perspective

Wow that was fast. It's crazy how sometimes just writing out the question helps you figure out how to approach a solution. Here is my matrixPerspective function: ...
user avatar
  • 1,891
4 votes

Android game to iOS, go with an engine?

There is no simple way to convert your java code into Unity, unfortunately. You are going to have to convert the entire code base into either C# or Javascript. Even the way you do your scenes are ...
user avatar
  • 8,279
4 votes

How do I know when the app is launched, loses focus and gets focus again on mobile?

The following snippet calls EnterApplication() and ExitApplication(), for you to implement yourself. It works in Editor, on Android, and on iOS, consistently. The methods are called when the ...
user avatar
  • 5,171
3 votes

What units does Sprite Kit use for physics?

They actually do specify it: All values in Sprite Kit are specified using the International System of Units (SI units). Gravity and velocity are both meters per second. (Though gravity ought to be ...
user avatar
  • 141
3 votes

Approaches for a clickable map of nations (such as a Risk game) with Spritekit

(A) If you need the countries to be sprites I would try this: Make the sprite for each country just big enough to contain them Make a UIBezierPath for each country and save that as a property of the ...
user avatar
  • 131
3 votes

How can I get almost pixel perfect collision detection in a multiplayer game?

Networking for games is hard. Valve knows this and have shared details on how they do it for games like Counter Strike. You should do the following: Perform collision detection on both the server ...
user avatar
  • 312
3 votes
Accepted

iOS Sprite Kit - Blend Mode Effect

Wrapping the SKEmitterNode in an SKEffectNode allows the EmitterNode to be rendered into a framebuffer which is subsequently rendered onto the screen. I tested this out (after much push and pull of ...
user avatar
  • 2,169
3 votes

Simulating Smartphones on PC with Unity

Unity Remote exists for this purpose. Quoting their description: Unity Remote is an application that allows you to use your target device as a remote control for your project in Unity editor. ...
user avatar
  • 15.6k
3 votes
Accepted

Total Texture memory size iOS / OpenGL ES

On iOS it seems that you are asking for trouble when the total memory usage for your app starts approaching half of the device's total memory (1gb for iPhone 5). But there's not a completely hard ...
user avatar
3 votes

model view projection multiplication order

It depends on the implementation of the multiply operation. The internals will suppose an ordering within your matrices, row major or column major. If the ordering of your matrices is arranged the way ...
user avatar
  • 2,343
3 votes
Accepted

Finding neighboring coordinates on offset tile map

If I understood you correctly, you only want to know whether two tiles, specified by their 2D offset coordinates, are adjacent or not. For any question related to hexagon grids, I'd recommend to ...
user avatar
  • 673
3 votes
Accepted

How to make a joystick follow the touch around a starting point using atan2?

You're only getting angles in the top-right quadrant because you're taking the absolute value of dy & dx. The sign information is important for determining what quadrant atan2 should return. What ...
user avatar
  • 113k

Only top scored, non community-wiki answers of a minimum length are eligible