Tag Info

Hot answers tagged

1

That is right idea for reading/writing images but you'll want to get your "ImageLoader" class from a library, which will then give you a regular bitmap in memory to work with. The layout of that bitmap class is going to depend on the library you use. To see why, or what you need to handle if you want to write your own, see the W3C PNG Specification.


1

How many milliseconds since Jan 1 1970? About 1425579436439. That's more than fits in a integer. You need to use a long.


1

The issue is the else condition after you check the A and D keys, since if no key is pressed it will reset the direction to 0, 0 every time the update() method is called. Instead of calling moveLeft() and moveRight() in the touchDown and touchUp you should keep track of each pointer passed by the touchDown and touchUp methods and check whether the pointers ...


1

Yes, you'd essentially create a bridge - no wrapper - but that's terminology. The basic idea is to use two network connections. You've got one listen port that will act to the actual game as if it was the actual game server. The bridge will also establish a connection to the real server and pretend to be the actual game client. The rest is pretty ...


1

If you're also working with box2D, you could try box2Dlights, it's a pretty nice wrapper and it's easy to implement as well.


1

There are ways to do dynamic lighting without shaders, although they're usually not as efficient. They often involve raycasting. The link below has some links to useful resources regarding dynamic lighting. http://www.java-gaming.org/topics/2d-dynamic-lighting/27012/view.html


1

Game states can be synchronised by sending "deltas"—messages that describe how to get from one game state to the next, rather than sending the whole state. You seem to have figured out that this is possible. To get you started on the right path of thinking, here's a more concrete (but naïve) way that could be implemented: In server code, store a boolean ...


1

Crashing? Does not make sense. You can send a lot of data nowadays. There is no reason using a lot of bandwidth would crash a properly implemented client. If it is literally crashing, you may need to debug some more. What to send: You don't need to send everything. Remember the client program is only used (normally): To accept input from the user, parse ...


1

NPC on a path only need to be sends periodically. However instead of only the position you also send the speed and direction the NPC is going. That you only need to send the data a few times a second and the client can extrapolate the current position of the NPC. Health should only be sent when it updates and once every few seconds as a sanity update.


1

A simple approach might be to first resolve the movement in the X axis and after that in the Y axis. This way you'll always know which component of the movement caused the collision, and you can resolve the collision for that component without even having to touch the other one. For instance: This will make sure we don't pull movement out of nowhere. Keep ...



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