Lostcast 106: Entity Cross-platform Something


  • Tiger Hat

    I’m currently only half way through, so first I’ll just bring up some stuff about Windows. I don’t use a Mac at all, I’ve been a windows user forever, and it’s because of gaming. My day job is in web development, and I am almost always the odd man out with a lone laptop without an apple on the back of it. I guess it’s because of Linux, and Mac being basically Linux with a better UX, and because web servers are frequently in Linux (because it’s FOSS). So I see how it happened. I can tell you though, that it’s a source of constant frustration with all of the things productivity related that are Linux/Mac only or at least first. For example NodeJS was once Linux only and there are still a handful of packages that don’t run well on Windows (or at all in some cases).

    Having ranted a little about that, I want to say that I still use Windows every day so I can tell you a little bit about the things that I use to push through. One we’ve talked a little about before, and that’s how you use Make to call a bunch of bash things for your build. This is where I suggest using a cross platform tool like NodeJS or Python. If you take the time to create your build tools using Gulp or Grunt for example (NodeJS), then they’ll work on both and you have one less context switch (plus you get to write tools in Javascript of course). Another thing that you might want to do is install Git for Windows. It comes with “Git Bash” which is a shell that has some of the familiar features. From having to work with Linuxy environments so often, I actually prefer and got used to typing “ls” all the time instead of “dir /w” for example. Not everything works of course, but some of it does, perhaps enough for what you need to get done. Speaking of git, I use SourceTree which is actually for both Windows & Mac. It also comes with a bash-like terminal and since you can use it on both can help with the flow between.

    There are more problems that I might have suggestions for, but can’t think of them now, maybe if you list a problem I can try to help solve it :)

    Oh another reason that I think Windows development is good for you is that it can open another market for you. You can port your games to the Windows store. I don’t think that they really let things that are created with node webkit for example onto the store, but they do support native JS via IE11 in the store. I don’t know for sure of course, but I wouldn’t think it’d be too tough to port AWL over, and you’d get access to a whole other market. Since Steam is winding down (and harder to get into for project Skirmish) you might want to look into that, there are eleventy-million Windows machines after all :D

    … ok wall of text, more after I finish the Blair side of the album.


  • LDG

    @Warspawn said:

    I guess it’s because of Linux, and Mac being basically Linux with a better UX, and because web servers are frequently in Linux

    Totally this. To me, Mac = Linux + better hardware and prettier software. Also some pretty great enterprise apps available like Photoshop etc.

    Oh another reason that I think Windows development is good for you is that it can open another market for you. You can port your games to the Windows store

    Yeah Game Dev Tycoon (also node-webkit) is on the Windows Store. We’ve also launched a WebView-based game on Mac App Store, so they’re both doable. But basically Steam eclipses everything, so we’ve doubled down on that instead of branching out more. I’d be interested to know how these markets perform for games like ours.


  • Tiger Hat

    @richtaur said:

    Yeah Game Dev Tycoon (also node-webkit) is on the Windows Store. We’ve also launched a WebView-based game on Mac App Store, so they’re both doable. But basically Steam eclipses everything, so we’ve doubled down on that instead of branching out more. I’d be interested to know how these markets perform for games like ours.

    I realize that you need to focus on Project Skirmish and whatnot so there is little time to port the game over. I wonder if you would consider outsourcing the port. It’s something that I would consider doing for the experience alone (I realize money would be an issue here). Well, maybe not alone I might need an Honorary LDG Badge or something :D


  • Patron

    For the Linux/Mac terminal fans using Windows: Cygwin is awesome. It is essentially like having a Linux command prompt on your Windows PC. There are lots of packages available through its GUI-based package management system (Python, compilers, utils, etc). It is similar to Git Bash but more powerful and a nicer terminal emulator.


  • Tiger Hat

    I’ve had a chance to listen to the ECS/Horsey side of the album, and I have to say very interesting discussion! Very detailed. I suppose that the majority of the ECS discussion belongs in the Rectangle Eater thread, however I’ll make a few comments here anyway.

    I know there’s 17K ways to skin the cat, but I’m surprised that you’d loop over all entities every tick. That really doesn’t seem all that much different from what you’d be doing in a more traditional OOP loop (looping over all game objects and calling their update) except you are then looping over each system for each entity. When I think about that, it sounds inefficient. In the system that I use, whenever a component is added to an entity that entity gets added to a “family” or “families” of entities. During the loop, it iterates over each system and calls update. Systems may query the entity list by components which then uses / creates the “families” as a cache of sorts. The list of systems (10-20) is generally shorter than the list of entities (could be 100s or 1000s), doing it this way each system should have to iterate over only a fraction of the entities. The physics system might ask for all the entities that have position, velocity, and speed. Once it first makes that query then the family will be created, and each entity added / removed from the list as that becomes true or false.

    Another thing that I was thinking about is the trouble of knowing when to use a system, and when to use something else. I’ve run into that question myself, and found that I say to myself: “Is this functionality need to operate on all of the entities that have certain components? Or is it only going to affect one or two.” I also employ a “scripts” system, which basically runs a mini sub-system loop on each entity. Those scripts are the more isolated behaviors. So a constant acceleration system might affect all entities with a gravity component, where controls from user input would likely only be tied to one or two (player) entities.

    Talking about this does make me want to go play with some code, so maybe I’ll have some example to post in a bit :)


  • LDG

    @Warspawn said:

    I know there’s 17K ways to skin the cat, but I’m surprised that you’d loop over all entities every tick. That really doesn’t seem all that much different from what you’d be doing in a more traditional OOP loop (looping over all game objects and calling their update) except you are then looping over each system for each entity. When I think about that, it sounds inefficient. In the system that I use, whenever a component is added to an entity that entity gets added to a “family” or “families” of entities. During the loop, it iterates over each system and calls update. Systems may query the entity list by components which then uses / creates the “families” as a cache of sorts. The list of systems (10-20) is generally shorter than the list of entities (could be 100s or 1000s), doing it this way each system should have to iterate over only a fraction of the entities. The physics system might ask for all the entities that have position, velocity, and speed. Once it first makes that query then the family will be created, and each entity added / removed from the list as that becomes true or false.

    I’ve considered optimizations like you’re describing here and it seems like a good idea. I try to spend by time on our hot spots and this isn’t currently a problem area in node-webkit/chromium. However, looping over arrays is rather expensive on the Wii U NWF so I might have to implement something like you have.

    Another thing that I was thinking about is the trouble of knowing when to use a system, and when to use something else. I’ve run into that question myself, and found that I say to myself: “Is this functionality need to operate on all of the entities that have certain components? Or is it only going to affect one or two.” I also employ a “scripts” system, which basically runs a mini sub-system loop on each entity. Those scripts are the more isolated behaviors. So a constant acceleration system might affect all entities with a gravity component, where controls from user input would likely only be tied to one or two (player) entities.

    I’ve come to the same conclusion. The “behavior” system I was describing in 106 sounds pretty similar to your scripts system. In AWL, that system was called “scripts” as well. I think the best way to describe it like a mini system because it’s doing the same thing that the higher level systems are, but in the context of a single entity.

    Talking about this does make me want to go play with some code, so maybe I’ll have some example to post in a bit :)

    Sweet!


  • Tiger Hat

    Ok, so I mentioned before in the other thread that I am using ces.js for the ECS. What I decided to start with was something simple, but had graphics and physics to show how those would work together. In the past I would get hung up trying to figure out how to convert the graphics scene graph into ECS, but after fiddling around with that I determined it was madness. So the best way is to just leave it alone and sync it up just like you’d do with a physics engine.

    So here: https://github.com/bsparks/ecs_experiment I have taken the box2d example from pixi and converted it to use ECS (at least one way to skin the cat).

    Of course this is just a simple example and not as complex as a full game. Maybe I’ll try to add onto it and make a flappy bird clone or something :) At least with this bare amount you can see how you can have entities with sprites and physics bodies and/or one or none of those components. I think compared to the original example that it is somewhat cleaner (at least the render loop is).

    I love this topic, so I’m sure I will keep going from here :)

    Edit: Oh yeah I forgot to mention if you want to see a more complex ECS (WIP) check this out: https://github.com/ironbane/ironbane-client


  • LDG

    @Warspawn you got @geoffb thinking even more about optimization :) This is good


  • Patron

    So, when I’m on vacation I don’t have that usual not-doing-anything-anyways time while going to school that’s when I listen to podcasts.
    The result of that is that I’m three weeks late on Lostcast… I know, I’m ashamed.

    Anyways, I just listened to the Mac vs Windows half of the podcast, and I figured I’d best write down my thought before they vanish from my mind:

    • I wasn’t kidding when I suggested a Hackintosh Matt. This is totally Tiger Hat B.S but… I’ve heard that, once you get it working, the support is great. It’s just like having dual boot.

    • For recording on Mac, the amazing @T2norway showed me Screenium. Yeah, I know, it’s shareware (although I got it for free [don’t tell anybody]), but I’m pretty positive that it’s way lighter than OBS and I know from experience that it’s way faster than Quicktime’s screen recorder. I mean, I recorded a AWL vs race with T2 on a mid-2010 Macbook Pro while chatting through Skype. Although that was back on beta 7, that was way lighter than the current versions…

    • Matt, I can’t belive you’ve tried virtual machines but not Wine! I know, I know… bear with me.
      I used to think that Wine sucked, because I could barely run the orginial Spelunky on my old PC through it. Turns out my 7 year old integrated GPU with very outdated drivers was the part that sucked!
      I mean, a friend of mine gave me a copy of Castle Crashers on Steam. I was very frustrated when I discovered that it’s Windows only…
      So, I thought to myself: “Well, I won’t lose anything by trying”, and installed the Windows version of Steam on Ubuntu.
      After solving a weird issue involving the library the Steam client uses to render text (I just had to desactivate it on Wine’s control panel), it just worked!
      So far, Wine works perfectly, except for some audio issues (I generally have to increase the latency a little bit on DAWs so I don’t get buffer overruns. That might be because my kernel version is the basic one, and not the real-time one) and programs that use DirectX > 9.0.
      If the Mac OS port is as good as the Linux one, you should have no problems with your tablet smoothing thingy.


Log in to reply