feudalwars

Members
  • Content count

    489
  • Joined

  • Last visited

  • Days Won

    2

feudalwars last won the day on May 17 2015

feudalwars had the most liked content!

2 Followers

About feudalwars

  • Rank
    Advanced Member
  • Birthday

Contact Methods

  • Website URL
    http://www.feudalwars.net

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

1,134 profile views
  1. Suppose I load each audio file on-demand, when the user needs them, using game.load.audio. If that file is in cache, game.load.audio will use the file from cache and not re-download, just like it works with images, correct? it would be practical if I used really small MP3 files. But how does one dynamically load an audio file while a game is running? I'm not even sure how to do it outside of Phaser.
  2. 1. I think that would be unwise in my particular circumstance, because of the demands it puts on server bandwidth. I have 15 audio files, each are about 5MB. That's 75MB of bandwidth if the user goes through the entire soundtrack (to put things into perspective, the rest of the entirety of my game is 30MB, maybe)... I'd be much more comfortable if all of the stuff in my game that could be streamed, is streamed. Think I will send soundcloud an email today to figure this out. Other than soundcloud, I can't think of any service I could use for streaming. 2. Makes sense. and it would seem Phaser does have support: https://phaser.io/examples/v2/audio/audio-sprite
  3. Two questions: 1. I want to stream my in-game music, since there are 15 tracks and it would take too long to download each. Obviously, I could use a service like soundcloud - but would I have to either show the embed widget or show a link to the sound cloud page every time the song played (as their "attribution" section in API terms seem to imply)? https://developers.soundcloud.com/docs/api/terms-of-use#commercial I've actually done a lot of research on this and haven't come up with anything. Googled "steam music to your app," "stream music to your web game," etc. Not a single result. I suppose it's because streaming is generally directly business to consumer, not business to business to consumer. I suppose it's a very rare thing to do as most web games simply download the sound files when you access the page. Does anyone have any advice/personal experience regarding this? What are my options? Just trying to gain some perspective as I can't find anything in my research. 2. Suppose I have 100 sound files (these are effects, not music, so don't need to be streamed) in my game. Well, using individual sound files is bad for performance, especially when there are 100 of them and less than 500KB each... The client needs to make 100 HTTP requests to download the files instead of one. It just makes sense to put them all in the same file and play sections of that single track (analogous to how we use texture atlases instead of separate texture files). For textures, we have texture packer. But what about for sounds? Is it even possible?
  4. Nope, I only need to create 1 BMD for all textures and draw to it once when a user selects a different texture than the one already being used. 1. A Single BMD for ALL textures: when a new texture is clicked, I don't create a new BMD, that would be wasteful. Clearing and redrawing the same BMD I used on the previous texture is far more efficient. You'll run into a memory bottleneck if you continually create new BMDs, instead clear and redraw the same BMD for every texture, whenever you need it. One BMD to rule them all! 2. Draw to the BMD only once: I think you may have missed something from my post above. There is no need to redraw the BMD for every new stroke. Once you've created that overlay, and anchored it in the exact center, all you need is to calculate the correct relative position when it is drawn to a render texture. For example: Suppose my map size is 100 x 100 and 10 x 10 pixels for each tile. The user clicks to place a texture at (45,0). This intersects two tiles: [tile #4 on X and #1 on Y] and [tile #5 on X and #1 on Y]. Both tile #4 and #5 are converted into render textures and the base texture is drawn on top of each. A BMD is then drawn to create the overlay, which is anchored at (.5,.5). The overlay is drawn on top of both render textures, but in different positions: Tile #4 is at 40,0 and Tile #5 is at 50,0 (tile anchors are 0,0) Therefore, when the BMD is rendered to the render texture (tile #4), it is rendered at: X: (45 - 40) = 5 Y: (0 - 0) = 0 So, (5,0), and this is using the simple formula (to calculate the point the user clicks relative to the tile instead of the game world). At tile #5, it is rendered at: X: (45 - 50) = -5 Y: (0 - 0) = 0 (-5,0). Ultimately, we've drawn to the BMD only once and rendered it to 2 different render textures.
  5. You're getting closer! Here are the differences. 1. Instead of using a bitmap alpha mask, I first draw the texture onto the bitmap, then draw another texture with destination-out. This other texture look like this: The black parts will show the texture, transparent parts will draw transparency. the end result is something that blends quite well and can be used as an overlay. 2. I don't need to create two BMDs for the top-left and top-right tiles like in your example, I only need to create one. Because it is anchored in the exact center, I only need to figure out the relative positions to draw that single overlay on each of the intersecting tiles. var relX = worldX - spriteX; var relY = worldY - spriteY; SpriteX/Y are the base tiles x/y. Suppose the user clicks an area that intersects 4 base tiles. A piece of the overlay will be rendered on each of the 4 tiles using relative positioning on each, but it is all drawn from the same BMD.
  6. > it means you have to change BMD quite often when recreating map? Because it is all procedural, there are ways to avoid this. such as drawing all textures that use 1 BMD first, then drawing all textures that use a different BMD. Drawing the z-index (vertical stack) in order, etc. Generally, I don't use more than 3 different textures on a map, it doesn't add that much to the aesthetic (in fact most of the maps in the trailer use only 1 texture). But even if I use 10 different textures, it doesn't add much to load time or affect performance. The BMD only needs to be created once for each texture. Rendering to render textures does most of the heavily-lifting of map creation, and render textures are extremely fast (much more so than BMDs). 4x4 what, you mean tiles? Without auto-culling Pixi can easily handle 15 x 15 (225 tiles), let alone 4 x 4 (16 tiles), at least on CPUs with good graphics cards. With auto-culling, even old computers with bad cards can handle 225 tiles, such as my 8-year-old iMac. Computers with good graphics cards, with auto-culling, can handle map sizes 100,000 pixels wide/high. That's 10 billion pixels. It's not practical for gameplay, and can slow things down, but it is possible. And that is tested in Chrome, FF and IE, in both Canvas and Webgl.
  7. I use a base texture system. So every map starts out with a base texture and when you go to create a new map (with the map editor), you choose a base texture. Then when you want to draw another texture onto the map, it works exactly like a stamp. A single BMD is created not the size of the game world, but the size of the stamp. Imagine you have a 1024 x 1024 texture in photoshop, and you use the eraser tool to make the edges partially transparent. That's what i do with the BMD. The BMD is then drawn into the game world, when you click on an area of the map, by converting the base textures (which are normal Phaser.Images) into render textures and rendering on top. If the stamp intersects more than 1 tile, it will draw on multiple tiles. If you select a new texture, a new stamp is created using the same BMD. Then, when you save and load the map, everything can be procedurally recreated as the stamp locations are simple x/y coordinates. There is never any problem with texture size as I never create anything larger than the base texture size (1024).
  8. ah, so it's a date. i suppose that's what the docs meant by real world time.
  9. Suppose I create an event using game.time.event.add. That Phaser.TimerEvent is stored in game.time.event.event, great. But how do I calculate how long it will take for that event to fire based on the current game time? I'm sure it has something to do with tick: https://phaser.io/docs/2.6.2/Phaser.TimerEvent.html#tick But what exactly is tick anyway? The docs say "the next game clock time that this event will fire at," but looking in the value stored in there, it is a huge value. Like: 20983490329048 compared to the game clock (game.time.now) which, at the same time is something like: 17002 Are the docs referencing some other clock, and not game.time.now?
  10. Official Trailer: Learn more: http://striketactics.net/about
  11. Use a render texture instead of a bitmap. It is 1000x better on performance, and it's certainly okay to draw/clear a render texture every frame :). In general, only use Bitmaps if you are doing advanced image manipulations, the sort of stuff you do in photoshop like hue and saturation shifts.
  12. K, first of all, realize this is a Phaser forum so posting game maker code, without specifying what it is, is going to create a lot of confusion. You also need to be more specific. Is your objective simply to draw sprites with a for loop with random coordinates? Simple: for(var _x = 0; _x < width; _x++){ for(var _y = 0; _y < height; _y++){ var min = 100; var max = 500; game.add.sprite(game.rnd.between(min,max),game.rnd.between(min,max),'textureKey'); } } But that will give you sprites in random xy coordinates between 100 and 500. It won't keep them in a grid like your GIF suggests you want them to be in. Now we need to know if you want to continually draw sprites or just draw once. Do you want to remove all the sprites and redraw periodically, like your GIF suggests?
  13. I use all of those hacks, extensively, except, in the back of my mind, I'm always thinking "these obscure CSS properties aren't going to work in every browser."
  14. not to mention webgl is notoriously bad at rendering fonts. i've seen a single line of text cutting the framerate in half in webgl. The only advantage of having UI inside the canvas is that it does feel more integrated, and you don't have to worry about weird stuff like the browser giving blue highlights to UI elements when the player drags the pointer. You also have access to all of the special effects and animations the canvas is capable of. Nonetheless, I think the pros of HTML/CSS outweigh the cons, by a long shot.
  15. I can't see why anyone would use canvas for UI, when they could just as easily use plain HTML/CSS.