moe091

Members
  • Content count

    30
  • Joined

  • Last visited

About moe091

  • Rank
    Advanced Member

Recent Profile Visitors

376 profile views
  1. Passing array into shader/filter

    SOLVED - In case anyone else stumbles across this trying to solve a similar problem. to pass an array of vecs to a shader, use type: '3fv', for e.g. a 3d vector. basically just add v to the end. Then for the value, pass in a straight js array of floats. In this case(3fv), pass an array with 6 elements to create an array with 2 elements(each of which is a 3d vector). GLSL automatically maps the array to the vector. e.g: customUniforms = { arr: {type: "3fv", value: [0.0, 0.1, 0.2, //arr[0].x = 0.0, arr[0].y = 0.1, arr[0].z = 0.2 0.3, 0.4, 0.5, //arr[1].x = 0.3, arr[1].y = 0.4, arr[1].z = 0.5 0.6, 0.7, 0.8]} //arr[2].x = 0.6, arr[2].y = 0.7, arr[2].z = 0.8 }; then, in glsl, declare it like this: "uniform vec3 arr[3];" and access the elements of arr as shown in the comments of the uniform declaration above. For a straight array of floats, just use 1fv. Then you can use it just like an array of floats in your GLSL code, instead of vectors. You can make it any length you want, just make sure when you initialize the variable in your GLSL it has the same size as the array that you are passing to the uniform(in the case of '1fv' that means if your array has 9 elements then you should declare it in your shader as 'uniform float arr[9]' - if it's a vec3('3fv') and you pass an array with 9 elements, it should only have length 3: 'uniform vec3 arr[3];' because each 3 elements of the array creates a single vec3 element). If anyone has any more questions reply here and I'll try to answer you if I can
  2. Passing array into shader/filter

    I've recently started learning about shaders to create a lighting system for my new game(Will probably release it for other Phaser developers to use in their game when it's done). I've got the basics down but have a question about how to use shaders/filters in Phaser. I managed to figure out how to pass floats and different sized vectors to a shader as a 'Uniform,' and wrote a simple shader to create a single light by passing in a vec4 containing data describing the light, but now I want to expand that to implement any number of lights in a given level and add functionality to my level editor to create/modify lights. I figured the easiest way to do this would be to just have an array of vec4's containing data for each light. I managed to create 2 lights in a level just to test that it worked with my shader algorithm and it did, but to do that I just had 2 uniforms named light1 and light2, which obviously isn't expandable. I know GLSL supports matrixes, which are basically an array of vectors(which in turn is a basically an array of floats). If I could find out how to create matrices that MIGHT work, unless I'm limited to 4x4 matrices. It'd be preferable to create an array of vectors but if anyone knows how to create a Uniform of either type it'd be helpful. Basically, what I need to know is 1. how to define the type (e.g: type: '4f', for a 4d vector), how to define the uniform object (e.g: {x: 1, y: 2, z: 3, w: 4, for a 4d vector), and how to access it in GLSL(though I could probably look this one up on my own if I could figure out how to create array uniforms in phaser). Btw - right now I'm applying a single shader to the world that creates all of the lighting effects. I just thought while I was typing this up, instead of using an Array would it be possible/more optimal to either create a separate shader for each light and apply it to the world, therefore cutting out the need for array uniforms because I'd just have an array of shaders instead? Or maybe create a tiny transparent sprite for each light, add the lighting shader to the sprite, and position the sprite wherever I want? that would make it easier to implement creating/editing lights in my level editor, but I've had some confusing results when applying shaders/filters directly to sprites in Phaser and also I don't know how that would effect performance. Sorry this was a bit of a long post, thanks for the help - I have more questions below but this was already pretty long and this first question is the only one that I might not be able to figure out on my own eventually. A few bonus questions for anyone who is experienced with shaders and wouldn't mind answering some questions to save me a lot of time looking stuff up: Right now my lights are very basic, they have x/y for position, z for strength, and w for size. I'd like to include more data to define color, dropoff, etc. Is there a better way to do this? I was thinking I'd just make 2 vector arrays, one for the position, strength, and size of the light, and another for rgb values and dropoff rate, and just make the indices match for each light and grab data from each array. Also, it seems 'Filters' are only capable of fragment shaders, is this correct?(I don't quite know all the difference between the different types of shaders yet but I'd like to know as I learn more because it will probably become relevant). I've also noticed some weird behavior when applying a shader to a sprite directly(as opposed to the world). Specifically, something seems off the the coordinates of the sprite/fragments in the world. I don't know enough to figure out what yet, but is there any known quirks/issues there that I should know about or am I probably just doing something wrong? And finally, as I was writing this post I thought of another approach to creating multiple lights(if the array thing doesn't work out, or even if it does this may be a better approach): I could make a blank sprite for each light, and apply the shader to that sprite. Then I don't need to use arrays to define all of the lights, each sprite will have a shader with one light. Would this work? Would it be better/worse performance-wise than just applying the light shaders to the world? And would that mean I would have to have a blank sprite that is as big or bigger than the entire area the light effects, could I just have a 1x1 transparent sprite and apply the light effect all around, or can shaders only effect pixels that are a part of the sprite(I'm thinking that since the shader runs for every pixel on the sprite, and you use gl_FragCoord to get the coordinates of the current pixel, there'd be no way to access and modify sprites outside of the sprites area. However I think I've seen shaders that do effect a greater area than the image they are applied to, is there a function in GLSL that retrieves different fragments/pixels given their coordinates and allows you to modify the gl_FragColor of any fragment you choose?
  3. Hey, I'm an experienced programmer looking for work making html5 games. I usually make my own games and try to make money selling to publishers, but I'm in a tough spot financially right now and I need to make money quick, I can't wait months to get paid by a publisher. I'm looking for any job that I can start asap and that I can get paid on as soon as I'm finished. I like working with phaser andeck I'm really good with it, so I'd prefer a job that allows me to work with phaser but I can do other jobs if necessary. Also, I'd prefer not to have to do any art but I can make decent 2d graphics if necessary. When I get on my home computer later today I'll post some pictures of my art from previous html5 games I've made. I'm in urgent need of money so I will work VERY quickly, spending many hours each day on your project until it's done. I'm also willing to work relatively cheap, I don't have time to seek out the best paying job right now and as long as I make enough to get me by until I receive payment for the last couple licenses I sold I am okay. **This is an opportunity to get a professional developer to develop your game very quickly!** email me at moe091@gmail.com, or respond/message me on here to talk more. Looking forward to hearing from you! -Maurice N
  4. Full 2D - experienced artist for hire

    Would you work for a 50/50 split on an already completed game that just need the placeholder graphics replaced(assuming the game was high quality aside from the ugly programmer art)? Very soon I'll be looking for an artist to do the graphics on a fast-paced breakout-based game that is very fun and works great as a mobile browser game, I'm confident sponsors would be interested if it had the right graphics. I was thinking of going with a cute cartoony graphics style but would give the artist a lot of freedom to do whatever they think looks best. If you think you'd be interested message me here or email me at moe091@gmail.com and I'll contact you soon when it's 100% ready to see if you're interested. I won't waste your time with an incomplete or low-quality game. I may also want to hire someone to revamp the graphics on a couple old unreleased games I have but I don't want to get into that until my current project is completed. Btw, your portfolio was pretty impressive, I really like your style.
  5. Hmm, thanks a lot for the input. I had a couple ideas for increasingly difficult obstacles to add as the levels went on, but i wasn't sure if they were needed or it would just clutter the simple gameplay. Your post convinced me to add a few. I'm probably going to add sharks, which will swim in from the side and go straight across the screen and off the other side. They'll be unkillable and move quickly, but I'll add a warning effect to the side of the screen the shark is going to come from so the player has time to prepare(it won't give away the exact location, just the side the shark is going to swim in from; perhaps a flashing red light shining over whichever side of the screen a second or two before the shark comes Another idea is fish hooks that drop in from the top, They'll drop in and instead of just staying still in the water they'll constantly be dropping down or reeling up, it'll bob up and down a few times before going up. You'll be able to steal the bait(and get a hefty point bonus) if you grab it while it's dropping down, but if you hit the hook while it's reeling back up it'll be game over. I'll probably make them drop quicker and for a shorter time and reel up slowly and for a longer time to make it difficult and risky to steal the bait. And idk if it'd be taking it too far, but I might add a few different kinds of bait on the hooks, some will be worth more points but more difficult to steal because they drop faster/reel up longer on the hook making them more difficult. Does that sound like overkill? Do those ideas sound like they'll add a good dynamic to the gameplay? Do you think that'll be enough? Anyone else have any ideas? I'm also changing it so that your fish wins against the others in head-on collisions(my girlfriend pointed out that it felt wrong to get eaten by a clownfish as a piranha in a head-to-head battle). and I'm adding a play-through tutorial, I don't know whether to make it optional or mandatory though. Another thing my gf pointed out to me is that the swipe controls need to be more sensitive, oftentimes she would swipe but her finger wouldn't slide far enough to make the fish change direction. Anyone else have that problem with the swipe controls or is it just her swipe technique? I could fix it by making the more sensitive(but then it'll be easier to swipe the wrong direction by accident) or I could add button controls, where there are just 4 arrows to tap for each direction. Think it's needed? sorry for the tons of questions,, thanks to anyone who actually reads this. And TurnA, thanks a ton for the feedback! I'm actually adding a lot to the game just because of you
  6. EDIT: Based on feedback I received from other testers I am changing a few things around, in addition to adding the tutorial and the other things I was planning on adding. You can still play the game get a sense of the gameplay and so I can get some more feedback, but just know that it will be changed a lot to be made more accessible for new players(I was the only one to play it up until recently so I kinda failed to make it easy enough for new players, in addition to the complete lack of instructions except for the text I added on the main screen at the last second) Here is my current game (Minus the directions screen and a few minor visual changes, plus I still gotta add code for local high scores): https://dl.dropboxusercontent.com/u/268817464/Arrows/index.html I obviously don't plan on keeping that hideous directions text right on the main screen, but I don't really know where to put the instructions. Does anyone have an suggestions? Maybe display them in the actual game the first time the user plays it? Also my menus seem a little boring, does anyone have any suggestions how to make them look better? I am looking for sponsors for this game, It may be early to start looking but I figure it can't hurt to let everyone know. The game is 99% done and you can definitely tell what it's going to be like when it's 100% complete. Also if any sponsors had specific requests for features/changes to the game I never mind implementing them as long as it's not too time consuming. Email me at moe091@gmail.com or post here if you're interested. I'm thinking about adding another gameplay mode called 'Survival' where there are no points, you just have to live for as long as you can. It'll be a lot harder to live because everything will move faster(you and the enemy fish) and I might make the fish spawn more often. Any thoughts on this idea? I'll probably code it up one day this week just to try it out as it shouldn't take long at all to do. I'd love to hear anyone comments/criticism about the game, please post if you tried the game and have anything to say about it! And for anyone with experience selling games to sponsors, is this game high enough quality to warrant selling licenses for a reasonably low price? I know it's not very big or anything(My project folder is under 1.5mb and I could shrink it some more) but it's actually a pretty fun and addicting beat-your-score type game with decent graphics and (once I add a the few things left to add) plenty of polish. But of course that's just my own biased opinion, what does everyone else think?
  7. Collision Callback

    do you mean the phase as top/left/right/bottom? If so you can use body.touching.left or body.touching.top to check which side of your body is touching something. e.g if body.touching.left == true then the left side of your sprite is hitting something. if you mean you just want to find the actual object that your are colliding with, you can use the game.physics.collide function like in this example : http://examples.phaser.io/_site/view_full.html?d=collision&f=sprite+vs+sprite.js&t=sprite%20vs%20sprite or go to examples.phaser.io for more examples
  8. Adding properties to sprite class

    yah the sprite.owner thing works fine now, I don't know what was happening before. And thanks a ton guys I understand what was going on with the onKilled thing now, and I learned a bit more about javascript .
  9. Adding properties to sprite class

    I'm still pretty new to javascript so there are a lot of thigns i don't understand. One thing that would be useful for me in my phaser games is if I could add a reference to my gameobject inside the gameObjects sprite object. I use gameobjects to represent things like enemies and the enemy object has a reference to its sprite, maybe I need to stop trying to force java style OOP into javascript so much, but I already have a large game coded this way so I'm not about to go back right now. Anyway I tried just adding this.sprite.owner = this into my gameobject constructor but it's giving me undefined when I try to access sprite.owner in other parts of the code. Is it possible to get the behavior I'm going for? Am I doing it wrong? Are there any other solutions to my problem? the reason I want to do this is because there are a lot of callbacks(collision for instance) that pass the sprite object to a function, but I need to operate on the sprites GameObject in the collision reaction function, so isntead of looping through all the gameobjects and checking if their sprite matches the gameobjects sprite to figure out which gameobject it belongs too, I could just use sprite.owner. Another side question. In my GameObjects prototype object I have a die() function that makes an explosion animation and adds points to the players score and everything. I used to call it when the objects health went <= 0 but I recently learned that phaser has health and alive variables along with convenient accompanying functions like revive(x, y, health) that I could use to reuse my sprites more easily, so I'm switching over to using the built in phaser methods/properties. The problem is setting the onKilled event callback of the sprite to call the die() method. In the 'constructor' function I have this.sprite.events.onKilled.add(//stuff goes here); and I the //stuff goes here part to call the die() method, which exists inside the GameObjects prototype(same gameobject who's constructor that line of code is in). I can't figure how to do it at all, I tried a bunch of different things but I just don't have the understanding of javascript(mostly scope it seems) to figure out the right way to do it. I can't just put this.die(); or die() or Enemy.die() or Enemy.prototype.die() or this.owner.die() in there because they all give me various errors, it seems like I'm way off. Anyway I hope someone can help me with either one of these problems, thanks a lot everyone EDIT: It would help me a lot if soemone could just explain what the 'this' refers to in code that looks like this: function Enemy(sprite) { this.sprite = sprite; this.sprite.events.onKilled.add(function() { this.//WHAT IS THIS REFERRING TO HERE? });}Enemy.prototype = {//...
  10. Optimizing for mobile

    Wow thanks a lot, didn't expect to get such a good answer . I've already done some of these things but there's a few tips here that should help me out a lot
  11. I have a few questions about optimizing mobile html5 games that I haven't come across an answer to yet in my searches. I'm mostly asking in regards to canvas performance because I assume the webgl enabled browsers aren't the ones that are going to have the biggest performance problem(and I'm using phaser with it set to swap between webgl/canvas depending on whether or not the device can use webgl). First Question, is it faster to draw images that have less colors? I know using less colors in a sprite or background will obviously reduce the file size leading to less RAM usage but I feel like my game is bottlenecked by CPU usage rather than ram, so I'm wondering if the actual process of rendering an image is faster for images with less different colors. And if not will lowering the ram usage make a difference on performance in anyway even if my game is mostly just limited by CPU? Second, For my background I have a black image with a bunch of white stars on it that scroll downward to give the illusion that my ship is flying forward. Would it be more efficient if I just set the games background color to black and then made png with just the stars and a transparent background, so it'd essentially look the same but my background would be mostly transparent. Or would it still take just as long to draw the image? 3rd, One optimization I just implemented is breaking up my main loop into different parts based on how often they need to be executed. For example the part that scans through all the sprites and checks if they're off screen and recycles the objects if they are used to be called every frame but now I'm just calling it once a second. And the update method of my enemies that basically just changes their velocities based on an algorithm to move them in a pattern and checks when they should perform actions such as shooting is only called once every 100ms now, the only things called every frame are the Phaser physics.overlap calls and the line that scrolls my background image. Is this safe to do? I haven't had any problems on my test devices but it just feels like a really dirty fix. And if this is safe, can anyone think of any ideas on how to improve it? I'm thinking of increasing the interval to check if enemies have traveled off screen from 1 second to around 3. I pretty much halved the amount of total time spent in my main game loop by implementing these changes already. And can anyone tell me other ways to optimize my game so I can squeeze the most performance I can out of it? I'm using Phaser so if anyone knows any phaser tricks that'd be great. If you know of any good resources about optimizing javascript code I'd b interested in that too, I've been reading about that on my own a bit already. I feel like my game should be running faster than it is, On really old phones(~512 ram and ~1gig processor phones that i've tested on like the samsung epic) I can't reach more than 30fps even when theres only 5 or 6 sprites plus the background on the screen. Is this normal or am I doing something wrong? Lastly, this is kind of unrelated but I am really curious about it, if my game won't run on phones older than say a galaxy S2 is that going to be a problem in terms of getting it sponsored? I just don't think I'm going to be able to improve the performance enough to make that work and it's a pretty big game that I've spent a lot of time on. Is it normal for games to not run well on older phones like that? Does anybody know what kind of things tend to slow Phaser/html5 games down so I can make sure I'm not doing any of them? Thanks for reading my long post, I hope someone can help me or ease my mind about performance on older phones.
  12. Oh and Haden, I am curious if your phone lags on a lot of html5 games or if it's just mine? If you read this could you do me a huge favor and let me know how my game compares to most html5 games? Thanks a lot for your input though it helps a lot because I only have 5 working phones to test with. If anyone who has experience selling games to sponsors reads this could you give me your opinion on whether it'll be a problem that my game lags on on older phones? I'm hoping I can get away with it because it is going to be pretty sizeable game compared to other html5 games but I still plan on doing a lot of optimizing before I release it.
  13. Ooh you gave me the idea of adding enemies that aren't actually ships, that just sparked a few different ideas in addition to the black hole thing that I want to try out . As for the end level screen and the upgrade screen, I honestly just haven't gotten around to finishing them yet. I'm thinking about hiring an artist to re design the screens so I was going to wait to after I did that to finish programming them, but since I'm not sure if I'm going to find an artist I'll probably finish up both of those parts today, and I'm definitely going to include the health upgrade too. I keep trying to make easier levels for the first 3 or 4 levels, but every time I try I just end up with a level that was much harder than I expected :/. If I ever manage to make any easier but still fun levels I'm going to bump the current levels up to number 5 6 and 7 and create some easier ones for the first 4. I'm just having trouble designing a level that is fun but that will be easy enough for a casual player. Once the upgrades are done it will be easier to beat the levels to
  14. Okay I fixed a lot of the problems with the game and made a real level now just so I could get some more relevant feedback, if anyone has the time could you just do a quick playthrough of the first level and let me know what you think? The things I mostly need feedback on are: Performance, What kind of phone are you using and what was your fps, did you have any lag spikes or unplayable framerates? Level design, I know the current level is pretty hard for level 1 but does anyone have any criticism or even general tips about designing levels for such a game? I'm kinda happy with my first level but I feel like I'm already running out of ideas. Enemy Types, what do you think of my current enemy types and do you have any ideas for new ones? Graphics, I know I need to redo my menu screens but I don't know how to go about doing it and I can't afford to hire anyone. Anyone have suggestions for an easy style/method I could use for making acceptable looking menu screens? And do you have any suggestions on what I should change about the actual game graphics? Should I change the little HUD graphic at the top of the game that shows health/points? after I make the necessary graphics changes and finish the game, do you think this game will be high enough quality for any publishers to want to license? What should I do to make it more 'licensable.' Those are just the things I'm currently worrying about, I'd greatly appreciate any tiny bit of feedback about any aspect of the game though. And Biscuit, I was on your game portal for a while last night and I really like the layout/site design. Is the mobile section supposed to be blank still? And are you planning on adding mobile games to the site soon? I can't really think of any suggestions because everything is already done much better than I'd be able to do. The lights out feature is pretty awesome, I don't know if most portals have that but this is the first time I noticed it on any game sites. One thing I did notice is that your Heliwars game isn't working for me, the loading screen flashes for a split second and then I just get a blue box. Not sure if this is related but I inspected the page in chrome and I had 3 Failed to load resource errors similar to this: Failed to load resource: the server responded with a status of 400 (Bad Request) http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-024944867656358…0&eae=0&vis=1&fu=0&ifi=6&xpc=Anu0M5GRCe&p=http%3A//gamegetter.com&dtd=1528
  15. Yah I definitely plan on including sound effects and possibly music before I finish, It's just that audio is such a headache in html5 so I'm basically just procrastinating on implementing it right now, it'll be included before the game is released for sure though. Thanks for the interest in the game btw, did you play it on a phone or computer? If you played it on a smartphone would you mind letting me know what kind of phone it was and how well the game ran? I am just trying to make sure it's not lagging on any devices before I go and add a bunch more stuff to it. Let me know if you have any other suggestions or criticism, the game is still far from done so it's hard to judge at this point but if you have any cool ideas or notice any problems I'd love to get some input. Btw I'm about to go check out your game portal, I'll be sure to give you some feedback when I'm done.