JakeCake

Members
  • Content Count

    82
  • Joined

  • Last visited


Reputation Activity

  1. Like
    JakeCake got a reaction from drhayes in Make Jpeg Transparent   
    I agree with matt; transparency in png is a built in mask, so why overcomplicate? If you like the compression-rate of jpeg over png I suggest you take a look at some good png-compression like on https://tinypng.com/
    You can get just as good results with png compression as jpeg.
    EDIT:
    I myself use a gulp task to take my loseless PNG-files and combine them into texture atlases and then pipe them into a compression task using gulp-pngquant. So I am always working with uncompressed png-files, but the final build will be compressed based on settings I can always change for quality over size. For my next project I might even move to working purely with photoshop files and have a task to convert my photoshop files into pngs.
  2. Like
    JakeCake got a reaction from Vishal Gupta in Make Jpeg Transparent   
    I agree with matt; transparency in png is a built in mask, so why overcomplicate? If you like the compression-rate of jpeg over png I suggest you take a look at some good png-compression like on https://tinypng.com/
    You can get just as good results with png compression as jpeg.
    EDIT:
    I myself use a gulp task to take my loseless PNG-files and combine them into texture atlases and then pipe them into a compression task using gulp-pngquant. So I am always working with uncompressed png-files, but the final build will be compressed based on settings I can always change for quality over size. For my next project I might even move to working purely with photoshop files and have a task to convert my photoshop files into pngs.
  3. Like
    JakeCake got a reaction from mattstyles in Make Jpeg Transparent   
    I agree with matt; transparency in png is a built in mask, so why overcomplicate? If you like the compression-rate of jpeg over png I suggest you take a look at some good png-compression like on https://tinypng.com/
    You can get just as good results with png compression as jpeg.
    EDIT:
    I myself use a gulp task to take my loseless PNG-files and combine them into texture atlases and then pipe them into a compression task using gulp-pngquant. So I am always working with uncompressed png-files, but the final build will be compressed based on settings I can always change for quality over size. For my next project I might even move to working purely with photoshop files and have a task to convert my photoshop files into pngs.
  4. Like
    JakeCake got a reaction from Alexalten in Make Jpeg Transparent   
    I agree with matt; transparency in png is a built in mask, so why overcomplicate? If you like the compression-rate of jpeg over png I suggest you take a look at some good png-compression like on https://tinypng.com/
    You can get just as good results with png compression as jpeg.
    EDIT:
    I myself use a gulp task to take my loseless PNG-files and combine them into texture atlases and then pipe them into a compression task using gulp-pngquant. So I am always working with uncompressed png-files, but the final build will be compressed based on settings I can always change for quality over size. For my next project I might even move to working purely with photoshop files and have a task to convert my photoshop files into pngs.
  5. Like
    JakeCake got a reaction from WombatTurkey in Game inventory   
    I like to have one class per file, so I would have put your Inventory inside a separate file and then do this.inventory = new Inventory() in your player class.
    Either way it's fairly nice code, you divide responsibility in a good way. If your player is the only one ever to use an inventory I think what you are doing is perfectly fine and won't populate the global scope as bad as my "one class per file" will do.
    So go on along the path you're on, it looks good.
  6. Like
    JakeCake got a reaction from jdnichollsc in Phaser 2.4.7 is released   
    Also just wanted to let you know that upgrading 2.4.6 -> 2.4.7 went without problems.
    Where can I read more in details about the new Camera shake effect? I wrote my own one for my current project, but if the built in is better and easy to implement I might as well switch to it.
  7. Like
    JakeCake reacted to rich in Phaser 2.4.5 + 2.4.6 Released   

    Update: 2.4.6 is now out, which addresses 2 severe issues in 2.4.5.
    I'm very pleased to announce that after a lot of work Phaser 2.4.5 is now released:
    http://phaser.io/news/2016/02/phaser-245-released
    There are over 85 improvements across the whole API. From things like Dolby Digital Sound support and integration of the EarCut library, to lots of fixes and documentation updates.
    Personally I'm really pleased with this release. After a lot of hard work I managed to get the GitHub issues count down from over 160 issues to just 43, and none of the remaining issues are critical priority. Many thanks to the patrons who support me in doing this (otherwise mostly thankless!) work.
    Phaser LTS
    Due to on-going development of Lazer, Phaser is soon to enter the LTS (long-term support) stage of its life. This is when we impose a feature freeze, locking the API down and responding only to bugs. This is a necessary step to allow us to focus on Lazer while still ensuring Phaser is given the support it deserves. Thousands of developers use Phaser and we've no intention of ignoring that. However with the release of 2.4.5 we will now be moderating issues opened on GitHub to this effect.
    Onwards and upwards
  8. Like
    JakeCake got a reaction from patrickfabrizius in What is FragmentShader and how to use it?   
    Shaders have a steep learning curve, as it is very low level; right down on the GPU, but take a look at http://glslsandbox.com. These are all shaders written in GLSL (Open GL Shader Language) that can pretty much be copy-pasted into a Pixi filter as the filter is just a layer on top of the shader.
     
    Shader's are powerful, but hard to do properly, so don't expect great results immediately. They are fun to play around with though
  9. Like
    JakeCake reacted to rich in Enabling WebGL 2.0 for your HTML5 Games   
    Yes there will be a Lazer WebGL2 renderer very soon (not one for Phaser though, sorry)
  10. Like
    JakeCake got a reaction from Darker in What is FragmentShader and how to use it?   
    Shaders have a steep learning curve, as it is very low level; right down on the GPU, but take a look at http://glslsandbox.com. These are all shaders written in GLSL (Open GL Shader Language) that can pretty much be copy-pasted into a Pixi filter as the filter is just a layer on top of the shader.
     
    Shader's are powerful, but hard to do properly, so don't expect great results immediately. They are fun to play around with though
  11. Like
    JakeCake got a reaction from drhayes in Building in-game UI   
    Just wanted to drop my opinion here, as it seem like you have come to a conclusion that I am entirely against.
     
     
    Anything related to the game should in my world stay inside Phaser's canvas, and this is for a bunch of reasons:
    Publishing to a game website. You will most likely be able to publish a canvas game or a flash game, but their system will almost certainly not enable you to publish a bunch of HTML. Publishing to mobile. Wave farewell to Canvas+ on Cocoon, hence a performance lose. This is because the DOM, besides the canvas element has been stripped away to maximize performance. Performance generally. The canvas, at least in WebGL mode, is faster at rendering graphics that is updated each frame than the DOM is. ​Unnecessary redrawing of the entire DOM is expensive. If you update anything on the DOM, you might - often depending on the browser - run into a scenario where the browser will have to redraw the DOM because something changed. Say you add a 1px border on hover on something on your GUI, then everything beneath it is pushed down 2px and everything has to be drawn again. This may give very high lack spikes depending on what's on your site and how complex that GUI is going to be. I could probably go on for a while, but it's not entirely black and white, as there are of cause pluses to using the DOM for UI as well, but I think they are heavily outweighed. While the "don't reinvent the wheel" is always a good point, just remember that HTML was not meant to create game UIs, it was meant for mostly static websites. The canvas on the other hand was meant exactly for this kind of stuff, so use it.
     
    I would love to point you somewhere where we can share our Phaser UI modules, but I don't know if such site exists. It would be awesome though
     
    If you're good at constructing JavaScript and know basic programming far enough to extend classes and such, then creating the UI in game with Anchor-points, events and stuff is not a big deal. Phaser even has the Button class built in I believe, you can just extend that for the rest of the components.
  12. Like
    JakeCake got a reaction from Dower in Static starfield with some blinking stars   
    In the past I handled it with a shader (called filter in Phaser). See if you can find something on glslsandbox.com or maybe in the Phaser examples under filters.
     
    Shaders are a tough topic, especially if you don't know anything about graphic engines beforehand, but if you can find something close enough, you might be able to get along by copy/pasting and twerking a few variables.
     
    By using a shader you will see good performance, you'll be able to tweak the number of stars, speed of flickering stars etc. dynamically with ease through uniforms and the code will only take up a few kilobytes compared to using a large png.
  13. Like
    JakeCake got a reaction from Skeptron in Building in-game UI   
    Just wanted to drop my opinion here, as it seem like you have come to a conclusion that I am entirely against.
     
     
    Anything related to the game should in my world stay inside Phaser's canvas, and this is for a bunch of reasons:
    Publishing to a game website. You will most likely be able to publish a canvas game or a flash game, but their system will almost certainly not enable you to publish a bunch of HTML. Publishing to mobile. Wave farewell to Canvas+ on Cocoon, hence a performance lose. This is because the DOM, besides the canvas element has been stripped away to maximize performance. Performance generally. The canvas, at least in WebGL mode, is faster at rendering graphics that is updated each frame than the DOM is. ​Unnecessary redrawing of the entire DOM is expensive. If you update anything on the DOM, you might - often depending on the browser - run into a scenario where the browser will have to redraw the DOM because something changed. Say you add a 1px border on hover on something on your GUI, then everything beneath it is pushed down 2px and everything has to be drawn again. This may give very high lack spikes depending on what's on your site and how complex that GUI is going to be. I could probably go on for a while, but it's not entirely black and white, as there are of cause pluses to using the DOM for UI as well, but I think they are heavily outweighed. While the "don't reinvent the wheel" is always a good point, just remember that HTML was not meant to create game UIs, it was meant for mostly static websites. The canvas on the other hand was meant exactly for this kind of stuff, so use it.
     
    I would love to point you somewhere where we can share our Phaser UI modules, but I don't know if such site exists. It would be awesome though
     
    If you're good at constructing JavaScript and know basic programming far enough to extend classes and such, then creating the UI in game with Anchor-points, events and stuff is not a big deal. Phaser even has the Button class built in I believe, you can just extend that for the rest of the components.
  14. Like
    JakeCake got a reaction from Bobcp in How to create a build from Phaser 2.4.4   
    From the repo, I see there is a Grunt file, so I assume you need to install Grunt on your machine and build the project yourself then.
    You will need Node (which includes npm) to install and run Grunt. I suspect everything you need to know can be found here: http://gruntjs.com/getting-started
    I am more of a Gulp guy myself, so I can't tell you the exact details like I could if it was build using Gulp.
     
    Good luck
  15. Like
    JakeCake got a reaction from MichaelD in How to create a build from Phaser 2.4.4   
    From the repo, I see there is a Grunt file, so I assume you need to install Grunt on your machine and build the project yourself then.
    You will need Node (which includes npm) to install and run Grunt. I suspect everything you need to know can be found here: http://gruntjs.com/getting-started
    I am more of a Gulp guy myself, so I can't tell you the exact details like I could if it was build using Gulp.
     
    Good luck
  16. Like
    JakeCake reacted to InsOp in Phaser 2.4.0 "Katar" Released   
    Hey im getting this error
    when i just reference the javascript file in my html-head. no function called.
    RC 2 just worked perfectly.
     
    Edit:
    shouldve rechecked the github. a fix already is available. thanks, now it works like a charm
  17. Like
    JakeCake got a reaction from Pooya72 in System to detect on-ground with p2 physics   
    Hi, I have this character that I need to play a walking animation for while on-ground, but a jumping animation when not. I am using "body.onBeginContact()" & "body.onEndContact()" to set a variable "onground" = true/false to choose which animation should play. Since my terrain consist of a bunch of polygon, making for a somewhat edgy ground, my character will needless to say sometime bounce a little bit off the ground, calling these two events very quickly in succession.
     
    This happens quite a lot, meaning the player very quickly, just while running along the ground, switches between the two animation modes, which is my first problem.
     
    In addition to this problem, there seems to be times when "body.onEndContact()" is called but "body.onBeginContact()" is not called afterwards, so even though the character is standing on the ground he is not considered to be colliding, so I think I need some other function to check for collision as this is erroneous.
     
    I am asking anyone here if they have had the same problem and found a good solution. A good solution would in my books be something that can tell if two bodies are touching or have touched within the last few frames or x milliseconds.
     
  18. Like
    JakeCake got a reaction from kray in How do I read an image from an atlas?   
    Property "gravity" is part of the body, not the sprite. So it is actually the body that is null, not the sprite "letter". To add the body to the sprite, use:
     
    game.physics.arcade.enable(letter);
     
    After that you can set the properties of the body.
     
    I don't know about arcade physics, as I normally use p2, but you might have to enable the physics system before the above command will work.
     
    EDIT: Also, you can use the one-liner "this.add.sprite(x, 0, 'alphabet', a.png);" instead of setting the frameName in the next line, but that's up to you.
  19. Like
    JakeCake got a reaction from spinnerbox in Downloadable content with Phaser.   
    Normally you do loading in the preload function, but you can just create a new loader object and use that. If you are switching states anyways, which it sounds like something you would do, you can just use the preload function.
     
    It is definitely possible. I currently do just that. In my boot function I load the necessary graphics and audio for the loading screen, where I then load in most heavy assets. Then in the individual levels I load in graphics specific to that level.
  20. Like
    JakeCake got a reaction from hex13 in The Phaser 3 Wishlist Thread :)   
    I would love to see some tools made exclusively for Phaser for polygon-mapping. I know the examples points you to PhysicsEditor, but you need a license, and it's honestly not that complicated a tool. I'm sure someone could do it in a couple of weeks, otherwise I might. It could be written in HTML5 JavaScript even.
     
    To take it a step (long step) further, an entire editor made for Phaser would be awesome, since it was hell for me to pick an editor. Just like Unity has a terrain-editor, code-editor and much more in the very same tool, making this for phaser would be awesome. A simple HTML & JavaScript editor with inclusion of Phaser and a selection to choose your version/update the version for your project, with a tab for a physics-editor and one for tilemap-editor etc. etc. would be slick and help people get started faster and not rely on 5 different tools.
  21. Like
    JakeCake reacted to JakeCake in More control over antialiasing   
    In the game creation it is possible, by the 7th parameter, to choose to use antialiasing or not, but is there a way to control the level of it?
     
    In my game, disabling it ensures 60fps at all times, but having it on puts me down to about 40fps. It definitely looks a lot nicer, but it also seem to be very expensive, on my system at least.
     
    Considering the major difference from on/off I suspect antialiasing is at more than 2x, but I am unable to confirm this. What I am looking for is somewhere in between, where it still looks alright and the performance difference is not as major as now. Where do I control this stuff?
     
    Also, questions that has to do with rendering stuff, should I rather ask them in the PIXI forum from now on? That is good to know.
  22. Like
    JakeCake reacted to enriqueto in Phaser 2.1.3 "Ravinda" is Released   
    when showing the physics bodies all circles are half their size
  23. Like
    JakeCake got a reaction from Tom W Hall in CocoonJS - game performing worse in WebGL than in canvas mode   
    So after some more research it seems that this is a somewhat known issue, and at the moment (29-June 2014) using WebGL is a no-go as CocoonJS has some problems managing textures, which leads to some GL errors, which leads to very poor performance in WebGL mode.
     
    In my own project I did manage to raise the frame-rate in WebGL mode from 3FPS to ~20FPS, and in Canvas mode from 25FPS to ~55FPS by removing all "game.debug.text()". Apparently there is an issue with PIXI's rendering of text in CocoonJS. Even a single line of text can half your frame-rate, in an otherwise complex scene.
     
    So for anyone else out there, just disable all text-rendering and render without WebGL for now.
     
    I have faith that Phaser 2.0.6 will fix some of the issues, and eventually WebGL will be viable in CocoonJS.
  24. Like
    JakeCake got a reaction from lukaMis in CocoonJS - game performing worse in WebGL than in canvas mode   
    So after some more research it seems that this is a somewhat known issue, and at the moment (29-June 2014) using WebGL is a no-go as CocoonJS has some problems managing textures, which leads to some GL errors, which leads to very poor performance in WebGL mode.
     
    In my own project I did manage to raise the frame-rate in WebGL mode from 3FPS to ~20FPS, and in Canvas mode from 25FPS to ~55FPS by removing all "game.debug.text()". Apparently there is an issue with PIXI's rendering of text in CocoonJS. Even a single line of text can half your frame-rate, in an otherwise complex scene.
     
    So for anyone else out there, just disable all text-rendering and render without WebGL for now.
     
    I have faith that Phaser 2.0.6 will fix some of the issues, and eventually WebGL will be viable in CocoonJS.