game-engine

Alternative for quad-nested unordered_map monstrosity?

回眸只為那壹抹淺笑 提交于 2019-12-10 19:03:44
问题 I've been trying out to figure an effective way to store and retrieve a number of objects. Let me explain what I'm trying to achieve, then list the options I've come up with ( But am unhappy with ). The following technically does what I need it to do, but is an obvious no-no: std::unordered_map<uint32_t, std::unordered_map<uint32_t, std::unordered_map<uint32_t, std::unordered_map<uint32_t, Component*>>>> //Scene -> Layer -> Type -> Id -> Component* The most inner map holds the Components

Gap between SKSpriteNodes in SpriteKit collision detection

点点圈 提交于 2019-12-10 16:55:01
问题 I've been trying to figure this out for quite a while now -- I have a game with simple platformer physics where a player falls onto a block, which stops him from falling. This works, however there is a noticeable gap between where the player stops, and where the actual object/spritenode is. Here is a screenshot, it should be self-explanatory: class GameScene: SKScene { override init(){ super.init(size: UIScreen.mainScreen().bounds.size) self.physicsWorld.gravity = CGVector(dx: 0, dy: -9.8) }

What technology should I use to write my game? [closed]

老子叫甜甜 提交于 2019-12-10 14:29:48
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I have a great idea for a 3D network game, and I've concluded that it is possible to write it in Java as an applet which will live

Box2D AndEngine: app hangs out when creating Joints during ContactListener?

…衆ロ難τιáo~ 提交于 2019-12-10 11:33:00
问题 I am using Box2D in AndEngine (for Android). My purpose is to create a Force joint whenever 2 objects collide with each other. When I try to create a Mouse Joint between 2 objects (bodies) during ContactListner process. The application will hang for some time then exit, without any error, just a notification of threads ending. The Joint creating is OK when I call mEnvironment.CreateForceJoint(..) outside the ContactListener - somewhere while app is running in some physics.UpdateHandler().

Thoughts about rendering loop strategies

江枫思渺然 提交于 2019-12-10 11:16:47
问题 I know that hundreds of variations of these considerations have been posted all over the net. However, I haven't found anything that adresses my exact problem, so I hope you can help me see the light. I'm currently toying with 2D game development in Java using OpenGL. The language and graphics library used is not that relevant to my question though as it has a more general character. I'm attempting to design a general purpose game loop which can be used more or less as is for any game that

How to write solid Pure Aggregation (composition) Game Objects in Java?

左心房为你撑大大i 提交于 2019-12-10 02:52:22
问题 So I am just at the beginning of writing a game in Java and I am writing my game objects. Now I have read here in Evolve Your Hierarchy that you should build your games as compositions and not as a big class hierarchy. As this image from the previous link shows: However, when actually getting down to the implementation I have one small question about where to apply the interfaces. Lets say you have a class called Player and the interfaces Moveable and Renderable. Do you implement this using

How to safely decouple rendering from updating the model?

风流意气都作罢 提交于 2019-12-09 16:02:26
问题 Talking with some game developers, they suggested that a performant OpenGL ES based game engine does not handle everything on the main thread. This allows the game engine to perform better on devices with multiple CPU cores. They said that I could decouple updates from rendering. So if I understood this correct, a game engine run loop can work like this: Setup a CADisplayLink which calls a render method. render method renders current world model in background. render method then calls update

AABB collision resolution slipping sides

ⅰ亾dé卋堺 提交于 2019-12-08 17:33:59
问题 So, I am currently reinventing the wheel (and learning a lot) by trying my hand at making a simple physics engine for my game engine. I have been searching the internet, trying (and failing) to fix my current problem. There are a lot of resources out there on the subject, but none of those that I have found seem to apply to my case. THE PROBLEM IN SHORT: The collision resolution does not work as intended on some of the corners when two rectangles are colliding. How it fails varies based on

How to set up libdgx with IntelliJ?

╄→尐↘猪︶ㄣ 提交于 2019-12-08 17:32:09
问题 I followed this tutorial but it seems that it is kind out of date? I'm not sure. Unfortunately I'm not very experienced with Java (but with C#, Python, ..) so maybe there is something obvious I did not regard. IntelliJ is giving me import errors for libraries from the com.badlogic.gdx package import com.badlogic.gdx.ApplicationAdapter; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch;

Connect 4 Java Win Conditions check [duplicate]

拥有回忆 提交于 2019-12-08 12:50:30
问题 This question already has answers here : Connect 4 check for a win algorithm (5 answers) Closed 3 years ago . I have programming assignment where a 2D board game needs to made. The game I am trying to make is a connect 4 game. The problem I have is that I can't seem to get the win conditions to work. Does anybody have any recommendations. I am still relatively new in programming so I am sorry if it is a simple fix. Here is my Code: import java.io.*; import java.net.*; class C4GameSession