js_unit

Members
  • Content Count

    9
  • Joined

  • Last visited

About js_unit

  • Rank
    Newbie

Contact Methods

  • Twitter
    tweet_unit
  1. Hi DeathSpike I appreciate the response a lot! In fact, it cleared up some worries I had to be honest. There is no problem with the architecture and networking, code we can handle easy. It was more the concept of largeness, which you mentioned. Procedural generation, and storage is the tricky part (then loading and modifying as players 'change' the chunks). But it can be done. Now that socket.io has p2p stuff, it'll just smooth things out even more (guess it's time to get NodeJS on the backend now). Thanks again.
  2. Hi guys Old dev, but somewhat new to game and js in general. I am working on an idea that is quite large, and I have a little team behind me. We are still in architectural phase, and already many difficulties are cropping up. Not that it's a bad thing during design right? This one is general is my biggest confusion / concern. Map loading. I am not going to call it a map, it might not be the right word, let's say play area. In our case, the play areas are huge (as huge as possible!). We don't want any world bounds to stop a player, they will be able to go as far as we can possibly allow. Of course, integers have limited size, and reality sucks. The following two concerns pop up first. 1. How could I handle/visualise/realise map loading from a central server, if maps are this large and indeterminate. 2. If 1. is doable, how the heck do I know what coordinates to use for a player. A bounded world, have x,y pixels at the least. But what does a huge world have? For 1. I considered the json way, but tiled maps are predetermined, and a map of 80 000x 80 000px, would yield a tiled json file of 4 MB already. Is it really neccesary to use csv/json tilemaps? Considering a sandboxy persistent type game, starting with NOTHING, can we just use good old rendering of images and save these locations/coords (problem 2 above) on the server side? Tldr: Do we have to use tilemaps or go free form? How do we know what the player and object coordinates are. I hope it doesn't seem like rambling. It's a real headache for me right now, as I start the loader code. Cheerios Marlon
  3. Hi Rich It seems that I was an idiot. This line fixed it... map.addTilesetImage('planet_mutin', 'planet_mutin');
  4. That is a good point, and I can see how it makes no sense. I can't really share a large portion of this code at this point , sadly. I have a background sprite loaded, and a player sprite loaded. No tiled json/tilemap. It works. I can see the background, and the player sprite, and move around. Then I add the neccesary code to load the tilemap (the json, the planet image, that's all it contains)... It still works, and the player can move around, but only UNTIL you move to where that tilemap's planet image is. Instead of it then coming into view/rendering, the above error happens with a crash. The image element it refers to can only be that planet png on the tilemap. If this is still unclear, I will try to create a barebones(reproducable) version of my code, and then share that with you. Sorry about the confusion.
  5. Fair enough, I have minimised it to the least possible amount of code to reproduce the problem. Youll notice it's a vast mapsize... but it works fine. My player sprite can move around in it, and only when the planet png is to be rendered, does the crash occur. Thanks for the help. I am excluding the millions of 0's though from the json. { "height":1250, "layers":[ { "data":[0, 0, 0, <thousands more....>, 0], "height":1250, "name":"Tile Layer 1", "opacity":1, "type":"tilelayer", "visible":true, "width":1250, "x":0, "y":0 }], "nextobjectid":1, "orientation":"orthogonal", "properties": { }, "renderorder":"right-down", "tileheight":64, "tilesets":[ { "firstgid":1, "image":"img\/marlon_planet_mutin.png", "imageheight":400, "imagewidth":400, "margin":0, "name":"planet_mutin", "properties": { }, "spacing":0, "tileheight":64, "tilewidth":64 }], "tilewidth":64, "version":1, "width":1250} and the code // in preload...game.load.tilemap('mapVast', 'assets/80kspace.json', null, Phaser.Tilemap.TILED_JSON);// in create...map = game.add.tilemap('mapVast');map.addTilesetImage('planet_mutin');layer = map.createLayer('Tile Layer 1');layer.resizeWorld();// from here on there is nothing else specific to the tiled json I am doing.// very simple example that contains nothing but that planet.// the background is loaded seperately from the tiles as a background sprite.Hope this helps. I do not have access to the branch I am working on at home right now. In preload I also load the planet mutin PNG successfully (i can display it if i render it normally...)
  6. Hi rich! Thanks for your effort in supporting us all, appreciated more than you know. I ran into the same issue. My background is loading and working, and my player vehicle is showing... if i move close to where my tiled.json dictates a PNG should be, I also get Uncaught TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The provided value is not of type '(HTMLImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap)' The paths are correct, the image is fine, and theres nothing else on that tiledmap than the image (the background is seperate from the 'map'). I tried 2.4.0 in the repo, same problem. I downgraded 4 or 5 versions, and eventually it would not crash, but just not render png. Is there another way around this bug (assuming my problem is related to it!) Cheerios marlon
  7. As you said that, I realised that I have been looking at this problem idiotically. Thank you Rich, Initially, applying your fix gave me the same issue in preload. But I changed the code, by having my states external and injecting them in here, and it works like a charm now. Sorry for the silly question Thx
  8. Hi there guys I have one that is bugging me. I'm an old back end dev, but new to js. And in the process of my first decent project, I encountered this issue. In my custom main 'class', I keep a this.game which I instantiate to a phaser Game. Doing a console.debug on it, I can verify that it's a valid Game object. Adding states to it works fine, but in my preload, I realised that 'this.game.load.image()' borks out, because 'cannot read image on null'. console.debug this.game.load yields NULL console.debug this.game yields a valid phaser Game It is like load is not in there, and it makes no sense, all the documentation is doing it this way. If you look at my console debug below, that is where I am checking it. It fails the game.load check directly after instantiating Game. var SwagMain = function (resX, resY, renderer, parentElement, antiAlias) { if (typeof(antiAlias) === 'undefined') antiAlias = true; if (typeof(parentElement) === 'undefined') parentElement = ''; this.resolutionX = resX; this.resolutionY = resY; this.renderer = renderer; this.parentElement = parentElement; //this.antiAlias = antiAlias; this.game = null; this.initialise();}SwagMain.prototype.initialise = function () { console.log('initialise running...'); if (this.game === null) { this.game = new Phaser.Game( this.resolutionX, this.resolutionY, this.renderer, this.parentElement ); console.log('------------- -- - - - -----------'); console.debug(this.game); console.log('------------- -- - - - -----------');Hope someone can show me where I am being an idjit. Thanks. Marlon