Search the Community

Showing results for tags 'architecture'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 13 results

  1. Hi everyone, Looking for some advice on the approach to coding multiple powerups/upgrades. I have googled how to do this but most answers are in c#/java or based on unity so I have trouble understanding what there doing. I am making a geometry wars/asteroids clone and I am giving the player upgrades when they defeat a boss or reach certain multipliers/kills. The problem is that I am having to change lots of code and using lots of if statements to see if a powerup has been activated then changing the bullet effect and then having to change the collision function for the bullets hitting the enemies so that each powerup does something different. For example in my powerup file (handles bullet changes when new power is activated and powerup pick ups) I add more if statements to the bullet logic to change for example the bullet speed and texture then I go into the file that handles collisions and make changes to the bullet / enemies function so that if the bullet is a fire bullet for example, the enemies particle effect is changed to red from blue. I know there are better ways to do this but I'm not sure how in javascript (or any language) any help would be really appreciated some code: powerups.js (bullet logic handler function for special bullets) const scene = this.scene; const utils = this.utils; const player = scene.player.sprite; if (bullet && utils.playerDied === false) { if(utils.explodingBullet) { if(utils.specialLevel > 1) { utils.bulletSpeedSpecial = 120; } else { utils.bulletSpeedSpecial = 250; } bullet.setTexture('explodeBullet'); } else if(utils.flameBullet) { utils.bulletSpeedSpecial = 75; bullet.setTexture('orange'); if(utils.specialLevelCheck === false) { utils.specialLevelCheck = true; scene.flameEmitter.explode(); } if(utils.specialLevel > 1) { player.setTexture('playerO'); scene.playerTrailEmitter.setFrame(['white', 'orange']); } } else { bullet.setTexture('bullet'); player.setTexture('player'); scene.playerTrailEmitter.setFrame(['white']); } bullet.fire(player, scene.reticle); utils.lastFiredSpecial = time + utils.bulletSpeedSpecial; scene.physics.add.overlap(scene.baddieGroup, bullet, scene.callBacks.shootingBaddies, null, scene);
  2. Hi, Phaser devs! I'm developing a game using Phaser with TypeScript and what I'm trying to achieve is this: var component:AwesomeComponent = actor.getComponent<AwesomeComponent>(); I know there's a workaround by constructing objects of type T. But I don't like it because I'd probably need to define tons of different constructors to represent all differents kinds of components. What I'm doing so far is passing a string with the type (of course a number would be better, but I'm still prototyping): getComponent<T>(componentType:string): T { for (let i = 0; i < this.components.length; i++) { if (componentType == this.components[i].componentType) { return <T><any>this.components[i]; } } return undefined; } It works, but the result is not good, you have to type the class name twice: var animComp = actor.getComponent<AnimationComponent>("AnimationComponent"); Any suggestions on how to solve it? I know there`s a way to do it, because Unity does exactly that in JavaScript. Thank you for your time!
  3. Hey Guys, I am working on a project which is a 2D side scrolling game with a point and click and dialogue system. There is no fancy physics - only spritesheet based animations. There are also a couple of mini-games that are accessible from this main game world. I am relatively new to Javascript (coming from an Actionscript background). Had a few questions: Would like to know what and how I should go about managing the code and planning the architecture for my project? Any areas of implementation that I should watch out for? Any learnings or resources that I can refer to for execution? Was planning to use Phaser for rendering. Any other suggested libraries that might serve the purpose? Look for your guidance! Thanks in advance.
  4. Is there a recommended way to architect / structure code in BabylonJS? I went through code demos, but they all demonstrate very specific capabilities in a very short code that doesn't require any real structuring. How should a code of a big project look like? (Ideally separated into different files that contain different classes or grouped logic) Do you extend classes? prototypes? Am I simply supposed to use whatever techniques and structures I use when writing native javascript or are there structures unique to BabylonJS?
  5. Hi! I'm new to JS gamedev, but I had a good experience in Flash/AS3. So, I'm starting a board game, and I need to roll a dice/roulette every turn. A kind of window will appear over the board and the player will be prompted to click the roulette. It will return a value between 1~9. What I have until now is ths: https://jsfiddle.net/snake/m317ona9/ As you can see in my code, I'm using create() and update() methods just to create this example. In real game it wouldn't be handled like that, but in middle of game. I have not so much ideas on how I can make a nice architecture in my code.What I have in mind, with my current small knowledge in Phaser, is to make a lot of conditions to manage states in game loop. The final code would be a maze! The perfect case for me: Create a function which would treat this roulette as a component or something like it, maybe with his own create and update methods, and returning a value to the game, so I can reuse it without the need to mess up my code. Hope I've made myself clear How can I proceed with it? Thanks in advance!
  6. Hi all, I have been working as a Java Developer for over 7 years and while studying AngularJS I decided to create a browser strategy game for fun, like Travian/TribalWars/Ikariam etc... Right now I am thinking about how the server architecture should be. I tried to find some examples on how this kind of games distributed their servers but I couldn't find any useful resource, so I came with my own. My sketch and authentication flow (follow the numbers from 1 to 9): In a general way, is that a suitable one? From my personal developer experience I decided it was a safe idea to split the public front-end from ther auth and game servers. Do you think there are any Cons in this architecture? About hosting, which service/host is most suitable for each server? 1) Authentication server, single point 2) Front-End server, distributed over the world 3) Game Servers, each one in its specific country I am open to new ideas and changes! Thanks in advance!
  7. I am writing a 2D, top-down persistent game with land and multi-character ships, using Phaser. Players will be able to modify the game world. It looks to me like using Phaser TileMaps is probably the most sensible way to display the ships and the land - composing each out of tiles as opposed to groups of sprites. However, in any case, I must be able to persist/save tilemap information to a store/database (currently using MongoDB). How would you, the reader, solve this? The Phaser TileMap data could be exported to a format it natively imports, but that requires looping over every tile in every layer to get each tile's index. And either deciding what else to save if creating JSON, or being sure to not use features other than tiles if writing CSV (because the CSV won't contain information like rotation). ("export tilemap as json" thread) A separate "tilemap" (2D matrix of information) could be implemented which save and reload itself, and can return itself as a Phaser TileMap. ?? ... Is there an easy way to save and reload an entire Phaser.TileMap object using something like JSON.stringify() + _.extend()? (I'll try this next)
  8. Timopheym

    Pass uniforms to Filter's shader

    Hey people! I wanna implement this shader (https://www.shadertoy.com/view/MslGWN#) in phaser state. So i transformed the shader to WebGL style, and added patch to phaser to update iChannel uniforms on update. Phaser.Filter.prototype.update = function (pointer, uniforms) { if (typeof pointer !== 'undefined') { var x = pointer.x / this.game.width; var y = 1 - pointer.y / this.game.height; if (x !== this.prevPoint.x || y !== this.prevPoint.y) { this.uniforms.mouse.value.x = x.toFixed(2); this.uniforms.mouse.value.y = y.toFixed(2); this.prevPoint.set(x, y); } } if (typeof uniforms !== 'undefined') { for (var i in uniforms) { this.uniforms[i].value = uniforms[i]; } } this.uniforms.time.value = this.game.time.totalElapsedSeconds();};But it does no helped. There is no affection from music to fractal generation. Like i do pass null's. Example could be found here: https://timopheym.me/phaser/shader_music.html (sorry, i don't have ssl certificate =( ) I have no idea where am i wrong. It's about two days i am trying to fight it... thanks!
  9. Hello everyone, I will develop a new game with phaser, and I ask myself questions about how organize my code. I would like to use the ECS architecture but how implement it with Phaser? how you decouple the differents actors (player, enemies, objects,etc...) in your game? How you implement the differents interactions between the player and the environment (a door for instance)? Thanks!
  10. pimous

    multilevel architecture

    Hi everyone, I would like to create a game with several levels. I am a newbie with phaser, I only create games with one level. So what are the best practices to make a multilevel game ? There is a neat architecture for that ?
  11. Filozofer

    Game architecture - Your advice ?

    Hi ! I'm trying to test thing we can do with phaser. My purpose was to found a way to have "Models" which contains all a component logic (player, button, ...). I've succeed doing like this: //Create function of my MenuState object (just creating a button here) create: function () { this.buttonsMenu = this.add.group(); var button = new ButtonMenu(this, this.make.button()); this.buttonsMenu.add(button); },//My basic button menu object allowing me to keep method and attributes here and not in my state object var ButtonMenu = function (game, button) { //Set methods on the phaser object (is this dirty ?) button = constructor(this, button); //Keep game reference this.game = game; //Load attributes and set button params button.reset(this.game.world.centerX - 95, 400); button.loadTexture('buttons_menu'); button.setFrames('button_hover.png', 'button_up.png', 'button_click.png'); button.onInputUp.add(button.alert, button); button.anchor.set(0.5); button.scale.set(2); return button;};function constructor(plan, obj){ for(var m in plan) { obj[m] = plan[m]; } return obj; } ButtonMenu.prototype.alert = function(){ alert('test');};ButtonMenu.prototype.update = function(){ this.angle += 1;};What do you think of this way to do thing ? Can I do better ? Is my way to do that will be a problem for later ? Thanx !
  12. I am new to Phaser and really excited about the posibilities it opens to game developers. There is one issue I like to talk about - modularity. Phaser is 45,000 lines of JS. the code seems to be well written and domuented but it's still a lot of code to reason with and to maintain. I am coming from a Node.js mindset and in the Node world everything is modular. The idea is to constract your app using small NPM modules. This modular approach is one of the reason for the popularity of the Node echosystem. Node itself has small core and the community adds more functionality by publishing their libraries to NPM. How cool it would be if we could have something like this; var gameLoop = require('game-loop'); var keyboard = require('keyboard'); var entity = require('entity'); var physiqueEngine = require('engine'); etc.. Now if something new comes up, we don't need to wait for anyone to add this new hotness into our framework since there is no big framework. we just replace whatever we want. In addition it will be easier to contribute to the different libraries since each of them is small and is doing only 1 thing (the unix philosophy). In the 3d game development there is a good example to this approach - http://voxeljs.com/ In the DB world there is levelDB which also based on this - https://github.com/rvagg/node-levelup/wiki/Modules There is an interesting project for 2d games that is trying this approach - http://crtrdg.com/ And here is a recent blog post by Seth, the developer of this project - http://learnjs.io/blog/2014/03/04/gameloop-load-images-sprite-2d/ I don't know what is the effort and viability for breaking up Phaser into small modules, but at least let's have a discussion about it!
  13. My question:Do you use a plain (but heavily branched) game loop or do you split your game by a principal like MVC or MVP ? Yes I know, I know.. this classical question is related to programming, not to gaming itself. I think I established a really nice and well working architecture in my flash/flex projects. Those projects were something between an App and and a Game as I'm cerating a lot of short termed, microsite like apps und pages (10 to 30 working days) for advertising agencies and there customers. I still create flash projects. But in the past year I've seen myself doing more and more Javascript only projects and as somebody with a flash background of 15 years it was inevitable that I will join the HTML5 gaming community A typical flex project nowadays looks like this:Robotlegs as my application framework Finite state machine (FSM) to carefully manage my transitions between my content screens. Service and Models classes to retrieve and manage any data. Communicate with events between my mediator and my views, and use Signals and Commands to trigger actions in a mediator or a data fetching service class. Four years ago I used PureMVC instead of Robotlegs and before then I used Cairngorm MVC.It always was a battle to organize my code and establish a solid communication between all elements. My flash projects are now fine. It absolutely works for me. But I still battle the code with each new project as the app flow is never the same. I sometimes re-adjust my FSM, sometimes I need no FSM and control everyhting myself in a global 'big daddy' controller. I created so many many many projects with flash & flex. I love JS and I always use Backbone Views & Router to manage my HTML Frontend. I'm programming well tested backends in Rails for two years now. The whole ecosystem I work with is a pleasure. It's fun. Now I dived deep into HTML5 (or more to say JS with Canvas/WebGL) aaaand welcome back in 1999. It's not that I'm struggling with it. But there is a large battle in my mind. Should I use a plain game loop or do it the fancy and OOP'ish way I know from Flash, Rails and my Frontend JS. Of course, I decided to do it the fancy way. And it totally feels like over-engineering my code.I'm currently building a small advertising game. It will run on Facebook and standalone. Nothing complex you and I would say. It's a Whac-A-Mole clone with a totally not mole related story overlayed.There is a Timer, some Levels adjusting the speed and difficulty, some messages presented as an overlay.There is a qualification round, and all the game levels itself. You get a penalty when you miss to hit a mole. Then penalty is shown in an overlay, the timer is paused. At the end you have a highscore in form of a duration you survived before missing too many moles. Easy isn't it ? I can clearly see you guys programming this within hours or days with a simple branching game loop. And what did I ? I havea state machine with 4 states (introduction, qualification, qualification results, competition & results)a bloated game modela levelmanager model (LevelConfig, LevelItem, LevelManager)a player modelan isolated class to manage to the gameplay logic itself (Mole, Whacker, Referee)an overlay controllera view and presenter/mediator for each stageAdditionally to the FMS big daddy controller, where I init my game models(player, game, levelmanager), initializing my mediators with my views, expose some global APIS like (stopGame, restartGame, playMusic) and listening to the FSM to trigger an overlay or change a state in my fat game model.No clear way of communication. Sometimes I listen for changes in my game model,Sometimes I call something via a global saved instance of my bid daddy controler, sometimes I use my global command bus (which is: a globally available event bus) sometimes I listen for a change in my game model. Yeah i's working! It's not finished but in a good progress and I feel good about the result itself. I used Phaser and I'm feeling really happy with it.But can you see it? This is over-engineered!! I hate it! It's like I'm knowing to much about architecture and that I messed it all up. I do not want to do it again in this manner. I can't do it the easy way and switch over to a game loop. My brain is not able to think in a single game loop. I grew up with MVC, with decoupling & events. And that's the reason why I'm asking here you pros: What's the architecture of your small or large games ? Sorry for that long story telling. Thanks for any comment, advice or question!Regards George By the way, my game loop looks like this://a state of Phaser JScreate: function(){ this.whackAMole = new Game.WhackAMoleGame(this.game) //init big daddy controller this.whackAMole.start()}update: function(){ //nothing.. phaser is doing all the game loop stuff, my game is totally event based}