agmcleod

Members
  • Content count

    59
  • Joined

  • Last visited

About agmcleod

  • Rank
    Advanced Member

Contact Methods

  • Twitter
    agmcleod

Recent Profile Visitors

349 profile views
  1. Hello, Glad you're liking MelonJS so far. Unfortunately the API does not support a skip processing tileset setting. But it's not a bad idea! Logged an issue against it, so it's something we could add in the future. https://github.com/melonjs/melonJS/issues/877
  2. Hi there. I can't speak from experience on building multiplayer experiences, but I know others have leveraged socket.io to do multiplayer with MelonJS. For rendering other players, you can setup the RxJS observables to update the position of a given entity in the scene, and ensure that when doing so, the update() method for those entities return true. MelonJS is also really customizable, and is pretty flexible as an engine. I've written a fair bit of custom code to do the rendering style I wanted for my most recent game. So it shouldn't be an issue to hook it up the way you want to. It's worth noting that physics/collision is corrective. The idea is that you move an object, it overlaps with another object. The collision system realizes this, and subtracts the overlapping rectangle from the position of the moving object (or which ever is governed the target). So basically, if the physics system/coordinates of entities in melonjs is out of date with the positions on the server, it's not difficult to correct the scene by updating all the coordinates.
  3. Hi there! You can change this line here: https://github.com/mrengy/pesky-squirrels/blob/4ad5a4863bca515811b277ea7143535f7a1404e2/boilerplate-master/js/game.js#L59 to do: me.state.change(me.state.MENU); That will load the menu screen :).
  4. That classic error. At least let/const usage in es6 will help prevent
  5. Worked for me, thanks @Lsmjudoka
  6. FPS is around 50 when it starts up, then hits 60. It seems when the page loads it's a tad slow, then speeds up once all the objects are created. I think the reason for this is because it has to load the image. Typically you do this in a loading state, show a progress bar or loading screen of some kind.
  7. How are you initializing this.game?
  8. That would do it lol. Added some checks to ensure it doesnt pick other lasers
  9. Hey delta, sorry just saw the reply. Here's a published version with the debug build: http://projects.agmprojects.com/wrath-test/. The update code i referred to use near the bottom of game_screen.js. After you click "Tap to start" and the countdown, use the mouse left button to shoot. It still spawns, but the mesh position and laser position equal the same value (in console log).
  10. I can publish a version of the game with this if possible. Otherwise i feel like it would take me a while to set this up
  11. Hello, so in a render loop, I am looping through all the objects that a laser can collide with, and perform an intersects mesh. This is only like 70ish objects total, so it's not entirely awful, but on my iPad mini i do notice some frame rate drops occasionally, so i'd like to improve it with octrees. Here's the code for the looping. This gets called in my render loop, after updating positions: GameScene.prototype.update = function (endScene) { this.player.update(); var enemies = this.wave.enemies; for (var i = enemies.length - 1; i >= 0; i--) { var enemy = enemies[i]; endScene |= enemy.update(this.player); for (var l = this.lasers.length - 1; l >= 0; l--) { var laser = this.lasers[l]; if (enemy.mesh.intersectsMesh(laser.mesh, false)) { this.wave.removeEnemy(enemy); this.removeLaser(laser); } } } for (var i = this.lasers.length - 1; i >= 0; i--) { var laser = this.lasers[i]; laser.update(); for (var c = this.cubes.length - 1; c >= 0; c--) { var cube = this.cubes[c]; if (cube.intersectsMesh(laser.mesh, false)) { this.removeLaser(laser); } } for (var w = this.walls.length - 1; w >= 0; w--) { var wall = this.walls[w]; if (wall.intersectsMesh(laser.mesh, false)) { this.removeLaser(laser); } } }So yeah it's kinda gross. Using an octree instead, here's what i have: GameScene.prototype.update = function (endScene) { this.player.update(); var enemies = this.wave.enemies; for (var i = enemies.length - 1; i >= 0; i--) { var enemy = enemies[i]; } for (var i = this.lasers.length - 1; i >= 0; i--) { var laser = this.lasers[i]; laser.update(); } var octree = this.scene.createOrUpdateSelectionOctree(); for (var i = this.lasers.length - 1; i >= 0; i--) { var laser = this.lasers[i]; var meshes = octree.intersects(laser.mesh.position, 1, false); for (var i = meshes.length - 1; i >= 0; i--) { var mesh = meshes.data[i]; if (mesh.name !== "ground" && mesh.name !== "player" && laser.mesh.intersectsMesh(mesh, false)) { console.log(mesh.position, laser.mesh.position); this.removeLaser(laser); if (mesh.name === "enemy") { this.wave.removeEnemy(mesh.refObject); } } } } return endScene;}The problem is, the data seems to return incorrect data. The laser intersects one of the cube objects, even though there should be none in range. Looking at the log, i see the mesh.position and laser.mesh.position have the same values. There something i missed here?
  12. Thanks! Since the webview in iOS 8 added webgl, i just used cordova. Initially I was going to use cocoonjs, but ran into some issues figuring out iAd with it.
  13. Small little action game of mine got pushed to the iOS app store this week. https://itunes.apple.com/us/app/wrathofthecube/id962976121?ls=1&mt=8. Free to play, check it out if you'd like
  14. Ah okay, reading the wiki page about the ellipsoid, it uses 0.5, 1, 0.5 as the default making it taller around the object. If i set it to 0.5,0.5,0.5 for both the player & the laser, it seems to be much more predictable.
  15. Thanks for your replies. In debugging this and messing with the ellipsoid values, is there a way to show the elliposid with the 2.0 debug layer? Here's what i have currently for the player's mesh: this.mesh.ellipsoid = new BABYLON.Vector3(0.5, 0.9, 0.5);this.mesh.ellipsoidOffset = new BABYLON.Vector3(0, 1, 0);Still acts a little funny though. One other thing a friend of mine noticed, if you switch on wireframes, you'll see the vertices in the ground. Go a bit below so you can see the diagonal one on screen. Aim the mouse towards it. The laser meshes will stop and slide up the line instead of going through it. Probably another ellipsoid bug on my part. But i find it interesting.