Which server platform to choose I'm going to write a server for an online multiplayer with these requirements Pretty simple turn based game (think a card game) that is played entirely on the server (security reasons) Must be able to run multiple games (tables) with 4 players per table, but no lobby system required (another server takes care of that) Can support as many players at once as possible Might need multiple servers Chat between players Socket connection to a Flash AIR client Must be able to communicate with other servers (for player accounts and such) Now, I'm considering two options Smartfox (or equivalent) A custom Java solution in something like Tomcat Why Smartfox? It handles multiple rooms and chat natively It presumably has solutions for well known multiplayer gaming issues Why custom? Smartfox has many unneeded functions, bad for performance Smartfox communicates with an XML based format, I could use a more efficient binary one. Don't know if running the entire game model on the server is convenient with Smartfox' extension mechanism Multiple rooms and chat are easy to reimplement Tomcat or a lightweight container is easier to deploy than Smartfox Better IDE support for developing on Tomcat (automatic deploy, etc) What do you think? Are my assumptions correct? Do you have anything to add? What option should I choose (or maybe a different one entirely)?


Game synchronisation in peer to peer online multiplayer game I am developing an online real time multiplayer game using Google Play Game Service and Cocos2D X. The game has two players where each player control their own ball. The each player sends their own ball s velocity and position to the other connected device. In my game, all the physics calculations are done locally on each devices i.e. ball velocities after physical calculations are calculated locally on each devices. Issue When fast moving ball collides wth the opponent s ball, there is no change in the movement velocity of the opponent s ball. (According to real world physics, the fast moving ball should be able to push the opponent s slowly moving ball.) Reason During my code analysis, I understood that the velocity calculated by the local physics engine are overwritten by the data received from the opponent s device. For e.g. Solution I tried To fix the problem, whenever the collision between balls occurs I am creating one of the device as server and other device as client. All the physics calculations occurs on the server device and data is send to the client device. I have following questions Is the solution tried by me is optimal solution to fix the issue? What other approaches can be tried to fix such type of issue? I would appreciate any suggestions thoughts on this topic. Thank you.


Unity 5 Networking Send Rate Send Rate is Zero but server movement is still happening I have a client server scenario, just a player moving about on the client and he moves about on the server using the built in networking provided in Unity 5. I have my client scene running in the editor and was playing about with the Network Transform Script Values, more specifically the Network Send Rate. Setting this Value to 29 (its highest) the movement on the server is almost smooth. Setting this value to 1 and the movement on the server is very laggy as I expected. However, if I set the network send rate to 0 on the client, I expected it not to move at all on the server, but it moves and alot smoother than the value 29. Why is it, that when the network send rate is set to 0 that my character still moves on the server?


udp over cellular networks? I'm starting to build a multiplayer iOS game using UDP. I want the game to be playable over cellular networks, but I can't really find that much information on it. Many people say that it's dependent on your carrier whether or not it will work. I tried searching but I can't really find much info on this topic. I know carriers must allow UDP because of things like video streaming, but what about custom game protocols? Will UDP work over a cellular network? If anyone has a definitive answer or can point me to some resources that'd be great


How do network applications get around firewalls? Forgive me if this comes off as naive I've only a cursory understanding of network communications. My work has a public and very restrictive network (they appear to block everything that isn't approved) and yet I've seen people accessing many games (World of Warcraft for example). I don't imagine that the network admins made any explicit exceptions for these applications but when I tried to develop a networked prototype with services like 'Photon Server' or 'Adobe's RTMFP' they all fail from the office due to the network restrictions (can't establish connection). Is there some kind of work around that applications like WoW employ that distinguish them from an anonymous networked app I've built myself? (Some kind of fallback channel maybe?) I appreciate that there might not be enough information here for an answer, but any insights would be welcome. Thank you!


How can I implement a game locator or proxy server? I have a turn based strategy game which already has a multiplayer server client layer that works fine on local network (where one server is set up and players connect to it). I would like to extend this architecture to allow players to play via Internet, but I don't want to have a dedicated game server for that, especially due to performance issues. The game's AI is runs on the game server of course, and multiple games with computer players would "kill" the machine. I would like to have some kind of "central connection point" server that does not run the game logic, state or AI but can be used by players to find servers hosted by other players. How can I implement this?


What is the impact of many AI enemies on state replication networking? Imagine an online coop style FPS or TDS game where say 2 6 real players fought large amounts (20 60 concurrent) of AI enemies. Could this style of game be reasonably networked over the internet using a Quake or Tribes style partial state replication model? Almost every coop game I know of uses a lockstep style networking in these cases (even games like Halo which use state replication for normal multiplayer, but lockstep for coop firefight). My concern is that the network download (for clients) and upload (for server) overhead of each AI would end up being about the same as if a real player was in the game. Is this a real concern? Or is the limiting factor on the number of players more about how much data the players upload? TLDR Can large numbers of AIs be reasonably networked to a few players with a partial state replication model or is lockstep the only real solution. Any help here would be great!


How to make my multiplayer Air Hockey better? I've made simple multiplayer web game but don't like how it works. Here's a video example (captured at 85 avg ping) showing what I have. What I used Super naive client prediction called so because there is no reconciliation most of the time players' strikers can't be moved by anything except players themselves Interpolation (it's turned off on the attached video because at the current state of the game in combination with prediction it made things look worse. Without prediction input lag is unacceptably big) I've read some valve wiki articles, Gambetta's articles and some other not so popular sources, which helped to understand general ideas, but I still lack understanding on how to combine various techniques of minimizing delays for players and some implementation details. So here are the questions What is the best way to sync time on client and server and when to start clocks? I should measure average ping and then what? Server sends notifications to clients 'start clocking in X ms' based on ping? Should they even start clocking at the same time? How to improve user experience for my game? I guess I should probably use extrapolation for puck Is interpolation even needed with 60 tickrate for anything with 60 or lower hz screens? I'm not aiming at e sports level experience and would rather make it feel nicer for 60 hz phone screens


Is there a pattern for writing a turn based server communicating with n clients over sockets? I'm working on a generic game server that manages games for an arbitrary number of TCP socket networked clients playing a game. I have a 'design' hacked together with duct tape that is working, but seems both fragile and inflexible. Is there a well established pattern for how to write client server communication that is robust and flexible? (If not, how would you improve what I have below?) Roughly I have this While setting up a game the server has one thread for each player socket handling synchronous requests from a client and responses from the server. Once the game is going, however, all threads except for one sleep, and that thread cycles through all players one at a time communicating about their move (in reversed request response). Here's a diagram of what I have currently click for larger readable version, or 66kB PDF. Problems It requires players to respond exactly in turn with exactly the right message. (I suppose I could let each player respond with random crap and only move on once they give me a valid move.) It does not allow players to talk to the server unless it's their turn. (I could have the server send them update about other players, but not process an asynchronous request.) Final requirements Performance is not paramount. This will mostly be used for non realtime games, and mostly for pitting AIs against each other, not twitchy humans. The game play will always be turn based (even if at a very high resolution). Each player always gets one move processed before all other players get a turn. The implementation of the server happens to be in Ruby, if that makes a difference.


Client Server Multiplayer Project I have reviewed the relevant WinForms XNA samples here and here. However, my requirements are slightly different. Given the following I am developing a multiplayer (Client Server) game There will be three projects in the solution, one for Client and Server respectively, plus an additional one containing the core game engine The instances will share common code from this engine project (core Game Engine functionality) I require the Server instance to also allow management of the server (e.g. connection list etc.) via a Windows Form Finally, and importantly, I am proposing to use the Dependency Injection pattern on initialisation of the client server instances to inject the relevant network management class as required similar to the approach here What is the best way to achieve this? Specifically, are there any flaws with organising the projects in the solution the way I have proposed above? For the Server project, do I start it as an XNA project and then call the Winform, or vice versa? Thank you for any advice you can spare. Edit a brief example of the "dependency injection" style pattern I plan to use. Forgive me if this is not an example of "pure" full traditional DI! Create the server using (var game new ExampleGame(new ServerNetworkManager())) game.Run() Create the client using (var game new ExampleGame(new ClientNetworkManager())) game.Run()


How do I avoid users hacking my network games from the client side? I've decided to make an online game the server sends packets of information to the client application, which is going to simulate what it gets from the server. The client makes a part of the design of the game, and sends the new state back to the server for processing. The clients can send fake information to the server, and inform the server that I've done the task successfully, without trying. Assume a Counter Strike game the client may send a fake packet to the server and tell the server that I've defeated someone. How can I avoid this violation?


What is better? Lots of small TCP packets, or one long one? I am sending quite a bit of data to and from a server, for a game I'm making. I currently send location data like this sendToClient((("UID " cl.uid " x " cl.x))) sendToClient((("UID " cl.uid " y " cl.y))) sendToClient((("UID " cl.uid " z " cl.z))) Obviously it is sending the respective X, Y, and Z values. Would it be more efficient to send data like this? sendToClient((("UID " cl.uid " " cl.x " " cl.y " " cl.z)))


NavMesh LoS and "Containing" For a gameserver backend, I have a navmesh for "walkable" areas in form of points triangles. Now I want to check every gametick if the client is still in a legit place and if he shots casts a spell, if his target is in line of sight. I found several possibilities, but I am not sure what is performance wise ideal. To check if the player is still in the allowed area (and not wallhacking) I would check if his position is in one of the triangles with a algorithm using barycentric coordinates like this https github.com SebLague Gamedev Maths blob master PointInTriangle.cs But this would mean that every gametick I have to check soooo much triangles. To check if its LoS I could either check if the line from the player to its target crosses one of the "border" lines of the mesh (which have no other triangle next to it). Those border lines could be computed at bake time and are just a static list for each level. But still it would be a lot lines per check. Second option I found would be to start a Simple Stupid Funnel Algorithm (http digestingduck.blogspot.com 2010 03 simple stupid funnel algorithm.html) until LoS is broken. The questions now are How does a good gameserver handle this can it be optimised? What way to check is the best fastest? Is it common to only check if the position is legit every now and then or every gametick? The Levels are fairly simple ( 300 mesh triangles, 200 border lines, 10 players, 10 npcs maybe)


Networking How does server fixed timestep work? I'm making a server client model for a top down 2d shooter. Because I need to calculate collisions with walls amp other players using a small delta, I want to use the fixed timestep model like in this example https gafferongames.com post fix your timestep . Apparently this is a common approach for network games. Right now my model looks something like this Client connects and is synced to the current server tick (let's say tick is 50) Client sends its first input the time pressed (local tick 50) to the server Server receives the message at tick 55. Because the message was for tick 50 which has passed, this request is ignored. As I understand it, the client and server run at the same rate, but because of latency the client sends messages too late and all get ignored. Am I supposed to let the server run a few ticks behind the client somehow? How do I resolve this? EDIT No, this is not a duplicate of that question. What OP is asking in his topic is how to account for lag visually from other players. The answer is mostly you can't, but you can smooth it out with entity interpolation. My dilemma is that I can't figure out how to process inputs at all server side using a fixed timestep model. I assume the client sends timestamps which are processed when the server reaches that same frame, but if client server are always frame synced, that means all messages are from the past and are ignored. If I allowed the server to accept a past input anyway it would have to implement it immediately instead of the original frame it was meant for, which would result in inaccuracy. I'll make it real clear If a client sends an input at tick 4 but it reaches the server at tick 7, how does the server go back and process an input meant for tick 4?


Should I ping for a TCP based game? I have a head to head game where two players communicate through a server based on TCP. I am planning to implement a ping pong mechanism in order to detect network disconnection situations. For example, A pings B every 500ms. If A receives no response from B, A shall consider B is disconnected. If A receives no response from the server, A shall consider A is disconnected itself. Do you think this ping pong system is needed or other method is recommended?


How to hide a MMORPG backend server from the internet? I want to create a network where the main servers IP is never exposed to the client. By going throught tunnels. Here is a sample http dl.dropbox.com u 12304631 eliteots mc network.jpg Problem By making tunnels through dedicated servers I hope to solve latency issues from some clients that are far away from the main server. But even if this does not succeed, I wish to hide my main server to avoid network attacks directly against it. So the main server only communicates with the tunnel hosts, which then communicates with the clients. So by creating several tunnels I will be able to let customers easily access the main server by switching tunnel if their preferred tunnel is currently under attack. This is not my problem, should be easy to program, however the network configurations between tunnel and main server is the issue because of my lack of experience in this area. Requirements I am not talking about a simple http proxy, I want this to solution to operate on all ports. Or at least the configured ports. Only transmitting TCP. I do not wish any encryption on the traffic between the vpn and main server, I think it should be as fast as possible. I am working on an MMORPG, which is why I put so much effort into learning this. The worst thing that can happen to a customer is to be kicked from game server unable to login to finish their needs. I only operate in an linux environment server based. (Debian Ubuntu). Solution idea I heard having an openVPN server might be what I need. But I have problems operating it, I find it quite complex. First off, I want to know, is this even possible in OpenVPN? If so, how should I configure the network logics? I am open to try out any free solutions you may find recommend me!


Tips for communication between JS browser game and node.js server? I am tinkering around with some simple Canvas based cave flyer game and I would like to make it multiplayer eventually. The plan is to use Node.js on the server side. The data sent over would consists of position of each player, direction, velocity and such. The player movements are simple force physics, so I should be able to extrapolate movements before next update from server. Any tips or best practices on the communications side? I guess web sockets are the way to go. Should I send information in every pass of the game loop or with specified intervals? Also, I don't mind if it doesn't work with older browsers.


Character appearance synchronization in open world multiplayer game I am working on a multiplayer open world game where you can equip handhelds and armor pieces. In my architecture, there are clients and an authoritative server. Every equipable item is crafted by a user. They can be different in shape, so it's important that I synchronize shape information. This is expensive data to send (basically an outline plus some more info). Together with this, I also want to synchronize any equipment event that occurs, so when a user meets another user, they can see each other's gear. The easiest solution I've found is to force send gear on equipment, but it will use bandwidth even when two players are far away. This feels like a problem that has been solved a thousand times, so I don't want to reinvent the wheel. Do you know of any best practice known strategy that suits my situation?


How do I make a turn based game for two players who play with different devices on iOS? I only have experience in physics based games in cocos2d. I want to develop a turn based game in Cocoa Touch (iOS). Two players will play this game on different devices which connect via Bluetooth or Game Center. I'd like to know how to synchronise two devices through a Bluetooth connection. Please tell me of any blog tutorial, guide, or sample code which will help.


Game clock Synchronization in python I am working on a network game project in python which we want to keep synchronized. I would assume we should use Network Time Protocol to cater for different levels of lag. That being the case, is there an implementation for Network Time Protocol in python?


MMO Client Server Spoofing Vulnerabilities Ive created a working authoritative client server system using LiteNetLib for my game however im wondering if packet sniffing modification is a real worry i should be developing for. I read some information that other Client sniffing the packets of another client is pretty much impossible since the packets are routed through their ISP. Therefore should i only worry about the client causing problems for the server, instead of also worrying about clients causing problems for other clients? Currently im encrypting every packet sent by the client including movement commands such as 'move left'. My idea is that this will make packet sniffing fail, packet modification fail, and packet spoofing fail. If i remove my encryption doesn't that mean someone can spoof a packet by changing the packet source in the header? (thus sending game commands for another client moving another player!). Usually when its encrypted i know that only the client with the secret key could have sent it, thus validating the packet source. I see everyone saying that people shouldn't encrypt general traffic like this, but whats the truth here! Whats the best way?


Why do games have different ports for different maps? A little old example for that would be Metin2, this is the only game I know which have that, but there may be more. In Metin2 there are maps which are accessable through other ports. I'm not a network specialist, but I think then it is needed to connect to an other port on an map change. So would it not be possible todo all that on one port? Are there any benefits from that? Could it be that there is a limit on port connections on a server, that this would be something for loadbalancing?


Why do games use tick rates in their networking and servers instead of an event system? Why do most games limit themselves with a tick rate in their networking? Isn't it better to make something like an even system where for example client A does something then the client sends related info to the server, and same for the server when something happens on it it sends a packet to the client, instead of using a tick rate and sending information only at some specific frequency. Is it cheaper faster to send more data in a single packet or? And the same question goes for server tick rates, some servers limit themselves on specific tick rate frequencies, why do they do that? Why not just make a loop and run each tick after each other instead of having a gap between them or risking one tick to take longer than it should and causing bugs? What's the benefit of the tick rate approach for servers and for networking?


game server client user input event handling I'm currently getting my feet wet in the realm of networking, so I set a goal to make a simple client server game using SFML for both graphics and networking. In my head it seemed easy at first, but the more I got into it the more questions arised. I didn't want to make a post before I hadn't done any research, but now, having read many blog posts and articles, there's nothing to lose. The game I'm working on is a trivial PONG game server waits for 2 players, when they are connected, clients send server paddle's X position only if mouse is moved. Server reads in the X pos. and sends each client opponent's position. The problematic part is opponent's behaviour on the client side. When playing both clients server on my computer, using 100 CPU speed server side, the opponent moves smooth, but having CPU running as fast as it can is nonsense! If I reduce update speed the movement becomes weird so to say. Might there be anything to do with client side prediction (I read about it too, but didn't quite grasp how it would be implemented)? Since there are frequent position changes, should the server's update speed be as high as possible? I'm using TCP, which I understand is "reliable" no lost packets. For such fast paced game like PONG, which protocol is more suitable. Now, I do not fully understand the magic behind it all, very very thrilled about network programming. I've never been more excited during programming as I am dealing with networking. Thank you for your attention!


Game Maker picking the wrong network adapter for broadcast In my game I need to get the local network IP of the computer that is running the game, and for that purpose I have the following code Create event randomize() var random port irandom range(49152,65535) host network create server(network socket udp, random port, 5) if ( host lt 0 ) show message("Failed to create a broadcast server") game end() else var tsock network create socket(network socket udp) var tbuff buffer create(32, buffer fixed, 1) buffer fill(tbuff, 0, buffer bool, 0, 32) network send broadcast(tsock, random port, tbuff, buffer get size(tbuff)) network destroy(tsock) buffer delete(tbuff) Async network event global.game ip string(async load ? "ip" ) instance destroy() I've manually set up my local network IP to be 192.168.1.150, but when I run the code above, I get the IP 169.254.51.115. Because I wasn't expecting such IP, I ran the ipconfig all command (on Windows) and I got the following output (I've translated the output because my computer is in another language, and I've deleted the information that isn't relevant to this) Ethernet adapter Specific dns for this connection. . Home Description . . . . . . . . . . . . . . . Realtek PCIe GBE Family Controller ... IPv4 address. . . . . . . . . . . . . . 192.168.1.150(Preferred) Subnet Mask . . . . . . . . . . . . 255.255.255.0 Default gateway . . . . . 192.168.1.1 DHCP server . . . . . . . . . . . . . . 192.168.1.1 DNS Servers. . . . . . . . . . . . . . fe80 1 13 1.1.1.1 1.0.0.1 Ethernet Npcap Loopback Adapter Specific dns for this connection. . Description . . . . . . . . . . . . . . . Npcap Loopback Adapter IPv4 automatic configuration address 169.254.51.115(Preferred) Subnet mask . . . . . . . . . . . . 255.255.0.0 Default gateway . . . . . DNS Servers. . . . . . . . . . . . . . fec0 0 0 ffff 1 1 fec0 0 0 ffff 2 1 fec0 0 0 ffff 3 1 So, from my understanding point of view, Game Maker is getting the Ethernet Npcap Loopback Adapter instead of the regular ethernet adapter. I could delete the Npcap Loopback adapter, but what if a user has wifi and ethernet connection? Is there a way for Game Maker to choose one or another adapter? In case the previous answer is no, is there a workaround for this to avoid getting the Npcap loopback adatper?


Turn based card game multiplayer http polling or TCP I am working on card games for mobile devices. For multiplayer I will be communicating through a central server. For the purpose I sorted out three options HTTP polling TCP Websocket (client libraries are not good, so will not use it) HTTP polling is simple, but I fear it will introduce much more delay and too many HTTP calls. TCP introduces other complications. So my question is Is HTTP polling appropriate for a card game? Will the HTTP overhead be too much? How much interval should I keep for polling? Can you give a sample game based on HTTP polling?


Executing commands at the exact same time on 2 or more computers I have an RTS game, with deterministic simulation, but if I want multiplayer to actually work, I need commands sent between computers to be executed at the exact same time. My game's networking is just sending commands between the players' computers, and the simulator executes the commands in order, which, hopefully, will result in each player seeing the exact same game. However, if the commands aren't executed at the EXACT same time, then the simulation will become out of step and everything will be wrong. How could I do this, and are there other ways to make sure everything is in sync?


Sending changes to a terrain heightmap over UDP This is a more conceptual, thinking out loud question than a technical one. I have a 3D heightmapped terrain as part of a multiplayer RTS that I would like to terraform over a network. The terraforming will be done by units within the gameworld the player will paint a "target heightmap" that they'd like the current terrain to resemble and units will deform towards that on their own (a la Perimeter). Given my terrain is 257x257 vertices, the naive approach of sending heights when they change will flood the bandwidth very quickly updating a quarter of the terrain every second will hit 66kB s. This is clearly way too much. My next thought was to move to a brush based system, where you send e.g. the centre of a circle, its radius, and some function defining the influence of the brush from the centre going outwards. But even with reliable UDP the "start" and "stop" messages could still be delayed. I guess I could compare timestamps and compensate for this, although it'd likely mean that clients would deform verts too much on their local simulations and then have to smooth them back to the correct heights. I could also send absolute vert heights in the "start" and "stop" messages to guarantee correct data on the clients. Alternatively I could treat brushes in a similar way to units, and do the standard position velocity client side prediction jazz on them, with the added stipulation that they deform terrain within a certain radius around them. The server could then intermittently do a pass and send (a subset of) recently updated verts to clients as and when there's bandwidth to spare. Any other suggestions, or indications that I'm on the right (or wrong!) track with any of these ideas would be greatly appreciated.


Adding multiplayer to an HTML5 game I am interested in making a game that I currently have a co op experience, however I'm curious as to the best method of implementing this in HTML5. I have made games before using straight C sockets, and also with the Net library for SDL. What are some of my best options for doing this in a canvas based environment? At present, all I can come up with are either AJAX database solutions (with a high refresh rate), or somehow implementing a PHP server that would funnel the data through sockets. The overall gameplay would be a 2.5D platformer ish type of game, so both clients would need to be continually updated with player positions, enemy positions, projectiles, environmental data, etc.


Which game logic should run when doing prediction for PNP state updates We are writing a multiplayer game, where each game client (player) is responsible for sending state updates regarding its "owned" objects to other players. Each message that arrives to other (remote) clients is processed as such Figure out when the message was sent. Create a diff between NOW and that time. Run game specific logic to bring the received state to "current" time. I am wondering which sort of logic should execute as part of step 3 ? Our game is composed of a physical update (position, speed, acceleration, etc) and many other components that can update an object's state and occur regularly (locally). There's a trade off here Getting the new state quickly or remaining "faithful" to the true state representation and executing the whole thing to predict the "true" state when receiving state updates from remote clients. Which one is recommended to be used? and why?


Does it make sense to use both TCP and UDP at once? After reading Is UDP still better than TCP for data heavy realtime games?, I'm wondering if it makes sense to use both TCP and UDP at the same time, but for different things TCP for sending information that is sent infrequently, but should be guaranteed to arrive reliably. Such as score updates, a player's name, or even the on off state of a light in the game world. UDP for transmitting information that is updated constantly and can be lost occasionally, since newer information is always on the way. Such as position, rotation, etc. Is this a reasonable idea? What are the possible drawbacks? Are there better ways to handle this?


NavMesh LoS and "Containing" For a gameserver backend, I have a navmesh for "walkable" areas in form of points triangles. Now I want to check every gametick if the client is still in a legit place and if he shots casts a spell, if his target is in line of sight. I found several possibilities, but I am not sure what is performance wise ideal. To check if the player is still in the allowed area (and not wallhacking) I would check if his position is in one of the triangles with a algorithm using barycentric coordinates like this https github.com SebLague Gamedev Maths blob master PointInTriangle.cs But this would mean that every gametick I have to check soooo much triangles. To check if its LoS I could either check if the line from the player to its target crosses one of the "border" lines of the mesh (which have no other triangle next to it). Those border lines could be computed at bake time and are just a static list for each level. But still it would be a lot lines per check. Second option I found would be to start a Simple Stupid Funnel Algorithm (http digestingduck.blogspot.com 2010 03 simple stupid funnel algorithm.html) until LoS is broken. The questions now are How does a good gameserver handle this can it be optimised? What way to check is the best fastest? Is it common to only check if the position is legit every now and then or every gametick? The Levels are fairly simple ( 300 mesh triangles, 200 border lines, 10 players, 10 npcs maybe)


Client and server loops don't match up I'm trying to build a small networked game using WebGL and NodeJS. I have a basic client and server setup and I'm at the point where I'm trying to implement dead reckoning to simulate what happens on the client. I have a odd problem which I'm not really sure how to fix, the game loops for my client and server don't seem to match up and the client one always seems to be faster. I'm hosting my server on the same system as my client right now and I'm logging every frame for the two. If I log it for longer than 5seconds the server starts to get behind by 10 20 frames and the gap just gets bigger and bigger over time. There isn't really anymore processing that is happening on the server than on the client at the moment because I'm working with a really basic example right now. My loop for both right now look something like this var loopDelay 16.666666666666666666666666666667 function loop() setTimeout(function() update() loop() , loopDelay) On the client I did have something like this function loop() setTimeout(function() update() requestAnimationFrame(loop) draw() , loopDelay) But I removed it and copied the server one temporarily when I started running into this problem to make sure it wasn't that. What can I do to make the two sync up perfectly? Thanks


Movement networking for a Worms like game I want to implement a strategy artillery game, similar to Worms Arcanists. As game development (and game networking especially) is new to me, I was wondering whether this would be a good performant way to do the movement networking Server has all client's positions. Moving client to server Message start moving, moving direction Server now starts a simulation of the moving client moving. Server to all clients, except originating one, every 100ms(?) Message set client position client id, new position new position calculated by the server's simulation Clients lerp the moving client's position. Moving client to server Message stop moving server's simulation ends Server to all clients, including originating one Message set client position client id, final position all clients have the same position for the moving client in the end


In a 2D multiplayer game should I send the position of user to the server all the time? In a 2D game where the user moves with the keyboard arrows, should the user send all the time he moves his position (x, y)?. If the user has some speed, the user would send (x, y) like 50 times pixel by pixel in just a second.


Implementing game synchronization between clients and server I'm creating a small online multiplayer game where I have multiple thin clients and an authoritative server. Both the client and the server have a fixed game loop. Now I have a game entity with the following properties X position float Y position float Direction float In the client, the entity is in constant velocity changing its direction based on user input and sends an input event to the server. LEFT, PRESSED Entity moves to the left LEFT, RELEASED Entity moves to the right Every event is queued on the server, and simulated the same way as on the client (calculating the new properties based on trigonometric functions) and the event is send to other players in the room. The other players apply the same simulation to that particular entity (keeping track of what key is pressed for each entity). Now after some time playing, the position and direction start to drift and stop being in sync. I suspect this has to do with floating point arithmetic(?) Is this implementation correct, rather than sending its position and direction every step? How would I solve this problem? I think I need to make the server the single source of truth and send regular state snapshots to the the clients to correct possible mistakes drifting? What would be a good interval to keep the clients up to date? At the moment, I'm broadcasting an event to every player in the room. What would be a nice approach to only send events to players near the entity? Would a quadtree work here (the same I'm using for my collision detection)?


Handling packet impersonating in client server model online game I am designing a server client model game library engine. How do I, and should I even bother to handle frequent update packet possible impersonating? In my current design anyone could copy a packet from someone else and modify it to execute any non critical action for another client. I am currently compressing all datagrams so that adds just a tad of security. Edit One way I thought about was to send a unique "key" to the verified client every x time and then the client has to add that to all of it's update packets until a new key is sent. Edit2 I should have mentioned that I am not concerned about whether the actions described in the packet are available to the client at the time, this is all checked by the server which I thought was obvious. I am only concerned about someone sending packets for another client.


How do I efficiently send RTS unit selections over the network? I have a multiplayer RTS game with every unit assigned an ID. How can I efficiently send across a network the units selected by a player? For example, Starcraft 2 has upwards of 200 units per player and each player can select a maximum of 255 units at a time. How can I implement such a system with reasonably low response time and bandwidth? Should I bother sending IDs? Should I perhaps send a bitmask with each bit defining whether each unit is selected?


How can I detect disconnected clients in a peer to peer network of this topology? I'm working on my first multiplayer game (RTS genre) and for the networking model, I'm leaning more towards a peer to peer model as opposed to a client server model. I want my game to be able to handle a large number of users concurrently (around 50 100 users) in a reasonable manner. I've come up with a proof of concept that can achieve moderate speed and moderate load balancing across the network. For it to work, one of the peers has to be designated as a central authority (i.e. the host). The host then receives updates from users through a star topology and then broadcasts the changes to other users through a tree topology, as below This type of network has one big problem churn. I'm having trouble figuring out how to deal with users that disconnect from the network. If nothing is done for them, all of that user's children (and descendants) will lose connection. How can I detect disconnected nodes in a peer to peer network of my expected size and remove them without harming the other, still connected clients and without placing undue load on the designated host?


POST HttpRequest doesn't send any data I've some trouble for sending a post request to my nodejs server. I can receive data from the server with GET method, but when I try to send data with POST, I've an empty bracket on return on this function func on request completed(result, response code, headers, body) var json JSON.parse(body.get string from utf8()) print(json.result) print(response code) And empty bracket on my JSON console.log on the server too. My code extends CanvasLayer func ready() HTTPRequest.connect("request completed", self, " on request completed") func on Button pressed() var data "name" "Godette" make post request("http localhost 8080 ", data, false) func on request completed(result, response code, headers, body) var json JSON.parse(body.get string from utf8()) print(json.result) print(response code) func on HTTPRequest request completed() pass func make post request(url, data to send, use ssl) Convert data to json string var query JSON.print(data to send) Add 'Content Type' header var headers "Content Type application json" HTTPRequest.request(url, headers, false, HTTPClient.METHOD POST, query) And this code return this in my console 200 Thanks for help )


ecs network synchronization I'm working on implementing combat into my isometric rpg game which uses an ecs architecture. When synchronizing the actions of the different clients, is it preferable to serialize and synchronize raw components, actions or a mix of both. For example, an action might be quot entity X attacks entity Y quot , whereas the components approach would need to send stuff more like raw component state (which animation to play, frame, sound, etc). I currently use an action based approach for movements, and that works very well locally, but implementing combat this way seems more difficult as systems become more complex and components are added down the road, and I want to be as aware as I can about possible friction now.


How should I send packets to multiple clients on UDP? I'm developing a 2D action side scroller shoot em up game and I recently implemented the multiplayer aspect. When the server sends packets containing the game state (which are about 500 700 bytes) to a single client, the ping is around 32ms and it works smoothly, but the moment another client connects, both clients start to lag and the ping increases to 200ms and I am assuming that the problem lies with network congestion So my question is, should the server automatically send data to all clients simultaneously OR should the client ask the server for an update on the game world OR is there another method I do not know about? BTW I am using UDP protocol as I found TCP to be pretty slow after a certain amount of time in game.


Game networking, limiting amount of movement packets I have been developing a server client model for a game project I am working on. Everything works great, client side prediction works, server reconciliation works. Basically, the character can move smoothly without any hiccups. However, the problem is that I am currently not using frame independent movement, it doesn't rely on the elapsed time between updates. Every time a movement packet is received, it will move the character x amounts of pixels. The packets are gathered on the client with a certain rate. If someone were to modify the rate so that it would gather it faster, that means it would send more packets and make it move faster. Essentially, they would be speed hacking. How would I go about preventing this behavior. If I try to add frame independent movement, server reconciliation doesn't work any longer since it doesn't know how much to move it after the server correction was received. Is the best way to just limit how many movement packets that can be received server side per second? I have been reading the source networking article, but they do not mention anything about this as far as I can see. By the way, when I send these packets, I do not send them as they are gathered, rather I send them bunched together at another rate, to reduce bandwidth. Edit I think I was a little bit unclear about my packets. My packets contain user commands that holds the current state of the keyboard, mouse and whatever else is collected. The server receives the packet, which can hold MORE THAN 1 user command, as it sends the pakcets at a slower rate than the commands are collected. This is exactly what is described in the source networking article. The server receives the packet and handles ALL user commands as soon as it is received, thus if the packet contains a lot of user commands (the client modified the rate of which it collects them, or duplicated them) the server will move it more than intended. Modifying how often it sends the packets doesn't matter, but the gathering of the user commands does. Let's say the server sends the packets every 100ms, and collects the commands every 50ms. That means every packet will hold 2 user commands. But if someone modifies the collection rate to, say every 10ms. Every packet will contain 10 user commands which would move the character further since the server moves it for every user command.


Implementing The Command Pattern Undo And Entity References I am trying to implement a replay undo system for a turn based strategy game I am currently working on. A sample move could go as follows 1. A players select a pawn and gives it an attack command. 2. The attacked unit dies. 3. The dead unit is removed from the map and the controlling player. 4. The controlling player takes some damage. 5. The attacking unit gains a survivor strength power up for the remainder of the game. The rest of the game plays similarly to a Fire Emblem type game, but the point is a single command like attacking yields multiple effects to various game entities. Eventually I want to make the game networked, but for now everything is local play. After doing some research, I came across several resources discussing the command pattern and feel it is the solution to my replay and undo system. I ended up using an interface similar to https gamedev.stackexchange.com a 37684 41499 but I am confused on some of the implementation details. Do I make commands to update each component of my game separately (i.e. AtkUnitCmd, RmvUnitFromMapCmd, RmvUnitFromPlayerCmd, InflictPlayerDmgCmd, etc.) or should my AtkUnitCmd handle all updates of entity state internally? How do I handle dead units? I can store a reference to the dead unit, but this would likely need to change when networking is implemented as the object itself would not be transmitted over the network correct? Each command has some animation involved for example when a unit moves an animation needs to play. I may choose to skip the animations while other times leave them on. Do I bake the animations into the commands themselves or should I separate the animation code and call it somehow when the command is played? Any thoughts?


Securing a replay based leaderboard system (as much as possible) A few years ago, I implemented a basic online leaderboard system in one of my games that sent encrypted score data over the wire. The encryption keys were stored in the game client's binary. Of course, the leaderboards got hacked the same day they were released. I have now released a new game on Steam, and I've worked hard to implement fully deterministic game logic and a replay system. The replay system works by simply replaying the user's input that was recorded in a previous playthrough. The fully deterministic game logic ensures that the replay will work on any machine, independently of the game's FPS. Now, it is time for me to implement online leaderboards. My idea is to create a server version of the game executable which receives replay files over the network, replays them on some remote machine, and adds the score to a database if the replay data is valid. While this prevents cheaters from simply sending a fake score to the server, it opens up many other cheating avenues, including Tool assisted creation of replays, either by slowing down the game speed or by manually crafting a replay file after reverse engineering its format (the game is open source). Taking someone else's replay and sending it over the network, changing data regarding who the replay belongs to. I could somehow encrypt and compress the replay data before sending it over (or saving it on the user's local machine), but since the game is open source, it would be easy to reverse engineer the encrypted replay format. What is a good way of securing a replay based online leaderboard system? One possible idea I had is to have the server generate an encryption key token for a specific user which is only valid for a small amount of time, send it over to the client, and only accept replays that are encrypted with that key. This would prevent users from uploading older replays to the server, but in theory it should work am I missing something?


Network protocol for chat UDP or TCP I'm trying to develop a fast paced multiplayer game. Now I'm using UDP as a transport layer protocol to communicate between clients and server. But what if I want to implement a chat? Should I send chat messages via UDP as well (with re sending and other TCP like stuff) or should I use another TCP socket for such purposes? Which one is the best practice?


Kryonet Open a server locally only On the game I'm working on I wanted the singleplayer mode to use an integrated server to make adding more players via networking easier. The way I have it right now is I open a server and connects the client to my local address which works fine. But the problem is that if I play the game Singleplayer I don't want to leave anything exposed to the internet while only playing locally. Is there any way to limit the "range" of the server to only let communication happen via LAN? Thanks in advance! EDIT I am using kryonet for networking. The game is written with LibGDX.


Unity 5 Networking Send Rate Send Rate is Zero but server movement is still happening I have a client server scenario, just a player moving about on the client and he moves about on the server using the built in networking provided in Unity 5. I have my client scene running in the editor and was playing about with the Network Transform Script Values, more specifically the Network Send Rate. Setting this Value to 29 (its highest) the movement on the server is almost smooth. Setting this value to 1 and the movement on the server is very laggy as I expected. However, if I set the network send rate to 0 on the client, I expected it not to move at all on the server, but it moves and alot smoother than the value 29. Why is it, that when the network send rate is set to 0 that my character still moves on the server?


Client Server Multiplayer Project I have reviewed the relevant WinForms XNA samples here and here. However, my requirements are slightly different. Given the following I am developing a multiplayer (Client Server) game There will be three projects in the solution, one for Client and Server respectively, plus an additional one containing the core game engine The instances will share common code from this engine project (core Game Engine functionality) I require the Server instance to also allow management of the server (e.g. connection list etc.) via a Windows Form Finally, and importantly, I am proposing to use the Dependency Injection pattern on initialisation of the client server instances to inject the relevant network management class as required similar to the approach here What is the best way to achieve this? Specifically, are there any flaws with organising the projects in the solution the way I have proposed above? For the Server project, do I start it as an XNA project and then call the Winform, or vice versa? Thank you for any advice you can spare. Edit a brief example of the "dependency injection" style pattern I plan to use. Forgive me if this is not an example of "pure" full traditional DI! Create the server using (var game new ExampleGame(new ServerNetworkManager())) game.Run() Create the client using (var game new ExampleGame(new ClientNetworkManager())) game.Run()


Do UDP game clients servers block for receive calls? One way to implement a client server relationship is to have the server simulate the whole game based on the clients input and send updates back to each client, while the client is is simulating the game for the player and sending back input and game state messages that the server can use to process the whole state of the game. My question is, since a ReceiveFrom() call blocks till it receives data and a Select() call blocks for a set period of time, does that mean all clients and servers block for a certain amount of time each frame? I am aware that a call to Select() can be set to zero which would be an effective poll to the read write states of the current sockets, but wouldn't you miss out on new data if it comes in just microseconds later? How is this problem solved now a days? Pro select() method handling? Asynchronously? Separate thread completely? Other? I may be over thinking this, but I would like to know more information so I can write an effective client sever relationship. Haywire


When doing network programming, is it always a good idea to optimize packet size as much as possible? My question is relatively straightforward, but I haven't been able to find a concrete answer yet. I'm programming a real time networked multiplayer game, and I'm finding many examples of places where I could optimize packet size (i.e. minimize packet size) in small ways. As an example, one packet type stores player input (running, jumping, firing a weapon, etc.) along with an integer ID for that player. In practice, there will never be more than four players in a single game, meaning that ID could be represented with only two bits (four possible values) rather than the full 4 byte integer. My question is, should I send only those two bits across in a network message or just send the full integer? To clarify, I'm not referring to storing the ID in the main code itself. For that, I'm just using an int. I'm only curious about what I should be sending in a network packet. That's also just one example of a few I've run into. The reason I ask is that this feels like a "don't prematurely optimize" scenario. Ordinarily, I know to not worry about optimization (within reason) until I've run profilers, but I'm less familiar with networking than "normal" programming. Is it better to optimize packet size as much as possible, or would that be overkill? Thank you.


udp over cellular networks? I'm starting to build a multiplayer iOS game using UDP. I want the game to be playable over cellular networks, but I can't really find that much information on it. Many people say that it's dependent on your carrier whether or not it will work. I tried searching but I can't really find much info on this topic. I know carriers must allow UDP because of things like video streaming, but what about custom game protocols? Will UDP work over a cellular network? If anyone has a definitive answer or can point me to some resources that'd be great


How to determine mouse position outside stage, and center the cursor? I was wondering if it is possible to have my flash game determine the position of the mouse, even when the cursor is not inside the stage. My movie clip should move horizontally between x 100 and 500, using mouseX for movement private var previousX int private var mc MovieClip ... private function update(e Event null) void var deltaX int (mouseX previousX) 2 mc.x Math.min(Math.max(mc.x deltaX, 100), 500) previousX mouseX The above code works fine, as long as the cursor is above my flash game. When the cursor is outside the stage, mouseX stops updating. I realise that mouseX is probably not what I'm looking for, so I was wondering if there was any other way of finding the cursors position. I hoped there was a way to set the mouse position directly, so I could center it after every update, so it would almost never be able to leave the frame in the first place. Is that possible?


Stage3D Camera pans the whole screen I am trying to create a 2D Stage3D game where you can move the camera around the level in an RTS style. I thought about using Orthographic Matrix3D functions for this but when I try to scroll the whole "stage" also scrolls. This is the Camera code public function Camera2D(width int, height int, zoom Number 1) resize(width, height) zoom zoom public function resize(width Number, height Number) void width width height height projectionMatrix makeMatrix(0, width, 0, height) recalculate true protected function makeMatrix(left Number, right Number, top Number, bottom Number, zNear Number 0, zFar Number 1) Matrix3D return new Matrix3D(Vector. lt Number gt ( 2 (right left), 0, 0, 0, 0, 2 (top bottom), 0, 0, 0, 0, 1 (zFar zNear), 0, 0, 0, zNear (zNear zFar), 1 )) public function get viewMatrix() Matrix3D if ( recalculate) recalculate false viewMatrix.identity() viewMatrix.appendTranslation( width 2 x, height 2 y, 0) viewMatrix.appendScale( zoom, zoom, 1) renderMatrix.identity() renderMatrix.append( viewMatrix) renderMatrix.append( projectionMatrix) return renderMatrix And the camera is send directly to the GPU with c3d.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 0, cameraMatrix, true) And these are the shaders Vertex Shader m44 op, va0, vc0 mov v0, va1.xy mov v0.z, va0.z Fragment Shader tex ft0, v0, fs0 lt 2d,linear,nomip gt mov oc, ft1 Here is a example and here are two screenshots to show what I mean How do I only let the inside of the stage3D scroll and not the whole stage?


How to get quality sprite sheet generation with rotations I'm working on a game that uses sprite sheets with rotation for animations. While the effect is pretty good, the quality of the rotations is somewhat lacking. I exported a flash animation to png sequence and then used a C app to do matrix based rotations (System.Drawing.Drawing2D.Matrix). Unfortunately, there are several places where the image gets clipped. What would you suggest for a way to get high quality rotations from either flash or the exported PNGs? A circle should fit within the same image boundaries. I don't mind a new program that I must write or an existing program I must download buy.


Camera and enemy behaviour in AS3 platformer beginner in AS3 here. I am working on a platformer game based on the code of a provided example exercise. I have the following problem I have an enemy who shoots bullets. The enemy is the parent, and the bullet are the child. When I move to the next scene (level), the bullets are still there, but invisible, even using the removeEventListener to shut down the bullet hit check. Here is the code of the child "disparoEnemigo mov" addEventListener(Event.ENTER FRAME, fl MoveEnemyShot) function fl MoveEnemyShot(event Event) try if (enemy shot.y lt 300) if (enemy shot.hitTestObject(Object(this.parent).mario)) variablesGlobales.variables().vidas 1 Object(root).texto.text variablesGlobales.variables().vidas.toString() trace("vidas " variablesGlobales.variables().vidas) if (variablesGlobales.variables().vidas lt 1) MovieClip(this.parent).gotoAndStop(2) this.parent.removeChild(this) removeEventListener(Event.ENTER FRAME, fl MoveEnemyShot) else enemy shot.y 3 else trace("LLEGADA") removeEventListener(Event.ENTER FRAME, fl MoveEnemyShot) this.parent.removeChild(this) catch (error Error) removeEventListener(Event.ENTER FRAME, fl MoveEnemyShot) import flash.events.Event import flash.media.SoundMixer addEventListener(Event.ENTER FRAME, fl EnterFrameHandler) function fl EnterFrameHandler(event Event) void try if (this.hitTestObject(Object(this.parent).mario)) SoundMixer.stopAll() var sound gameOver new gameOver() sound.play() Object(this.parent).mario.y 1000 Object(this.parent).mario.x 15 trace("Mario dies") var cartel StageLose new StageLose() stage.addChild(cartel) cartel.x 85 Object(this.parent).mario.y 1000 catch(error Error) removeEventListener (Event.ENTER FRAME, fl EnterFrameHandler) And this is the code of the parent, "enemigo mov" var leftPressed Boolean true var rightPressed Boolean false stage.addEventListener(Event.ENTER FRAME, fl MoveEnemy) function fl MoveEnemy(event Event) try if (leftPressed) enemy1.x 0 if (enemy1.x lt 120) leftPressed false rightPressed true else if (rightPressed) enemy1.x 1 if (enemy1.x gt 120) rightPressed false leftPressed true var number Number Math.random() if (number lt 0.05) amp amp variablesGlobales.variables().coleccionEnemigos.indexOf(this) ! 1) trace("creation") var disparo disparoEnemigo mov new disparoEnemigo mov() this.parent.addChild(disparo) disparo.x enemy1.x 115 disparo.y enemy1.y 115 disparo.z 50 trace(disparo.x " " disparo.y) catch(error Error) removeEventListener(Event.ENTER FRAME, fl MoveEnemy) In both codes, "mario" is the player character. What I need to do is to stop the bullet creation of ""disparoEnemigo mov" when we move to the next scene. Shouldn't the "removeEventListener(Event.ENTER FRAME, fl MoveEnemy)" line stop the bullets to check if there is any collision with the player? Any help or resource will be helpful. Thank you so much!


How to implement Long Polling with PHP and flash? I'm trying to make a multiplayer game but am a newbie to server side programming except that I know a little PHP. I learnt about this technique called long polling where the server can wait for fresh data to be available and then send it. How does one do long polling using PHP? Are there any libraries available. I'm already using ZendAMF, so how do I make zendamf and long polling to co exist?


Flixel Is it possible to use a spritesheet for FlxButtonPlus? I'm trying to change the graphic on a FlxButtonPlus. I want to get the graphic from a spritesheet. However, if I try the ' regular' way (make an animation and play it), it refuses to use just the part of the spritesheet I want and instead insists on showing the complete spritesheet. Creator of the sprite public function ButtonSprite(c int) loadGraphic(ImgButtons, true, false, 30, 80) addAnimation("static", c ) play("static") How I try to add it to the button currentButton new FlxButtonPlus(30, 80, playLevel, 0 , "Unlimited", buttonWidth 3, buttonHeight) var sprite new ButtonSprite(1) currentButton.loadGraphic(sprite, sprite) Thanks!


What is the standard way of delivering HTML5 games to portals and such? Let me explain what I mean by "standard way of delivering"... Think about Flash games sites. Flash games can be delivered as a single file, either hosted by the site, or, I guess, provided by someone else. HTML5 games, on the other hand, don't have something so standard. Usually, they have their own page, and portals just link to that page. I think that it greatly hinders the purpose of that portal, because, well, you want people to stay on your site and look for other games. Now, I think that a some kind of iframe way of delivering games would help solve this problem greatly. I saw some games doing that, and they were often included on tutorial sites to show a live example, which is obviously a great thing. So, is there a standard at all? Any suggestions? Can you create a game that just preloads itself in an iframe (I heard something about a "single document" or something)?


As3 Flash How to check if a bitmapdata is completely set to transparent using an eraser? I'm trying to make a window cleaning game with flash as3 on the timeline. (Sounds boring I know, but I realy have some fun idea's with it) So I have A dirtywindow movieclip on the bottom layer and a clean window movieclip on layer 2(mc1) on the layer above. To hide the top layer(the dirty window) I assign a mask to it. this creates a mask that hides the movieclip on top var mask mc MovieClip new MovieClip() addChild(mask mc) assign the mask to the movieclip it should 'cover' mc1.mask mask mc With a brush(cursor) the player wipes of the dirt ( actualy setting the fill from the mask to transparent so the clean window appears) add event listeners for the 'brush' brush mc.addEventListener(MouseEvent.MOUSE DOWN,brushDown) brush mc.addEventListener(MouseEvent.MOUSE UP,brushUp) function to drag the brush over the mask function brushDown(dragging MouseEvent) void dragging.currentTarget.startDrag() MovieClip(dragging.currentTarget).addEventListener(Event.ENTER FRAME,erase) mask mc.graphics.moveTo(brush mc.x,brush mc.y) function to stop dragging the brush over the mask function brushUp(dragging MouseEvent) void dragging.currentTarget.stopDrag() MovieClip(dragging.currentTarget).removeEventListener(Event.ENTER FRAME,erase) fill the mask with transparant pixels so the movieclip turns visible function erase(e Event) void with(mask mc.graphics) beginFill(0x000000) drawRect(brush mc.x,brush mc.y,brush mc.width,brush mc.height) endFill() I hope you can help me with the following problem The game aspect of this should be the points the player get's for cleaning erasing all the dirt. Can anyone tell me how I can check if all pixels are set to transparency? So how to check if all the dirt has been erased? And than for example trace ("window cleaned") I tried the compare() function but didn't have much luck with it (...


Rendering performance for Flash games I was reading on SO about native flash rendering vs building a custom BitmapData frame buffer and some of the answers were a bit conflicting, so I was wondering Is it generally best practice to go the custom Bitmap buffer route or is it best to leave rendering to the flash engine? If you're using vector animations (MovieClips) as opposed to sprites, does that change the answer to the above? If so is it best practice to use sprite based animations? (I'm targeting Flash 10 if that makes any difference)


Is frustum culling necessary in a Flash AS3 game? I'm making a 2D game where the map will be scrolled frequently, and only a small part of it will be visible at any time. Which implementation would run faster? The naive way Make the map a single huge MovieClip and move it around. The elegant way Split the map into multiple chunks and use a frustum culling algorithm to render only the ones that are visible. Now that I think of it, this question boils down to whether Flash does its own frustum culling on big MovieClips.


How to save the 3D surface to bitmap in Flash 11 Stage3D I have been using Stage3D to create some 3D app in Flash. One of the items on my list is the ability to take a screen shot. Flash makes it easy to grab the stage content, but I can't find a way to grab the stage3D content. In DX I just used D3DXSaveSurfaceToFile. Anyone know of a way to do it in as3 and flash 11?


Make colour change depending on time I'm making a Flash game (ActionScript 3) and for dynamics I'd like to make the background change colour depending on the clients' time of day. I have a rough idea on how I want to do this, At sunrise, I want the background to be yellow orange In the middle of the day, I want the background to be cyan clear sky colour At sunset, a reddish orange During the night, a navy blue. I will be using this method to change the colour of the symbol, which is at default a dark grey colour. (unless someone points out a better way to do this). This means I have access to the red, blue and green components of the background. On implementing the system itself I suppose I could simply get the client time and do if (hour gt 9) and (hour lt 18) colour SKY BLUE and similar for the other times of day, but I'd like it to tween slowly between colours as time progresses. For example, if 6AM is yellow orange and 9AM is blue, 7 30AM would be yellow moving towards blue. I have a feeling I need to come up with an algorithm to link time to the RGB components of the colour, but I've always been terrible at maths and I can't think of how to do this, so that's why I'm asking. Please tell me how I would do this, both concept outlining and sample code, or even just tips are welcome. )


Does swf provide better compress rate than zlib for png image? Somebody told me that when a png image is stored in swf, it's separated to several layer, hence the alpha channel can be compressed better. Is it true? Or, once png image is imported into a swf, it's format is changed, e.g converted into bitmap data, and than compressed by swf's compress algorithm. That's, it is not in png format anymore. I don't know how swf packing its resource, please tell me if you know.


Sprite sheets vs Sprites MovieClips in Flash We create 3D models in Maya2011 and create PNGs and import the bunch into Adobe Flash CS5 to create a sprite. I read somewhere that sprite sheets can save space over making the sprite in Flash. How big of a difference does it make? None of our art team has experience in creating sprite sheets. Is it worth learning it and adopt that workflow? How difficult is it? How much of a difference in file size can we achieve? Keeping size constraints apart, I see a draw back using sprite sheets I wont be able to create multiple combinations of loop animations using the same set of images. I can even create multiple sprites within the same SWF with our current workflow.


Flash AS3 Tower Defense Problem I am working on a tower defense game in Flash. Right now most towers find the the nearest enemy in range (enemies are in an array), get the enemies coordinates, and fire a bullet. When it hits the coordinates bullet.hitTestPoint(x, y) it damages the enemy. I want to design a tower that will shoot a bullet at the first enemy just like above, however, the bullet needs to go its max range and damage all enemies it hits along the way. I am having some trouble determining what enemies it is hitting. The best way I have come up with so far is when the bullet reaches its max range, I draw a line from that point back to my tower. Then I loop through the enemy array and use enemies i .hitTestObject(bulletLine) . If that returns true, it damages that enemy. This seems to work okay, but I would like something more realtime and sometimes it seems like this is hitting enemies it shouldn't hit.


Flash Memory usage is low but framerate keeps dropping So I'm working on a puzzle game in flash. For all intents and purposes it's like Tetris. I spawn blocks, they move around the screen, then they get destroyed and disappear. I was having some trouble with the memory usage being too high over time so I read up on memory management and I think I have that figured out now. It's definitely climbing slower than it was before, but the framerate is still taking a huge dive after playing for a while. If it's not a memory leak what else could be causing this? Thanks in advance.


Rotation of objects from different axes in Flash AS3 In my game, I have made 4 lines with different colors to form a square but the colored lines are different objects. I want to rotate the lines in a way that the lines will still form a square. Eg But I'm only able to rotate them on the central axis, so, it forms a cross The code for leftPressed is if(leftPressed) black.rotation 90 blue.rotation 90 yellow.rotation 90 red.rotation 90 So, I need to know how to rotate objects on different axes.


How to add a ramp in a flash game? I am a huge novice and this isn't really a programming question, but here I go, say I want to make a game that involves rolling up a ramp like this one to move upwards, similar to how it would work in an old Sonic the Hedgehog game or something, how would I go about doing that, where could I find a good recourse to learn this?


How to enable GPU for flash player 11? I just install Flash Player 11 and SDK 4.5 (hero), and test it with a small program. But I find it is still using "software" to simulate 3D API, and trace("driver info " context3D.driverInfo) output driver info Software I'm using windows 7, directX works properly, and option " swf version 13 use gpu" is already added in compiler arguments. Who can tell me how to enable GPU in Flash Builder? UPDATE context3d is constructed as private var context3D Context3D ... context3D stage3D.context3D And wmode is set to direct in html.


What implications does JIT (javascript canvas) vs. AOT (Flash) have in terms of browser based game performance? In my experience, even till this day, I still see more of a visual lag in entity movement animation in JavaScript (Canvas) based games than I do in Flash based games. Why is this what exactly is the descrepancy at the most basic level between an JIT vs AOT compiler in the specific scenario of JavaScript vs. Flash.


Where should I host my flash games? I'm looking at hosting my flash game on a site like Kongregate or NewGrounds, but with so many choices, I'm left wondering what are the pros amp cons of the various options? I'm interested in Reaching the biggest audience Making some money (eg. I know that Kongregate shares ad revenue) Other features benefits of the site (eg integration APIs for high scores, micro payments, etc)


Host Migration (P2P) with RTMFP and AS3 I was wondering if this is a possibility with RTMFP since it acts like UDP P2P.. Host Migration Player A starts and host a game.. Player B and C connects.. Player A quits.. Player B is now assigned as new host server Game not interrupted or disconnected. Maybe some basic example on how this is done with RTMFP AS3?


Movie clip in a button changes on hover I have a button for my game which has a MovieClip in it. It consists of an image of a lock and an image of an item, representing the item being locked and unlocked. I make the button become slightly smaller when the mouse is over it to create the effect of a button slightly down. For some reason, however, this makes the MovieClip in the button go to the next frame. I have no Actionscript code in the button or any frame except stop() on the first frame of the MovieClip, so I really don't understand why this would happen. It only goes to the next frame when I hover my mouse over the button and then quickly goes back to the first frame (since there's no stop() in the second frame). After experimenting with stop() in both frames of the movie clip, it does indeed only happen when my mouse enters the button. Leaving the button doesn't do anything and the button left alone doesn't do anything. It just changes the frame when I hover my cursor over it. There's absolutely no script involved aside from stop() in the first frame of the movie clip in the button. What could be the cause of this problem?


Increasing height increases width I have a game, where the user presses a button to spend money and increase the height of a Movie Clip. I use the following height . The problem When I test this out, it seems the width increases, too. The actual thickness, you could say. How can I solve this?


How public should you make your betas? I am approaching the point where I can release a playable beta of a very complex game I am making in Flash AS3. It is fairly involved and the deepest game Ive made so far. I plan on hosting it on my personal site but I want to try and get good feedback on the game elements so far. Is it worth it to expose this beta to as many places as possible before the release? What are good communities to do this? Please note this will be freeware in its final release


Stencyl or flash limitation? I have found that Stencyl doesn't seem to be very good at handling very many actors in a game. I had been trying to implement some basic AI at the moment all the behaviours were wander (pick a random point and move directly to it) and wrap around screen (if it goes off the top of the screen it appears at the bottom). Even with these simple behaviours and calculations the frame rate dropped dramatically when there were more then 50 actors on screen 10 actors 60fps 50 actors 30 50fps 75 actors 30fps 100 actors 15 20fps 200 actors 8 10fps I had planned on having a maximum of around 200 actors but I see that's no longer an option and implementing a more complicated AI system with flocking behaviour, looking at creating a game in a similar vein to flOw. I understand that a game is perfectly playable at 30fps but this is a super simple test with ultra simple graphics, no animations and no sounds is child's play in terms of calculations to be made. Is this a limitation with Stencyl or is it flash? Should I simply scale the scope of the game down or is there a better game engine that exports to .swf that I should look into?


Which better? Write all scripts on timeline or write it partially on .as file? I'm going to create a flash game. But I don't know which way for me to write my scripts. Is it better if I write script part by part and by object so every object has they own script .. or write all of those object's script on single timeline?


How to create UI for 2D games? I'm working on a game using Haxe Flambe but I'm having a hard time making the UI part of it (main screen, level selection, etc). And I began to think... is there another way? I would love to have something like Flash, I mean, WYSIWYG like to make the UI. Just because I don't want to spend my time coding the screens until they look like what's on my mind. So the questions are How do people work? Is there something visual to make the UI for games that'll be programmed on Haxe (it doesn't matter if using OpenFL, Flambe or other)?


Pros and Cons of AMF in multiplayer flash game? After trying to use red5 for my turn based multiplayer game, I've decided to give AMF a try using amfphp, because of the expensive media server hosting solutions. (With AMF all I need is a web server). The game is a simple turn based game. It uses Box2D for physics. Its similar to pool or billiards. More than two users should be able to play in one game 'table'. Is it OK to use AMF in this situation? Also which one should I use? ZendAMF or AMFPHP? Features No. of players 2 in each 'room' or 'table', turn based, multiple rooms. I've heard games like farmville use AMF. Does zynga's poker game also use AMF? How does one player get info on what the other player is doing? Do they do a timed checking for any changes, similar to polling? How can changes or 'moves' made by one player be updated to everyone? Since the connection is terminated after every request unlike in a socket connection.


Should all stats only exist on MySQL database for my Flash browser RPG? I'm creating a browser RPG in Flash which will have some multiplayer elements and in app purchases so security is a high concern. Would it be better to have all game stats like health and such exist only in the MySQL database and retrieve them every time I need them? The game is turn based, but that would still require very frequent connections to the database. I could use local copies to cut down on the number of connections, but I imagine that would make it much easier for people to cheat.


Adobe Air turn based multiplayer Game, sockets vs http bandwidth I am developing an Adobe Air multiplayer game for iPad. It is turn based and not realtime. It is like checkers game. I want to use a client server model. I have found 2 options to connect to server so far socket connection and http requests My question is Is the bandwidth requirement for socket connection vs http requests different? I need the game to work with very low speed internet connections


Documentation Spec for Flash's XFL layout? Has anyone found an official spec or documentation on the XFL file layout? Are there any design tools in existence or planned that can create XFL files? (Besides the official Adobe Flash Professional program)


Shared Object Not saving the level Progress I am making a flash game in which i have a variable levelState that describes the current level in which user has entered I am using SharedObject to save the progress but it does not do so first i declred a clas level variable private var levelState Number 1 private var mySaveData SharedObject SharedObject.getLocal("levelSave") in the Main function i am checking if it is a first run of the game like below if (mySaveData.data.levelsComplete null) mySaveData.data.levelsComplete 1 and in a function where the winning condition is checked so that levelState could be increased i am usin this sharedobject to hold the value of levelState if ( winniing condition ) levelState mySaveData.data.levelsComplete levelState mySaveData.flush() setNewLevel(levelState) but when i play the game clear a level and again run the game it does not start from that level it starts from beginning.


Help with converting an XML into a 2D level (Actionscript 3.0) I'm making a little platformer and wanted to use Ogmo to create my level. I've gotten everything to work except the level that my code generates is not the same as what I see in Ogmo. I've checked the array and it fits with the level in Ogmo, but when I loop through it with my code I get the wrong thing. I've included my code for creating the level as well as an image of what I get and what I'm supposed to get. EDIT I tried to add it, but I couldn't get it to display properly Also, if any of you know of better level editors please let me know. xmlLoader.addEventListener(Event.COMPLETE, LoadXML) xmlLoader.load(new URLRequest("Level1.oel")) function LoadXML(e Event) void levelXML new XML(e.target.data) xmlFilter levelXML. for each (var levelTest XML in levelXML. ) crack levelTest levelArray crack.split('') trace(levelArray) count 0 for(i 0 i lt 23 i ) for(j 0 j lt 35 j ) if(levelArray i 36 j 1) block new Platform s.addChild(block) block.x j 20 block.y i 20 count trace(i) trace(block.x) trace(j) trace(block.y) trace(count)


Use of FlxG.camera.follow to follow a character vertically I am developing a prototype for a game in Flixel in which a character floats upward continually to traverse the level. I would like to have a "tall" layout for levels and set the FlxG.camera to follow the character as he floats upward. My issue is in understanding the proper use of FlxG.camera. I have my game constructor coded as follows package import flash.display.Sprite import org.flixel. SWF(width "640",height "480",backgroundColor " 000000") public class MyGame extends FlxGame public function MyGame() super(320,240,PlayState,2) forceDebugger true In the override of create() in the PlayState.as file I attempt to set the camera to follow the player as follows public var TheClimber BalloonHero override public function create() void set background color FlxG.bgColor FlxG.BLUE Set data for player TheClimber new BalloonHero(FlxG.width 2 5,480) Add camera and set it to follow The Climber which will automatically set the boundaries of the world. FlxG.camera.setBounds(0,1280,640,1280,true) FlxG.camera.follow(TheClimber,FlxCamera.STYLE PLATFORMER) add player to the game add(TheClimber) I assumed this would set the camera bounds to twice the height of the SWF background(i.e. the FlxG height) and then scroll the background along with the specified FlxObject(TheClimber in this case) until it had reached the height of the game. However, I must be going about it incorrectly because when the zoom is 2 and the game height 720 the camera starts at the top of the screen with the player character not visible at the bottom of the game height. Is there a way to start with the camera game focused on the bottom of the game object(FlxG.height) ? Or am I going about this the wrong way and have other issues with the way I am using the camera? Thanks in advance.


How to check the device type using Adobe AIR for iOS How do I check what kind of device the user is running my Adobe AIR app on? Example if(device ipad3) stagestuff.width 300


How do I pause and resume a game in ActionScript 2? I'm making a game where the player must avoid random falling objects. I dont know how to implement pausing. I've been stuck on this for 2 days! I tried using gotoAndPlay and such, but the objects continue to run in the background. When I resume the game, they're still falling and it seems like the frame resets and loads new random falling objects. (Simple English would be appreciated English isn't my mother tongue.)


Can a standalone WPF application create an interface that looks like a Flash interface? It seems like WPF was created as the application answer to Adobe's Flash. Silverlight is used for creating web pages. But, can that same functionality be pulled into a standalone WPF application. Scaleform allows Flash to be used within unmanaged C games. Can WPF be used to create the same type of interfaces? What I've read seems to make me believe it can. But, I haven't seen any sheetshots of applications that show this kind of interface.


How do I check on non transparent pixels in a bitmapdata? I'm still working on my window cleaning game from one of my previous questions I marked a contribution as my answer, but after all this time I can't get it to work and I have to many questions about this so I decided to ask some more about it. As a sequel on my mentioned previous question, my question to you is How can I check whether or not a bitmapData contains non transparent pixels? Subquestion Is this possible when the masked image is a movieclip? Shouldn't I use graphics instead? Information I have A dirtywindow movieclip on the bottom layer and a clean window movieclip on layer 2(mc1) on the layer above. To hide the top layer(the dirty window) I assign a mask to it. Code this creates a mask that hides the movieclip on top var mask mc MovieClip new MovieClip() addChild(mask mc) assign the mask to the movieclip it should 'cover' mc1.mask mask mc With a brush(cursor) the player wipes of the dirt ( actualy setting the fill from the mask to transparent so the clean window appears) add event listeners for the 'brush' brush mc.addEventListener(MouseEvent.MOUSE DOWN,brushDown) brush mc.addEventListener(MouseEvent.MOUSE UP,brushUp) function to drag the brush over the mask function brushDown(dragging MouseEvent) void dragging.currentTarget.startDrag() MovieClip(dragging.currentTarget).addEventListener(Event.ENTER FRAME,erase) mask mc.graphics.moveTo(brush mc.x,brush mc.y) function to stop dragging the brush over the mask function brushUp(dragging MouseEvent) void dragging.currentTarget.stopDrag() MovieClip(dragging.currentTarget).removeEventListener(Event.ENTER FRAME,erase) fill the mask with transparant pixels so the movieclip turns visible function erase(e Event) void with(mask mc.graphics) beginFill(0x000000) drawRect(brush mc.x,brush mc.y,brush mc.width,brush mc.height) endFill()


Flash, Java, Unity plugin install penetration? Is there data on how many users have Flash, Java, or Unity plugins installed?


Is flash game development not considered 'proper' game development? I've come across this a couple of times. That flash game development is not 'proper' game development when compared to XNA or even Unity. Mentioned here Need guidelines for studying Game Development Also here in some comments Where to start with game development? This judgement also befalls java, according to some. Is it because in flash its so easy to draw graphics and to import and add on to the stage any element we want and also because flash needs a 'container program' to run and others don't? But flash is by far way easier to 'distribute' than any other of those mentioned above. Maybe except for iphone or android games.


Internationalization (i18n) in Flash games? Is there an easy way? I want to internationalize some texts in a flash (not flex) game I'm working on and I can not find an easy way to achieve that... I have found some libraries and other solutions, but I expected something a lot easier (it is really easy with other technologies). Do you have experience in this? How do you do it?


Required Security Precautions for Flash AS3 Multiplayer Game I have created a couple of games in Flash AS3 and am playing with programming a flash based multiplayer (possibly mmo?) game where the application will communicate with a server over a socket connection. Obviously I need some form of authentication (username and password) but what other security precautions do I need to explore to prevent cheating?


Game Server Framework Engine that supports AMF? I am looking for a server technology that supports AMF (because I plan on using an as3 flash front end). I would like to develop game logic simulations that run on the server. Small number of users and logic at first, but that will grow. I might use this for some simple turn based simple tests, but I am hoping this will also support some tougher real time (RTS) or even MMO style games and simulations. So far I have been looking at (in order of what I think is most promising so far) WebORB Looks the most promising so far, appears to be well supported and developed, lots of features, yet sells itself as easy. Looks like they have a community open source free version Cubeia Firebase Looks really good, only thing that worries me is their statement that it does not work well for real time style games, but is ideal for turn based. It might be ok for now, but what if I need to scale the game up? Open Source Free BlazeDS Looks promising, supported by adobe, I should be able to develop game logic in the BlazeDS server and has amf support. Open Source Free Red5 No release since 2010, some activity though. (has amf) Open Source Free however have not been able to locate any good 'game' examples tutorials. FlashMOG looks interesting, but I am not sure if it is robust enough to act as an actual game server with continuously running logic. No release since 2010, Uses PHP as a socket server. Open Source Free RedDwarf (used to be SGS Project Darkstar) no release since 2010, is this active? Has AS3 library, but it is out of date too? Open Source Free Cirrus, Wowza, FMS these are more of a media server? SmartFox, Electroserver these are nice, but are not open source free. I believe they have limited connection versions available and while I am hoping to scale my project above those limitations I do not expect to be drawing an income to pay for the licenses at that point LCDS (live cycle data services) similar to blazeDS, not free Any other options or clarifications??


Sprites are sometimes blurry in Flash I am playing around with drawing an SVG sprite (imported in through Embed ). Depending on the coordinates of the image, sometimes it appears more crisp than others. The following image shows how at different locations is it rendered differently (Image link You may have to download and zoom in with an image editor to see it) You'll notice that the middle sprite is more blurry than the ones on the sides. Does anyone know why this is? Any help would be appreciated.


What do I need to change in Box2D to work in pixels? Box2D seems to be set up in such a way that you cannot work in pixels (i.e. physics scale 1). It produces very strange results as it hits maximum speed limits at low speeds and looks very strange. It only seems to work well at a physics scale of around 15 or 30. For me, working in pixels is the logical way to handle physics and movement in a game, as you are already using that measurement for lots of other things. I don't want to have postionX 30 all over my code, so what variables do I need to hack in the box2d source in order to make physics scale 1 work as if it was physics scale 30? I'm using the latest version from box2dflash.org.


Flash server, protocol protection I am making a flash game that will interact heavily with the server. For quite some time already I am using 'request hashing' technique to make sure that request data hasn't been tampered with. This works pretty well. However, in this game I'd like to go a little bit further and completely hide the protocol from the observer (right now it's plain JSON). I imagine that I could zip and encrypt data (using one of symmetric algorithms). That would make it pretty unreadable by human, right (also smaller)? And SWF encryption obfuscation should protect the encryption key (it is being done anyway). As a side benefit that will also protect dynamically loaded resources from directly saving them to disk (or copying from the cache). Questions are there tools that allow you to simply dump the SWF with all its content, received and decrypted? If yes, this will render 'the side benefit' invalid. do you think it's worth it to burn all that CPU power? To support my point, I will say that I like to inspect data being exchanged between client and server. And occasionally I find a bug or two which I can use to my benefit. But then there was a game that was sending and receiving some binary data. Being a lazy attacker, I decided not to analyze further. Otherwise, who knows what I could find ) Comments, ideas, criticism, suggestions? )


Will the same Flash game business model work for HTML5 games? One of the best ways to earn money with Flash games is by making sponsorship deals. The developer puts the sponsor's logo and a link to their site in the game and lets the game spread around the web. The sponsor gains money from the ads and the extra traffic to their website. Alternatively, they site lock their game to their website (usually for a short period of time) so that people who want to play the game go to their website. It's true that one can remove the site lock with some effort by decompiling the swf, but it's usually not done as it's not worth the effort and not legitimate. Another significant part of the Flash business model is to put advertisements in game. There are other ways of earning money with Flash games, but from what I know, these two are the most prevalent ones. Since HTML5 is necessarily open source, it makes me wonder if this model would still work for HTML5. Even if you obfuscate your js, it's much easier than Flash to copy the game, so maybe it's worth the effort for someone to copy the game to their (illegitimate) site. If you add your sponsor's logo and link or advertisements, it might be worth the effort to remove them for their site, something that I think is much harder to do with Flash games. Perhaps even the illegitimate site could claim that their site is better because there are no in game ads. There's still the legitimacy barrier, but I wonder if it's strong enough. Let's put aside all game development technical restrictions regarding HTML5 for this question (suppose for a moment that HTML5 works just as well as Flash for games). I have two very similar (pair of) questions. The first is, would the Flash business model work with HTML5? What changes to it would be helpful for HTML5 games? The second question is, what about the big picture for HTML5 games? Is adapting the Flash model really the best solution, or is there a better model for the HTML5 games world to "turn"?


Flash Flex Air and iOS I'm just a little confused with all of the news recently regarding the cancellation of mobile flash, so was hoping for a little help. I've had a search through and can't find the answers to these questions, so any help would be great. First up, I'm looking to create a game in Flash first, to test whether the concept works as a fun game (on Newgrounds Kongregate Facebook etc.). Would it be best to use Flash CS5.5, or Flash Builder? Secondly, with mobile flash now being discontinued by Adobe, could I still port this game over to iOS through the Flash platform, or would it be better at that point to re write the whole game using Objective C? (NOTE I'm not an Objective C developer, but am instead a Javascript and Actionscript dev). Any help would be great. Thanks!


How to eliminate screen jitter in Flash game? We made a flash game with a big screen size(1000x600), and the terrain graphic will jitter while the screen scrolling(that's, camera moving with player) continuously. What's the root cause? Or if you know how to eliminate this problem, please tell me. Any help is appreciated. UPDATE The map's size is more bigger than screen, e.g 6000x1200. And the map has more than one layer, generally it has 3 layers. Terrain is composed by tiles. And FPS is 24. If the FPS is set to 60, things will be better. But any way, it should work well at 24 FPS. I'm not sure if it is a natural problem of flash player, because some times a terrain object(e.g a house) look like a little bit distorted.


UI Automation for Flash Games has anyone used or heard of a good selenium like toolset for doing automated UI testing with Flash? I would ideally like to have the ability to record and playback events against my game and integrate this into our build server.


Flash framerate reliability I am working in Flash and a few things have been brought to my attention. Below is some code I have some questions on addEventListener(Event.ENTER FRAME, function(e Event) void if (KEY RIGHT) Move character right Etc. ) stage.addEventListener(KeyboardEvent.KEY DOWN, function(e KeyboardEvent) void Report key which is down ) stage.addEventListener(KeyboardEvent.KEY UP, function(e KeyboardEvent) void Report key which is up ) I have the project configured so that it has a framerate of 60 FPS. The two questions I have on this are What happens when it is unable to call that function every 1 60 of a second? Is this a way of processing events that need to be limited by time (ex a ball which needs to travel to the right of the screen from the left in X seconds)? Or should it be done a different way?


Hide movieclip parts that are out of bounds I'm making a game where one takes a picture of their face to use on a character. I have them zoom in on the picture, but the bitmapdata extends out of its movieclip. How do I assign bounds to my bitmapdata?


Use of FlxG.camera.follow to follow a character vertically I am developing a prototype for a game in Flixel in which a character floats upward continually to traverse the level. I would like to have a "tall" layout for levels and set the FlxG.camera to follow the character as he floats upward. My issue is in understanding the proper use of FlxG.camera. I have my game constructor coded as follows package import flash.display.Sprite import org.flixel. SWF(width "640",height "480",backgroundColor " 000000") public class MyGame extends FlxGame public function MyGame() super(320,240,PlayState,2) forceDebugger true In the override of create() in the PlayState.as file I attempt to set the camera to follow the player as follows public var TheClimber BalloonHero override public function create() void set background color FlxG.bgColor FlxG.BLUE Set data for player TheClimber new BalloonHero(FlxG.width 2 5,480) Add camera and set it to follow The Climber which will automatically set the boundaries of the world. FlxG.camera.setBounds(0,1280,640,1280,true) FlxG.camera.follow(TheClimber,FlxCamera.STYLE PLATFORMER) add player to the game add(TheClimber) I assumed this would set the camera bounds to twice the height of the SWF background(i.e. the FlxG height) and then scroll the background along with the specified FlxObject(TheClimber in this case) until it had reached the height of the game. However, I must be going about it incorrectly because when the zoom is 2 and the game height 720 the camera starts at the top of the screen with the player character not visible at the bottom of the game height. Is there a way to start with the camera game focused on the bottom of the game object(FlxG.height) ? Or am I going about this the wrong way and have other issues with the way I am using the camera? Thanks in advance.