mattstyles

Moderators
  • Content Count

    1,557
  • Joined

  • Last visited

  • Days Won

    13

mattstyles last won the day on August 25 2017

mattstyles had the most liked content!

About mattstyles

  • Rank
    Advanced Member

Contact Methods

  • Website URL
    github.com/mattstyles
  • Twitter
    personalurban

Profile Information

  • Gender
    Not Telling
  • Location
    UK

Recent Profile Visitors

5,877 profile views
  1. mattstyles

    Useful or Intresting Articles

    Almost all of those articles are several years old. Some things don't change much, but a lot does, especially on the web. Just go careful with the specifics of some of those articles which may now be out of date. Any general principles should be great to learn from though.
  2. mattstyles

    Hotkeys and Keyboard layouts

    Its about support. `keyCode` is supported everywhere (although deprecated in some browsers), `key` is only a working draft and not supported everywhere. https://caniuse.com/#search=KeyboardEvent This is incredibly reliable for support matrices.
  3. mattstyles

    My javascript websockets seem to be buffering incoming messages

    Definitely sure you're not executing the `startTime = new Date()` line more times than you think? i.e. if you're trying to record the frequency of multiple messages maybe this snippet is all in a function that is being called somewhere and inadvertently mutating the startTime you're expecting to be a constant?
  4. mattstyles

    [OverKnight] Roguelike card game

    I did try it on my phone and now have it saved on my home screen Controls felt really good
  5. mattstyles

    Trying to Save a Class Javascript

    You can't serialize an objects methods, only the primitives. For example: var obj = { foo: 'bar', get: function () { console.log('hello', this.foo) } } JSON.stringify(obj) // "{foo: 'bar'}" Parsing that object back won't return the methods (functions). You'd need to write your own thing so that when you get the saved data back (which is just strings) you instantiate a new instance of the object based on those properties that are serializable. As methods are generally static this isn't too much of a problem. Gets a little more complicated when iterating over an array, but only slightly. This only works at all because JSON.stringify does some work, you can write your own serializer (stringify) if you really need to, but danger lies that way. Also, I really wouldn't be tempted to `toString` on functions, you'd end up having to eval on the other end when you want to use it. Again, lots of danger lies this way.
  6. mattstyles

    [WIP] Bumgineer Demo

    The game feels really nicely done by the way. Really smooth and worked really well.
  7. mattstyles

    [OverKnight] Roguelike card game

    Really nice. Fun to play, felt very polished, particularly for an alpha. I tried on my laptop with a trackpad, going to go through the add to homepage on my phone. The initial load was horrific, took like 20 seconds which seemed to just be the weight/volume of images, can this be optimised by using a single spritesheet of images? Service worker worked great though, second load was super quick. I did have a little difficulty with playing the cards, might be a trackpad issue mostly, will try on my phone to see if touch controls feel more responsive. Having said that, I did get used to it, there was just a bit of initial friction between peeking at a card and actually playing it.
  8. mattstyles

    [WIP] Bumgineer Demo

    Awesome Awesome I found it really hard to get started. I couldn't fight anyone without dying quickly, so it meant jumping in and out of the market to raid the dumpster. Is there another way to get the $$$ to improve?
  9. mattstyles

    Hills - 3 Minute Game Poem

    It is...deep. I really felt the struggle of the main character, its expression, its futility. Deep man, very deep.
  10. mattstyles

    How to make a multiplayer game

    Without meaning to sound negative, how comfortable are you with JS and web programming? If the answer isn't at least 'yeah, I'm pretty good' then maybe don't try a multiplayer game. They are orders of magnitude harder. If you're going for it though: I'd start looking up and learning how websockets work, and really understand it. If you're familiar with pub/sub or observable patterns then they aren't super complex. The problem you always face (with any program to be honest) is dealing with the asynchronicity of events. If you get that down then you're most of the way there. It certainly isn't easy though. Then I'd look up server-authoritive architecture i.e. the server is where your game live, your clients (players in the browser) are windows on to that server. Then get a handle on what stuff you can/should do on the client and what stuff must be done on the server. Once you get this then you can employ the lessons learnt above (websockets) to propagate that server state to all your players. After that you've pretty much got the whole multiplayer thing done from a technical stand point and you can work on the really fun stuff of making your game fun. Oh, as with all projects, keep your scope initially super small, like, really small, as in, way smaller than you think would be viable. Get it working on that small scope, then expand outwards. You'll hopefully find that even with a tiny fraction of your 'ideal scope' that your core concepts shine through and you have the beginnings of something fun, it probably *will* be fun at that stage if your core concepts are good.
  11. mattstyles

    Should I get a VPS or a Cloud Droplet

    1and1 are offering you a managed solution of sorts, DigitalOcean is usually just the hosting, it's up to you how to configure and manage it. You can run multiple different sites from one 'droplet/instance' without issue, depending on the site. If you're wanting to publish a client-only JS game then I'd consider something like now.sh or netlify. They make it super trivial to get such apps in to the wild.
  12. I think this is an awesome question, and it the sort of thing everybody runs in to: "How to structure your application to make coding up your logic as easy as possible.". First up, there is 0 wrong with what you're doing. You've already split your code base up in to logical chunks: something handles bullets, something else handles collisions etc etc. That's great. Think how you could further split things up so that, ideally, you make changes in a minimum amount of places. Actually, with just a couple of places to change how different types of bullets (and any modifiers applied to them) are handled, you're doing pretty well already. There are many many different ways you could attempt to solve this problem. Personally, I reckon I'd start thinking more about the data structures I'm passing around and what each different aspect of my system needs to run. You could start structuring your data to be more descriptive about the types of things. Maybe a bullet entity could contain all the variables that your bullet handling and collision code needs to work such as the texture that should be set and the colour or type of any particle emitter that gets generated? Maybe there should be a variable that declares the speed? This way you just pass this structured object into your functions and they don't care on the specifics of what type they are, they infer what to do based on the properties of that object i.e. rather than those functions knowing that a 'flame bullet' travels at 120 and a 'exploding bullet' travels at 100, it just takes a bullet object that has a speed and uses that to set velocity. Then, when you apply a 'power-up', whatever function that applies the power-up could either add the modifiers or manually change the bullet properties. i.e. var flameBullet = { speed: 120 } var speedPowerUp = { modifier: 20 } function applyPowerUp (bullet, powerup) { return { ...bullet, speed: bullet.speed + powerup.modifier } } I've used object-spread there, that's fairly new to JS, all it does it create a copy of `bullet` but then applies a new `speed` property, which takes precedence over what was previously defined in the bullet passed in. There is no need to do it like this, maybe you just store the modifier and calculate the speed later. There's no one single right answer. Evaluate which method best suits your needs, both of your system and you (or the team) as a programmer. There's also no need to use a separate function like this, maybe you like classical coding (using classes, careful with these in JS) and you want that function to live on the powerup or bullet objects, that's absolutely fine as a solution. It sounds like you have divided and structured your code and logic, it also sounds like maybe you just need to do this for the data that logic operates on and you'll be most of the way there to a solution that fits you.
  13. mattstyles

    Hosting recommendations ?

    Just try searching, these threads come round fairly often. They mostly all offer the same things at roughly the same price points, a quick bit of googling and you'll almost certainly find one good enough unless you have something really niche you need, which is unlikely.
  14. mattstyles

    animation for this card folding using tweenjs

    Not sure you'll ever get there with CSS, that looks like a 3D game where the vertices of the card are actually moving and the renderer works out the rest. CSS transforms could get you close with trickery with how many elements you use to represent a card, but it'll never be great. Happy to be proved wrong but CSS transforms just don't work like that to do the stretching and transforming you see in the video. Actually, maybe there is a way. Use lots and lots of elements to define the fold area, then transform each one by an increasing amount, i.e. first one (closest to body of card) rotates and transforms only a little bit, each subsequent one after it (until you reach the corner) moves a little farther, and its additive so there would be a nice concise algorithm that could give you how much to move each piece. Once you have an algorithm just keep increasing the number of elements until you get something that is smooth enough. It won't be perfect but it might be good enough to work.
  15. mattstyles

    How can Isometric water effect Make like ~~?

    Very good looking indeed, I don't really know the answer, but water simulation is something is often done with shaders. I'd check out some shaders for some examples about how to make water semi-realistic.