cdrch

Members
  • Content Count

    13
  • Joined

  • Last visited

About cdrch

  • Rank
    Member

Profile Information

  • Gender
    Male

Contact Methods

  • Twitter
    cdrchdev
  1. I am attempting to develop a method of procedurally generating images for a game that I am making with Ga. The actual generation is not relevant here; my question is how do I turn an image on an HTML5 canvas into a Ga sprite? By default, Ga sprites accept a link to the source name, which is normally loaded in by ga.assets.load(), either at the start of the game or when called. However, I see no easy way to instead pass, say, a dataURL or other format easily obtainable from a (hidden) canvas. Or, alternatively, how can I develop an alternative to ga.sprite that acts exactly the same except for using my created images from a canvas instead of loading a source from disk? Link to Ga: https://github.com/kittykatattack/ga Ga.Sprite: https://github.com/kittykatattack/ga/blob/master/ga.js#L1461 Ga.Assets: https://github.com/kittykatattack/ga/blob/master/ga.js#L2065
  2. My apologies for the delay in announcing that. Yes, the survey was closed as of yesterday morning. Thanks to everyone who participated!
  3. The purpose is to gather some data on any link between choosing public engines, well-known frameworks, or a homebrewed codebase and optimism in regards to completing a project as a new developer. In the past, I've noted that more than a few people new to game design and development would tend towards the extremes of either trying to create as much themselves as possible, building an engine from the ground up, or else trying to find some pre-existing framework or engine that allowed them to do as little work as possible that was not unique to their idea. In recent years, I've noticed a more even spread, with many frameworks and engines being popular among both the newcomers who desire to jump in at the deep end and those who want to take it one step at a time. At the same time, I've seen a lot more people become more confident about finishing their early projects as they learn about making games. It would seem like there is a link there, or it could merely be coincidence, or, most likely, part of a web of causes including more tutorials, more guides, and more resources of all kinds when it comes to making games. Well, technically that's the purpose. For the class, I merely had to conduct a small survey on anything whatsoever, obeying only a certain questioning framework, in order to demonstrate certain statistical principles. I wanted to gather a little bit of game development-related information, that being a passion of mine. In order to really learn about this potential link, I would have to conduct a much larger survey, with quite a few more questions and with far better controls on bias, as well as doing a lot more work that I don't have time for this semester. Perhaps I shall do exactly that one day, though.
  4. UPDATE: Now closed. Thanks everyone! For my current educational institution, I am conducting a small survey for those making games. Just three short questions on your current game project, whatever it may be. I would greatly appreciate the contributions of anyone on this forum! Please leave any comments or questions you may have here. To complete it, please go here: https://www.surveymonkey.com/r/LPTP29T (Also, I hope this does belong in General Talk. It didn't really seem to belong under any of the other categories.)
  5. While working on my current project, an RPG with a Pokémon-esque menu-based battle system, I've begun to struggle with figuring out how to have complex, multi-layer, text (BitmapText, rather than button or image-based) menus. By "multi-layer", I mean that a menu can bring up another menu, ad infinitum, all potentially with different menu layouts (a list or a grid, for example). By "complex", I mean that the selections within menus can have wildly varying results; there could be a different function called by each selection, or there could be a few different functions that receive different parameters depending on the menu selection. An example: -Fight -Talk -Use Item -Run Away Selecting Fight brings up the following menu that appears on top of or next to the previous menu: -Attack1 -Attack3 -Attack2 -Attack4 Selecting any of those attacks calls a particular function targeting an enemy. Selecting Use Item brings up the following menu: -Item1 -Item2 -Item3 Selecting any of those items would call a shared function, passing in the name and stats of the item as parameters. Selecting Talk calls a menu with a list of things to say. Each selection would trigger a short dialogue, with periodic menus of its own, before returning to the Talk menu (or the first menu). Selecting Run Away calls another menu: Are you sure? -No -Yes Yes ends the battle, closing all previous menus and opening up another image to show post-battle information, while no simply closes the yes/no menu and returns the player to control of the previous menu. Pressing the back button on any menu would return the player to the previous menu. So, does anyone know of an elegant way to implement such a system in Phaser? Suggestions, links to tutorials or guides, pseudocode, descriptions, and actual working Phaser code are all welcome. Something that minimizes hard-coding, so as to allow things like an external XML, JSON, or text file that contains, say, character dialogue, to create menus for branching dialogue purposes, would be even more amazing. I'd like to avoid using the DOM or anything outside of Phaser for visual display, but anything along those lines that anyone is willing to share could still be helpful. I'll be working on this for a while, so if no one has posted a better response, I'll try to sum up as close as I am able to get over the next week of work. Thanks!
  6. Hi all! I'm here looking for people to join me in the Indies vs. Gaming jam this weekend (starting the morning of 7/17/2015 and ending the night of 7/19/2015). See here (http://jams.gamejolt.io/indiesvsgamers) for more information on the game jam. If you don't know what a game jam is, it is an event where people get together (online in this case) to develop a game in a short period of time, seventy-two hours in this case, Friday through Sunday. Looking at events like Ludum Dare and the Global Game Jam can give you a better idea of what jams can be like (though this one is significantly smaller than both of those). I'm a game developer-in-training halfway through a Computer Science/Game Design degree. I regularly use a mix of languages and engines but my plan is to use Phaser for this jam. If you didn't already know, Phaser is a Javascript engine intended for 2D games (and whose main forum is on this very website). It's pretty easy to pick up if you have any programming experience whatsoever and feel like learning something new before the jam. (I learned Phaser for a jam in a couple of days, knowing pretty much nothing about JS.) It is also wonderfully simple to use for team projects. I'm not necessarily looking for any particular role. Artists who like working in 2D (or 3D, if you know how to render a 3D model to sprites) would be especially valuable, as would people who enjoy dealing with music, sound effects, or other audio-related concerns. I'd gladly team up with another programmer or three who knows Phaser or who thinks they can get a grasp on it quickly. The same goes for writers who love (or want to love) game jams. Anybody who can contribute a resource capable of being put into a game is welcome. I can design, write, and program, and dabble in pretty much everything else related to game development, so I can fill in gaps as needed. The only thing I'd really like to have is a bunch of people. I don't get much of an opportunity to work with teams bigger than two or perhaps three, so if you are looking for a group and can play nice with others, you're welcome to jam with me. That runs counter to a lot of game jam advice: anything more than a small team will probably hurt more than help in a time-constrained environment. Usually, I try to follow that advice. But game jams are also for experimenting and fun, so let's temporarily ignore the conventional wisdom and see if we can make an awesome game with a big group. I have a few ideas and tools to make working with a large remote group easier if we get a crowd. I have no specific game ideas yet, other than something with quick playthroughs and a lot of variation; I'll likely be taking the start of the jam just to relax and chat with everyone about the theme and game ideas. If what I said appeals to you, and you don't mind my tangent-filled and parentheses-heavy manner of speaking, send me a message through this site, Game Jolt, or on Twitter @cdrchdev. I'm looking forward to jamming with you! EDIT: Including myself, we now have two programmers and one artist. If anyone else (particularly any musicians, but any skillset would be welcome) is looking for a team at the last minute, or just would like to do a jam this weekend, please do contact me!
  7. What I meant was just if you wanted to transfer information from a tilemap's properties once, if you prefer to design your levels in an editor. Doing it repeatedly would probably be unwise. Looks like your solution should work. Nice find on Pathfinding.js; I may just follow your lead, since a dynamically updating walkability map is growing more important to me. I was nearly going to mention that you should round up on those numbers, but you addressed that in the last paragraph. You should post back here to let us know how it works out!
  8. I wouldn't consider myself particularly experienced, in either pathfinding or Phaser, so take what I say with a grain (or two) of salt. But I've spent the last week puzzling over pathfinding solutions myself, so here's what springs to mind. Assuming you do want to use A*, I think you'd definitely be better off just overlaying a plain 2D array (or similar structure) onto your game, either of objects that contain all of the necessary pathfinding information or several arrays of integers (or whatever) that each contain one part of the necessary information (walkable, additional G cost, etc.) In other words, exactly what you are thinking. If you need to extract information from the tilemap to use, then it shouldn't be too hard to find what tile lies under a particular node with getTileXY() and get the info that way. With different sizes of sprite, you'll need some way to mark the nodes differently for each sprite. Having the sprite update all nodes to accommodate its size sounds pretty slow to me; I think it would be better to actually have different grids for each size of sprite or have multiple values on one grid that the pathfinding can choose from based on the size of sprite. I haven't worked with EasyStar.js (or its Phaser wrapper), but I would guess that you would need to have multiple instances of it in order to deal with the different grids, or else constantly be calling setGrid(), which seems like a bad thing to me. (Could be wrong!) You probably could modify it to be told to check different walkable values, but I wouldn't know where to start. You'll also need to have sprites telling all of the grids what space it is taking up. Just so I know I'm communicating clearly, have a picture. Imagine 'D' as a hazard, with 'C' sprites being a tile large, 'B' sprites being two tiles large, and 'A' sprites being three across. Of course, they could be any size, so long as they aren't any bigger than that size. In the image, each tile is marked with the letter of the smallest sprite it is walkable for. Sprites of type A would use a map where B, C, and D are all unwalkable, B Sprites, would use C and D, etc. Just inflate hazards by the radius of the sprite (or an imaginary circle surrounding a sprite, anyways) and imagine the sprite as a point. [ A | A | A | A | A | A | A | A ] [ A | B | B | B | B | B | B | A ] [ A | B | C | C | C | C | B | A ][ A | B | C | D | D | C | B | A ][ A | B | C | D | D | C | B | A ][ A | B | C | C | C | C | B | A ][ A | B | B | B | B | B | B | A ][ A | A | A | A | A | A | A | A ] That's about as good a solution as I can think of that doesn't require writing an implementation of A* from scratch, manually setting up several node maps to allow for movement, or things like visibility graphs or potential fields. I'm probably going to start using EasyStar.js soon, since my current pathfinding plugin appears to be bugged, so I'll come back if I come across a solution that might be of more use to you.
  9. This is a great idea. I think 4-5 games to a book, all in different genres, would be my suggestion. For games of similar genre or design, I would also suggest perhaps showing different ways of doing similar things (such as one game on a tilemap showing tile-constrained movement and another showing unconstrained movement). I'm torn on #4, though. While normally I might say the explanations are extremely important to learning how something new works, I know I've learned a lot simply by seeing lots of examples even without explanations. Particularly for the more advanced tutorials, someone might be able to look at the code and learn more by reading the code than by explanations. One extra game might be worth more than than all of the explanations in a book. Probably wiser to just focus on explaining everything for these books, though, even in the advanced ones.
  10. While using the AStar.js plugin (from the official Phaser plugin repository), I have been running into a strange bug. Whenever I try to find a path between any two points on my map, the findPath function returns a path of zero length every time. Even more odd, the path, regardless of where I set it to begin or end, always has a start point and goal of (32, 47). This point does exist on my map and is the closest walkable tile to the bottom-right of the map, but there appears to be nothing else of significance about it. It is never mentioned in my code; the number 47 does not even exist in any of my files. The path should not cross that point and a quick manual calculation of A* on my map suggests that (32, 47) would not even be considered, since it should find a direct path to the goal fairly quickly. Does anyone know what might be causing this problem? The only useful tutorial I found online specific to this plugin is the example by Rafarel that is currently a pull request for the Phaser Examples repository. I copied parts of it directly and still had the same bug. If anyone else has a tutorial or example of using this plugin they would like to share, I (and probably quite a few others) would appreciate it, especially if it showed a common use of A* in games, such as pathfinding for multiple characters. Some relevant code: this.AStar = this.game.plugins.add(new Phaser.Plugin.AStar(this));this.AStar.setAStarMap(this.tileMap, 'Tile Layer 1', 'tiles_3_final');this.pathfindKey = this.input.keyboard.addKey(Phaser.Keyboard.ONE);this.pathfindKey.onDown.add(this.pathfindFromCharToChar, this);pathfindFromCharToChar: function() { var path = this.AStar.findPath(new Phaser.Point(40, 18), new Phaser.Point(9, 17)); // var path = ast.findPath(this.player.tilePos, this.otherChar.tilePos); // I tried this and several other ways to get points; // I can confirm that the method of passing the points // in is not part of the problem. this.player.tilePos.x = path.nodes[3].x; // Returns an error, as the path, which should be ~42 nodes long (43 with the start point), // is only 1 node long. this.player.tilePos.y = path.nodes[3].y; this.player.x = tilePos.x*32; this.player.y = tilePos.y*32;},EDIT: After some more digging around in the console, I found some information that might be useful. Forgive me if I ramble on a bit, but I figure that I might as well, since anyone who tries to help either has already gone through the exact same issue and can skip it, or would otherwise have to go through this whole process themselves. The findPath() function is properly passed the correct startPoint (40, 18) and goalPoint (9, 17). However, both start and goal return an AStarNode with an x and y of (32, 47), meaning that something happens in the below segment of code in AStar.js to cause the bug. I can confirm that _tilemap, _layerIndex, goalPoint.y, and goalPoint.x all reference the proper things. Going into properties.astarNode at the correct locations show that the astarNode.x and astarNode,y are set to 32 and 47, respectively. Phaser.Plugin.AStar.prototype.findPath = function(startPoint, goalPoint){ var path = new Phaser.Plugin.AStar.AStarPath(); var start = this._tilemap.layers[this._layerIndex].data[startPoint.y][startPoint.x].properties.astarNode; //:AStarNode; var goal = this._tilemap.layers[this._layerIndex].data[goalPoint.y][goalPoint.x].properties.astarNode path.start = start; path.goal = goal; this._open = []; this._closed = []; this._visited = []; this._open.push(start); ...}While searching for examples originally, I found this Stack Overflow question about AStar.js. I ignored it at the time, but thankfully remembered now. Of course, it remains unanswered, but it did point out that each AStarNode contains the x and y coordinates of the last location to use the same tile as it. So (0, 0), using tile 5, is marked as being at (49, 49), as is everything else that uses tile 5. Likewise, everything using tile 16 is marked as (32, 47). I hadn't noticed since 16 is the only currently used walkable tile, and I didn't think to try using AStar on a non-walkable tile. So the next thing to look at is where the astarNode property is set up on each tile. The updateMap is automatically called when you setup a map for AStar, and can also be manually called after a change to the map. I set up some variables (not shown below) to track whatever the previous tile was so I could check the astarNode property and see if the x and y are changing. Phaser.Plugin.AStar.prototype.updateMap = function(){ var tile; var walkable; //for each tile, add a default AStarNode with x, y and walkable properties according to the tilemap/tileset datas for(var y=0; y < this._tilemap.height; y++) { for(var x=0; x < this._tilemap.width; x++) { tile = this._tilemap.layers[this._layerIndex].data[y][x]; walkable = this._tilemap.tilesets[this._tilesetIndex].tileProperties[tile.index - 1][this._walkablePropName] !== "false" ? true : false; tile.properties.astarNode = new Phaser.Plugin.AStar.AStarNode(x, y, walkable); } }};And apparently, as expected, they are. Going through it line by line, and checking for changes, I can tell that it is line 166 that is changing it. And so the next stop is in the AStarNode constructor, shown below (with comments removed for length). Phaser.Plugin.AStar.AStarNode = function(x, y, isWalkable){ this.x = x; this.y = y; this.g = 0; this.h = 0; this.f = 0; this.parent; this.walkable = isWalkable; this.travelCost;};The console says nothing unexpected happens there (not that I really expected anything to). So I am stuck once again. Somehow, this line of code... tile.properties.astarNode = new Phaser.Plugin.AStar.AStarNode(x, y, walkable);...or a related line is causing other tiles to have their properties changed. All I can think of is that somehow an update to Phaser may have broken this plugin, as it doesn't appear to have been updated since 2.0.4 (at least). I read back through about half of Phaser's entire changelog and cannot see anything that obviously would break this plugin. So that's everything I have found out. Does anyone else who knows more about changes in how Phaser deals with tile properties (or anyone else) know anything that might be causing this problem?
  11. I've managed to fix the problem. For anyone else having the same issue, what fixed it for me was passing the layer you intend to collide with as an argument when declaring which tiles are being collided with. In addition, as far as I can tell, the layer needs to actually be declared before you can declare what tiles collide, so the setCollision call should come after the layer. If it comes immediately after, it shouldn't need to pass the layer name, as that defaults to map.currentLayer, the most recently modified layer. So this did not work: this.map.setCollision(1); this.layerC = this.map.createLayer('Collision'); And this is what did: this.layerC = this.map.createLayer('Collision'); this.map.setCollision(1, true, this.layerC); And this should work as well: this.layerC = this.map.createLayer('Collision'); this.map.setCollision(1);
  12. Look here: http://www.photonstorm.com/phaser/pixel-perfect-scaling-a-phaser-game That's how I did it when I made a game at 160x144 for GBJam3. If you scroll down to the comments, there's a link to a modified version of the basic multi-state game template that has the scaling all set up. The main disadvantage of this method is that you won't be able to use mouse controls without a fair bit of effort, but low-resolution games typically don't have those anyways.
  13. I'm relatively new to Phaser (only a few months of experience with it), so it didn't come up until recently that I attempted using tilemaps (which in this case are JSON files generated with Tiled) that have multiple layers. My code works fine with a single layer, but all collision between a layer and anything else stops working when I modify the code to add a second layer. In addition, creating sprites from the object layer (createFromObject) doesn't seem to work either. In my simplest test, the only change was adding a second layer to the map file (both layers share a single tileset), and the only change in the code is adding: var layer2; layer2 = map.createLayer('Tile Layer 2'); Both layers display properly, but collision stops working. I thought I had read that Phaser could handle multiple tile layers now. Is there something I'm missing that I need to have to get this to work?