_id
int64
0
49
text
stringlengths
71
4.19k
31
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 )
31
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.
31
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.
31
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.
31
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?
31
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?
31
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?
31
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.
31
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?
31
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()
31
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
31
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.
31
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
32
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?
32
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?
32
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.
32
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!
32
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?
32
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!
32
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)?
32
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 (...
32
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)
32
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.
32
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?
32
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. )
32
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.
32
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.
32
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.
32
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.
32
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.
32
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?
32
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.
32
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.
32
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)
32
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?
32
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?
32
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?
32
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
32
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?
32
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?
32
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)?
32
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.
32
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.
32
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
32
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)
32
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.
32
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?
32
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)
32
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.
32
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
32
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.)
32
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.
32
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()
32
Flash, Java, Unity plugin install penetration? Is there data on how many users have Flash, Java, or Unity plugins installed?
32
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.
32
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?
32
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?
32
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??
32
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.
32
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)
32
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.
32
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? )
32
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"?
32
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!
32
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.
32
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.
32
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?
32
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?
32
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.
32
How to build a bones animation engine? I want to develop a flash game. It would draw a stick man, and edit his pose. I think what I need to learn are bones animation and physics engine. Can anyone introduce some good resources to learn both?
32
Best practices for UnitTesting heavy Flash game clients and libraries? We have several quite heavy game clients completely written in AS3 (some also use Flex for UI). Some clients are built with PureMVC, others are a pile of spaghetti code that's grown over the years. We also have several libraries used by our game clients that are written in AS3 Flex. I'm tasked to evaluate the benefits risk cost of applying unit testing to our clients and libraries and decided to give FlexUnit a closer look. I chose FlexUnit for a first attempt over fluint since FlexUnit is definitively able to test pure AS3 projects while I'm not sure about that for fluint. Now I'm wondering what some good starting points and best practices are to get unit testing into previously untested applications. So my questions for unit testing game clients and libraries are How to get started? What are "low hanging" ( easily testable) fruits to test with unit testing? What are commonly tested aspects of game clients? Can you apply unit testing to the BBOY design pattern or do you need to (extensively) refactor the game clients? Is it useful (and does it make sense) to test asset loading? If so, how to do it (comparing a binary diff, or comparing hash checksums, or ...)? How to test server communication and asynchronous commands? How to integrate the whole thing with Hudson Jenkins CI server and Maven? Are there any reporting tools that can generate overviews of the run tests and report which test failed on which function class? I'm thankful for all pointers about the issue (direct answers, blog posts, forum discussions, how tos, etc. etc. etc.) since I have little previous practical experience with unit testing.
32
How do I combine matrix transformation with non uniform screen scaling in Flash? I'm using a Flash transformation matrix for affine transformation. I have a rectangular image being rotated and scaled (in 2D). There are two sets of scaling variables, ScreenScaleX and ScreenScaleY, and ScaleX and ScaleY, as well as a counter clockwise rotation angle, theta. ScreenScaleX and ScreenScaleY are the scaling factors of the window they should be applied in directions of the original X and Y axes after rotating the image. ScaleX and ScaleY should be applied in the new X and Y directions after rotating the image. For example if theta is 90 degrees, ScreenScaleX and ScreenScaleY will still stretch in the direction of the original X Y axes, but now ScaleY will stretch in the screen's X direction, and ScaleX will stretch in the screen's Y direction. I think I can accomplish this with some combination of scaling, rotation, and skewing, but I'm struggling to figure out what the matrix would look like. How would I construct a matrix from these variables in order to perform this transformation?
32
Splitting game into multiple standalone parts I'm digging into Starling's CitrusEngine game engine. I try to understand the idea of structuring the game. If you take a look at chrome.angrybirds.com or puddingmonsters.com you see that games load states (StarlingState's assets) dynamically which is smart. When the game starts a splash screen displays, then you get a pre loader which loads the main state (home, settings and choose level view) and when you select a level a pre loader displays again which loads the level state. This looks like they've constructed multiple parts for the game and then connect them together where the pre loader is displayed when switching from one part to other. How should we do that in Starling CitrusEngine? What's the logic here? Flash games usually load all assets at the beginning which is not smart on mobile devices. Is it wise to have multiple StarlingCitrusEngine classes or you should handle the whole game in a single StarlingCitrusEngine class? Please explain in details. Many thanks for answers.
32
Flixel doesn't light tile up i'm creating a game with flixel, and I want to have a effect when you mouse over a tile, I tried implementing it, and this is what it gives public class GameState extends FlxState private var block EmptyBlock public function GameState() override public function create() void for (var i Number 0 i lt 30 i ) block new EmptyBlock(i, 20) block.create() override public function update() void block.update() super.update() GameState class and here is the EmptyBlock class public class EmptyBlock private var x int private var y int private var row FlxRect public function EmptyBlock(x int, y int ) this.x x this.y y public function create() void row new FlxRect(x, y, 32, 32) trace ("Created block at" x y) public function update() void if (FlxG.mouse.screenX row.x) if (FlxG.mouse.screenY row.y) var outline FlxSprite new FlxSprite(row.x, row.y).makeGraphic(row.width, row.height, 0x002525) UPDATE The problem is still not solved. I tried what you recommended, this is the new code public class EmptyBlock extends FlxSprite private var outline FlxSprite Embed(source 'freetile.png', mimeType "image png") private var freeTile Class public function EmptyBlock(x int, y int) this.x x 32 this.y y width 32 height 32 Note this is a block, rather than an outline. Create an outline image, then use loadGraphic() instead of makeGraphic() if you want an outline. outline new FlxSprite(this.x, this.y) outline.loadGraphic(freeTile, false, false, 32, 32, false) override public function draw() void super.draw() if (overlapsPoint(FlxG.mouse.getScreenPosition())) outline.draw() And I call it here public function createMap() void var block EmptyBlock new EmptyBlock(0, 0) block.draw() Do you see what i'm doing wrong? Thanks!
32
In Box2dFlash my b2body gets detached from my Sprite after I use setXForm() I have a scenario where I have red coin in a Carrom board game which should be moved outside of the visible window when it is pocketed, also if any coin either white or black is not pocketed in the next shot, the red coin should be replaced in the center of the board. Now my problem is WHEN I apply the setXForm() method to move the b2body of the red coin outside of the visible area of my flash window.It moves,there is no problem in moving the body,but WHEN i replace the b2body and sprite after the event of no coin falling , the b2body is detached and works as a separate entity having no connection with the sprite of the red coin. I'm not getting a clue as to what is happening, that is why I thought I'd try posting this here.
32
Are there any command line swf packing tools? I want to packing image files(png, jpg) into swf, then game can load files easily. But I want to do this by a Makefile, not FLASH CS. Do you know any command line swf tool set can do that? And can I packing XML files into it as well?
32
Pixel perfect collision against rotated sprite in Flixel I've got a roughly 500x50 graphic of a lockpick that I need to be able to rotate very finely while doing pixel perfect collision detection against the lock object. There's no way to do pixel perfect collision detection in Flixel, so I'm using the Power Tools' FlxCollision class to accomplish this. The problem is that this class only works with rotated sprites if they were loaded with loadRotatedGraphic. ...the problem with that is that it only allows you to rotate to discrete angles. You pass it how many angles you need to be able to rotate to and it, I think, pre prepares all the frames for you. And the reason that's a problem is because I need such fine rotation. I need at least 128 different angle values, but when I do that I get Error 2015 Invalid Bitmap, which I'm assuming is because the resulting 128 frames of a 500x50 lockpick results in a bitmap larger than AS3's limit. I can load the graphic using loadGraphic instead, which I think just calculates the rotated image real time, but then FlxCollision won't notice that it's been rotated. Another problem is that with the pre rotated graphics, you can't rotate about a specific point, and I need the lockpick to rotate around the tip of its handle. ...so how the heck do I do pixel perfect collision against a rotated sprite? I'm trying to mod FlxSprite so that FlxCollision will see the rotated sprites even when they're calculated in real time, and to do this I Ctrl F'd through the class looking for appearances of "angle", the variable that you set to rotate a sprite, but all I can find is some obscure calculation in it's used to compute a frame number, and I can't find a single call to any function that looks like it's doing real time bitmap rotating. So, I was able to solve this problem. All FlxSprites hold the bitmap for their currently visible frame in an internal variable called framePixels. If you load a graphic using loadGraphic, then you can do real time rotation in this case, the draw() function rotate s framePixels "at the last minute", right before rendering it. Meaning the rotated bitmap is not stored, and FlxCollision has no way of seeing it. FlxCollision runs its collision checks against the unrotated bitmap. So this is what need to be done Get the sprite to store its rotated graphic somewhere rather than just sending it to the renderer and then abandoning it. Get FlxCollision to use that stored rotated graphic rather than framePixels. This is summarized in the following diagram. Flixel's default logic is in black, my changes are in red. I applied all of this in a sub class of FlxSprite that I called PerfectCollisionSprite. Here's my code.
32
How can I improve the seemingly capped framerate of my flash game? I used to be sure that all Flash games are capped to 30fps as Edmund McMillen's The Binding of Isaac runs at that frame rate. N v2.0 (Flash Player 11) runs at 60fps. Why do games developed in Flash seem to have capped frame rate? What are the limits on the fps when developing in Flash?
32
Using external music mp3 in flash game sorry for my english. Im relative new to flash game development, Im creating a game and I need some big size mp3 files. If I add them into flash, .swf file will be too big. I guess I need to host mp3 files somewhere and use URL Request? Where can I upload mp3 files so they are always ready for use?
32
How to stretch Movie Clip according to user's touch coordinates? I have code like this touchX e.stageX touchY e.stageY I also have a player movieclip that I'm trying to make shoot lasers. So I got the MovieClip to appear and rotate according to the player's location and the user's touchX and touchY. How do I make the laser MovieClip stretch according to the distance between the player's coordinates and the touchX and touchY coordinates?
32
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. )
32
How do you create a single internal pre loader for a Flash game written using Flex? I've got a somewhat large SWF which I'd like to deliver through a pre loader so the user doesn't have to appear to wait as long. With Actionscript it's pretty easy to create an external pre loader but doing so makes it harder to distribute my game. What methods are available for including the pre loader in a single SWF?
32
Tile based maps in AS3 I want to make a tile based platformer in AS3. I want my game to read an external maps file (in xml or json or somethimg similar) to draw a tile based map. I've seen loads of tutorials for this in AS2 and other languages, and the few I've found in AS3 are either incomplete or filled with extra unnecessary features. I just want to be able to draw a basic map from sprites in Flash. Any links or information to point me in the right direction would be appreciated.
32
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.
32
How to organize timeline in a Flash project? I am starting a new Flash game and I was wondering if there is a better way to organize the timeline of the project. In my previous games I define a keyframe for each possible status of the game (loading, sponsor, intro, menu, gameplay, etc...). This method works but has some problems... For instance, it is not easy to implement transitions between the different screens in the game. How do you do this? Do you know of some better way?
32
TileBased Game Blitting Hero or Sprite? So my environment is all set up and now I'm working on the movement physics of my character. I used blitting to copy over my tiles from a tilesheet. But since they are static, they are only copied over once. And with the Hero (main player character), I figured that I might blit him into his continuously changing position. But now, I'm not quite sure it's necessary? Is there a real big perfomance save to copy the Hero sprite into a new position constantly using Blitting, OR, is it fine to just copy it into the game once, and simply move the Hero sprite as a movieclip?
32
Need help implementing shadows on platform with limited feature set I am writing a game that very much relies on real time shadowing and would like to implement shadow volumes. I was thinking of doing shadow mapping, but the platform I am using is Molehill Stage3D and it's limited to 8 bits per channel, BGRA textures, and shaders can only read from textures, not depth buffers. I have never done stencil shadows before, but would it be possible to generate a shadow volume entirely on the GPU without the use of Geometry shaders, and only vertex shaders?
32
Fixed timestep with interpolation in AS3 I'm trying to implement Glenn Fiedler's popular fixed timestep system as documented here http gafferongames.com game physics fix your timestep In Flash. I'm fairly sure that I've got it set up correctly, along with state interpolation. The result is that if my character is supposed to move at 6 pixels per frame, 35 frames per second 210 pixels a second, it does exactly that, even if the framerate climbs or falls. The problem is it looks awful. The movement is very stuttery and just doesn't look good. I find that the amount of time in between ENTER FRAME events, which I'm adding on to my accumulator, averages out to 28.5ms (1000 35) just as it should, but individual frame times vary wildly, sometimes an ENTER FRAME event will come 16ms after the last, sometimes 42ms. This means that at each graphical redraw the character graphic moves by a different amount, because a different amount of time has passed since the last draw. In theory it should look smooth, but it doesn't at all. In contrast, if I just use the ultra simple system of moving the character 6px every frame, it looks completely smooth, even with these large variances in frame times. How can this be possible? I'm using getTimer() to measure these time differences, are they even reliable?
32
How do you make money from html5 games (i.e sponsorships)? I make games with flash and I am interested in making games in html but I haven't seen any companies or websites which are willing to buy these games (i.e game sponsorships). I was hoping somebody could tell me about a company who would do this or why people don't buy html games?
32
Flash Game not working on Android I am not sure if I will be able to provide enough information for someone to answer this question, but any ideas might help. I am creating a tower defense game in Flash and I eventually want to make it run on Android. Just for testing purposes, I have been running it on Android's browser and different Android .swf player apps. Recently, the game stopped working correctly. When it gets to the second wave of enemies, they get about four tiles in and stop moving. I can get them to start moving again by constantly clicking on parts of the screen. It's almost like the game loop has quit updating. Trying to solve the problem, I have updated the gameloop from Flash's standard events to a NativeSignal event (didn't solve the problem but the game runs much faster overall). The game works fine on my PC, I can't figure out the Android problem though. Any ideas or help would be appreciated. I didn't want to supply code since I wouldn't know where to start that would be helpful.
32
Should I create .fla files in Flash Professional and import them into Flash Builder? With Flash Builder and Flash Professional at my disposal for creating games, I'm having a hard time figuring out if I should be creating the .fla files in Flash Professional and then importing them into Flash Builder, or something else? Does it matter?
32
Splitting game into multiple standalone parts I'm digging into Starling's CitrusEngine game engine. I try to understand the idea of structuring the game. If you take a look at chrome.angrybirds.com or puddingmonsters.com you see that games load states (StarlingState's assets) dynamically which is smart. When the game starts a splash screen displays, then you get a pre loader which loads the main state (home, settings and choose level view) and when you select a level a pre loader displays again which loads the level state. This looks like they've constructed multiple parts for the game and then connect them together where the pre loader is displayed when switching from one part to other. How should we do that in Starling CitrusEngine? What's the logic here? Flash games usually load all assets at the beginning which is not smart on mobile devices. Is it wise to have multiple StarlingCitrusEngine classes or you should handle the whole game in a single StarlingCitrusEngine class? Please explain in details. Many thanks for answers.
32
Flash Origin Problem with Movie Clips I'm working on a game that uses Flash for the user interface. I'm running into an odd issue with the origin of a library movie clip. Here are the steps to reproduce Create a new MovieClip and construct a single rectangle with both a fill and a stroke. Set position of rectangle to (0,0) and notice that the origin is at the center of the border stroke surrounding the rectangle. Change position of rectangle accordingly so that the origin is truly the top left (so if the stroke surrounding the rectangle was set to 10, adjust the position of the rectangle to 5,5. Enable 9 slice for movie clip so that when you scale the rectangle it doesn't scale or distort the stroke surrounding the rectangle. Drag an instance of the movie clip to the stage and use the free transform tool to scale it to the width of the stage. It should visibly be as wide as the stage. Run the flash file and verify that the width during execution is not as wide as it was in design view. So in a nutshell it seems that when you use the free transform tool, it distorts the origin even though 9 slice is enabled and it shouldn't (I would think). I understand that Flash denotes the center of a stroke to be the starting point and not the edge, which is why I adjusted the origin accordingly while editing the movie clip. What I really need here is pixel perfect positioning for vector based components. I should be able to drag and drop a library movieclip that provides a window with a fancy border around it and scale it to whatever size I need, and place it where I need it to be without any odd positioning problems. Here are some screenshots of the problem ( i.imgur.com 8WU2F.png ) is a shot of my window with 9 slice enabled. You can see that the origin is correct being the top left of the window graphic. ( i.imgur.com ciK8l.png ) is a shot of my window after using free transform to scale it to the width of the stage. It's pretty much perfect in design view ( i.imgur.com QFUiJ.png ) is a shot of the flash application running. Notice that the window is no longer the width of the stage? I don't get it. It makes it very difficult to position because in order to get this to look right while executing, I have to make the window wider than the stage in design mode. Any help is greatly appreciated. I'm sure it's something silly. This is pretty much bread and butter stuff that's been around since the early days of flash.
32
Networking in Flash games. Socket or Stratus? Working on a prototype for a Flash game that will use networking communication. It would be better to use Peer 2 Peer connection, since it will be a multiplayer game. Has anyone used Stratus or tried to make a multiplayer game via the built in socket? The game will be a turn based game, similar speed to poker but if I could get faster turns that would be great.
32
Pixel perfect collision against rotated sprite in Flixel I've got a roughly 500x50 graphic of a lockpick that I need to be able to rotate very finely while doing pixel perfect collision detection against the lock object. There's no way to do pixel perfect collision detection in Flixel, so I'm using the Power Tools' FlxCollision class to accomplish this. The problem is that this class only works with rotated sprites if they were loaded with loadRotatedGraphic. ...the problem with that is that it only allows you to rotate to discrete angles. You pass it how many angles you need to be able to rotate to and it, I think, pre prepares all the frames for you. And the reason that's a problem is because I need such fine rotation. I need at least 128 different angle values, but when I do that I get Error 2015 Invalid Bitmap, which I'm assuming is because the resulting 128 frames of a 500x50 lockpick results in a bitmap larger than AS3's limit. I can load the graphic using loadGraphic instead, which I think just calculates the rotated image real time, but then FlxCollision won't notice that it's been rotated. Another problem is that with the pre rotated graphics, you can't rotate about a specific point, and I need the lockpick to rotate around the tip of its handle. ...so how the heck do I do pixel perfect collision against a rotated sprite? I'm trying to mod FlxSprite so that FlxCollision will see the rotated sprites even when they're calculated in real time, and to do this I Ctrl F'd through the class looking for appearances of "angle", the variable that you set to rotate a sprite, but all I can find is some obscure calculation in it's used to compute a frame number, and I can't find a single call to any function that looks like it's doing real time bitmap rotating. So, I was able to solve this problem. All FlxSprites hold the bitmap for their currently visible frame in an internal variable called framePixels. If you load a graphic using loadGraphic, then you can do real time rotation in this case, the draw() function rotate s framePixels "at the last minute", right before rendering it. Meaning the rotated bitmap is not stored, and FlxCollision has no way of seeing it. FlxCollision runs its collision checks against the unrotated bitmap. So this is what need to be done Get the sprite to store its rotated graphic somewhere rather than just sending it to the renderer and then abandoning it. Get FlxCollision to use that stored rotated graphic rather than framePixels. This is summarized in the following diagram. Flixel's default logic is in black, my changes are in red. I applied all of this in a sub class of FlxSprite that I called PerfectCollisionSprite. Here's my code.
32
Beginner flash game development Start with framework or from scratch? I want to write some simple flash games (as a hobby). I have a lot of programming experience, but no experience with Flash ActionScript. My question is As a beginner, is it a good idea to start with a framework like Flixel, FlashPunk or PushButton or would it be better to write my first games from scratch? Also, if you vote for using a framework, which one would you recommend? What are the differences? And another question What about Flex, would you recommend using it?
32
OnClick events using Scaleform UI with Cryengine 3.5.4 I've created a UI in Flash, set up an xml file for it and designed a flowgraph to ensure it displays when I launch. However, clicking on the buttons doesn't appear to do anything, despite me writing a click event in AS, linking to it in the xml, and connecting the function to a level change in the flowgraph. XML lt UIElements name "zlogicGUI2" gt lt UIElement name "GuiV2" render lockless "1" gt lt Gfx file "GuiV2.gfx" layer "0" gt lt Constraints gt lt Align mode "dynamic" valign "center" halign "center" scale "0" max "0" gt lt Constraints gt lt Gfx gt lt events gt lt event name "OnClick" ExternalInterface "ButtonClickPressed" desc "" gt lt events gt lt UIElement gt lt UIElements gt ActionScript 3 (created in Flash CC) button 1.addEventListener(MouseEvent.CLICK, fl MouseClickHandler) function fl MouseClickHandler(event MouseEvent) void ExternalInterface("ButtonClickPressed")
32
How much info can I store in a cookie? Im developing a flash game and I'd like to know how much info can I store in a browser cookie. The game is simple, but it needs to store several variables in order to save all the details of your current progress. The game is only one swf file, no server, no nothing. I need to know how should I use the cookies to achieve this, and if they have the posibility of doing it, of course. (several 200 variables i.e)
32
How to calculate vector that is perpendicular to the direction of moving in Flash? In flash i have a class that extends movieclip and i am moving it forward, up and down, and rotating it. How can i calculate the vector that is perpendicular to this movieclip?
32
Can a texture's UV coordinates be animated (scrolled) when part of a SpriteSheet? Alright so my question is about texture manipulation in Flash Stage3D Context3D using AGAL for the shader language. But I'm pretty sure this could be applicable in other situations involving GPU programming. So the goal is, if I wish to have a "scrolling" animation on a certain tile (like a tile of water), can I still have that texture packed along with all the rest of my sprite assets? Or does it have to be alone to avoid bleeding nearby assets? From what I can understand, when the FragmentShader samples the portion of the texture offsetted during a scroll animation, any coordinates outside the desired texture will reveal incorrect nearby textures. Some example to clarify Fluid motion (lava, water waves, acid bubbles) Background motion (cloud, trees, houses) Directional indicators (lines on a conveyor belt, race circuit dash regions) Do I need to use some extra operations to wrap the texture if it tries to sample beyond a certain point? How could those constraints be defined transferred to the FragmentShader? UPDATE To clarify, I would like to scroll only on 1 single tile that would be part of a SpriteSheet TextureAtlas (meaning, mixed with other existing sprites part of a game project). Imagine you had something like this (but better artwork, of course) So a 256 x 256 Texture with a "Wavy Water" tile in the top left corner (128 x 128 in dimensions). How would you write a shader that can scroll through ONLY the water portion to give a sense of motion without running over the adjacent textures (ex faces and cars). How would you handle situations where the Quad is much larger than the texture and could repeat many times as well in combination to being able to scroll it?