The concepts behind all sixteen levels of Car Coder are in place, and the bulk of the remaining work is the code needed to support the goals for levels fourteen and fifteen. Also, the layout for level sixteen, which is just going to be a combination of the past levels, is not done. I feel good about the recent progress made but now finding time to work is becoming more difficult because I need to make this more of a priority than I have been. Changing habits is hard, and I always want to change everything overnight which never works and ends up frustrating me more.
This is my problem now:
Holy half-flip, Batman, this game is fun. I have been playing this every opportunity I have had to do so since I started playing it about a year ago. My gosh, I like this game. Given the choice between working on my car game and this one, I will choose this one, so I need to stop that. From now on, I will not play Rocket Crack™ until I have given dev time to Car Coder!
Level 10 and 11 are working now. For level 10, a crowd of people is (are?) crossing the street, and for level 11, you have to drive in between two stationary people. When I say people I mean the pedestrian model I discussed in my last post. I’m making myself finish a new level every week until I hit 16, so levels 12, 13, 14, 15, 16 should be done in the next five weeks assuming I don’t have like a vacation or something coming up. When that’s done I’ll focus on polishing the game up. There’s going to be a serious amount of work then, but for now it’s just fun.
I wanted to talk about another idea I’ve had that came from me learning that none of the really big rogue-like games that are popular right now are taking true advantage of multi-threaded application design. Specifically, Dwarf Fortress runs on a single thread and this just seems like a tragedy to me. I had to stare at the wall of my bathroom for a good two minutes after reading about this if you know what I mean (spoiler: I was pooping at the time) and fester on how it could be that the game considered to be the most complicated simulation in the world runs as a single threaded application. Someone pointed out that it does run things like rendering and sound on separate threads but the vast majority of the simulation does not take advantage of multi-core processing which becomes noticeable once the game has a lot happening right in front of the player. I’m guessing things off screen are just approximated which I get because we don’t have enough machine power to simulate everything in the world, but, I mean, really?
I was quite sure after reading this that the developers behind DF had very good reasons for doing this. Things have to happen sequentially for the simulation to make sense, and doing things all on the same thread ensures things happen in the order they should, but I am not able to accept this explanation because I have heard suppositions like this before and have seen them proven wrong, so I decided that I needed to take matters into my own hands and develop a massive simulation like DF while attempting to take advantage of multi-threaded processing to see for myself why this is impossible. My theory is that I can break up the work if I set up everything using a layered approach (similar to the OSI networking model) and then pass this on to a thread pool for processing.
The most basic example I could think of was considering times when multiple creatures attempted to enter the same block (google rogue-like or dwarf fortress and read about how the map is setup if you’re not sure what I mean by this). If two threads checked that the block was empty at the same time, each would see an empty block, and then allow the creature to enter the block, which as far as I know isn’t allowed, or would at least signal an interaction between the two. However, if you broke this task up into a few different pieces, each creature could then create a request to enter the block which are placed in a block-specific queue, and are then dealt with by the thread pool once all the creatures have made their movement requests. Breaking up things into smaller and smaller chunks, you should be able to spread out the needed instructions across multiple CPUs (GPUs?)
One situation I keep thinking of works like this: two creatures want to move into a block, so some thread comes along and says, hey you both can’t move into the same block, do you want to attack instead? One may say yes, the other might say no. Who moves into the block? Additionally, lets says 10 CPU cycles later, turns out another creature wants to move into the same block, do we now go back and ask the first two creatures if they want to attack this third creature? Do we have to accumulate all the movement requests before they can be processed? Also, creatures can been in different states at different times, and even multiple states. Most animals and people can think and move at the same time, right? So, once a creature decides to do something, and they’ve made this decision before another creature does, shouldn’t they get to move into the block (assuming they’re faster) first? And once they’ve moved into that block, wouldn’t that influence the decision making process of any other creature within viewing distance?
There’s a lot of questions like this to answer, but even if you were to assign threads to groups of adjacent blocks, it would be a better design that using a single thread for the entire simulation. However, truth be told, the real question is, how in hell am I gonna find time to do this?! 😉
You can’t have the old trolley problem without taking a few innocent lives, so the game needs pedestrians! Unity offers many prebuilt assets for this, but because I’m still in the initial development phase focusing on the real content of the game is more important than wasting valuable time and willpower dealing with complicated 3D models of humans. While I was trying to get to sleep a few nights ago, I realized that I just needed to make the cardboard cutout (used in a previous level) mobile, so why not just put wheels on it so it can roll around in whatever direction I need. Here’s what I ended up with last week after wasting a few hours with blender (I ended up just using unity’s primitives because I’m too impatient for a real modeling app):
My modeling skills are embarrassing at best, but it works. I want to make the wheels more like bicycle wheels that spin when it moves so it looks like somebody made it in their garage at 3am. It’s only able to move in one direction, but you can specify the speed. I also want the pedestrian image itself to be an actual cutout not just a textured plane, but that will have to happen later when I have all sixteen levels working.
Bad as it looks, it works, and I was able to do the first real level where the trolley problem is implemented in the game. I’m hoping to have a playable demo on here soon. The neat thing was adding this to the game as an obstacle attached all the behaviors the previous obstacles have as well, so colliding with it causes a failure and so forth without any additional coding on my part. Maybe you can OOP correctly?
So, we’ve relocated to http://newcarrots.games and I’ve finally got the code editor working the way I want. I need to build and publish the latest version of CC up here somehow.. working on that now. I’ll post an explanation and also write about some of the problems I’m having now with finishing CC.
Every five minutes, it appears, I click on a number between 1 and 9 to describe my current stress level, and it pushes that data to an ELK stack which let’s me see how I’ve felt:
I thought of this yesterday while working on the playground I’m building for my kids. I was applying finish to the playground’s wood and I got really antsy and wanted to stop while I was thinking about all the work I had to do. I thought maybe I would just keep going and see how I felt in a few minutes and compare the results, and after about five minutes that feeling had subsided and I felt fine about the work I was doing. I then thought wow what if I had stopped then? So, to apply this to my current gamedev project, I made this application to monitor my overall stress level. Zero and ten are asymptotes. You always have some level of stress and ten would mean stress to the point of quitting life. I would hopefully just quit was I doing long before that happened.
I truly believe I’ve established this axiom regarding productivity: it’s a balance between my own physical/emotional/mental limits and my ambitions. Work too hard, you’ll end up too stressed which greatly impacts your health, but work too little and you’ll regret not doing anything impactful. Now, I’m working on applying this to my life. Lately I’ve been ill, but not to the point of constant bed rest, I just feel down and out with a minor cough and sinus congestion. I meant to bring my cold stuff with me today but I forgot if that tells you anything about how bad this cold is. I need to get back on the wagon.
I have fallen behind on my exercise regimen and the results are noticeable. I had a pretty hard fall playing basketball which hurt my leg and hand so I wasn’t able to work out or simply needed a break and then I got sick. Now I feel like I’m completely done and won’t be able to get back into the routine I had previously. I’m going to run later today I think to get back into the habit. I don’t have my ball with me but I can at least run and use the weights at the gym. If I don’t exercise I won’t be able to deal with the stress level I’m at right now. I’ve never been this busy before.
Same plan today I guess. I’ll keep making these updates until I feel comfortable with what I’m doing. I’m going to get my day job stuff done and work on CC hopefully around 3 or 4pm this afternoon. I refactored the CarCodeProgram class yesterday so it’s much cleaner and easier to work with. Still working on being able to move instructions by dragging them around. I also had the idea of being able to full-screen the editor in case the screen is too small to make a very specific change. Hopefully I can get the drag and drop reordering working. I’d like to be able to have the CarCodeProgram class reorder the list when the array itself changes but that’s all dependent on the same code (I would still use the code I’m writing now although things would be organized a bit differently), but it would make things easier if I start adding new instructions later on. Also, I should use actual icon images and not font awesome for the instruction icons… anyway, that’s for later. My next update won’t be until Monday unless I have time over the weekend to work which is doubtful.
Yeah, um, balance… well, what does that mean? I’m thinking that first, I have to setup a basic schedule/plan each day, but then I’ve got to make sure there’s some down time in there. Seems simple enough to me. So, start out with some basic reading and surfing until say 10, then day job until say 4, and then work on CC. Actually, I need to check emails first. That always has to be done first thing so that nothing sits there while I’m just doing whatever.
I’ll check in tomorrow and see how that went? I’m working on the code editor in CC adding in some usability features like dragging instructions to reorder them. If the editor isn’t easy to use and intuitive (I think that means it’s easy to understand) no one will bother with the game. I need to get this right or it won’t have a chance at being successful.
Right now, you can drag instructions to delete them but that’s it. I need to refactor it a bit to make it easier to program on too.
I’m ending my experiment today. After two months I can see that taking the, “when I feel like it,” approach yields nothing. I worked on some projects maybe twice and very little was done. Mostly I just played games when I should have been working on something.
I’m not going to pretend I haven’t gone the other way either. I’ve ran this same experiment far more times than I would like to admit, and the results are the same. I feel this tremendous amount of motivation, work very hard for a few days, and then get so stressed out I end up sick or seriously depressed.
I have enough evidence to conclude my experiments. I have to find the grey area here between these two polar opposites. If I don’t schedule time to work and have a plan describing what I need to do, nothing will get done, and if I try to do everything at once I won’t be able work at all. That’s it, I’m going forward with my findings so no more binary work ethic.
I’m thinking that I’ll have some time, maybe 30 minutes to an hour, later in the day to work on Car Coder sometime after 3pm. I still don’t like that name.
EDIT: I just wanted to make a note about the release date. If I keep working on the project regularly I’ll finish it, but I can’t work with hard deadlines right now. If I was working on this full time maybe I could do that, or have a better estimate. Honestly, I don’t think this project will be ready by the end of the year, but I should know when it will be done by then because I’ll be able to track my progress/productivity as long as I keep making updates here. If I keep breaking down the work involved and work regularly I should be fine.