LightGame: Day 32

Meeting with Me and Joe to discuss how we add challenge / tension release to Light Game, initial ideas include:

Cut the Rope style pickup the stars (complete the path) under certain time to A++ the level.

Level timer (simple, maybe too cheap).

Lemmings, set number of pulses need to get to the end (emitter only runs for so long).

We need to nail this in our stake in the ground game structure meeting on Saturday. We should consider how to make the simplest version of the game (emitter, 1x reflector, and collector) more interesting with an A++, a solved and a failed ending.

Other ideas from the meet included a Fourtet style ambient sound track which uses the light pulse rhythm to drive itself, reflectors emitting positive sound to encourage completion of a level. Oh, and making the game French ;)

LightGame: Day 23 – Back after a LONG time!

I’m done! The code rewriting is finished! The main bulk of it only took a few days, but I that ran into a couple of problems I was a little reluctant to fix. My system of only updating paths when there was a change in the game’s state was horrible to work with – it made every change have to be implemented in about four different places.. BAH! I only noticed one of these errors when I tried to add “Chargers”, which is what prompted me to have another change.

I sacked it off completely, the game now recalculates the path every single frame as well as having real time collision ‘monitoring’ on the shots. Now… “bad” I hear you say? Nuh uh!  I have a percentage value which represents the ratio of how long it takes to do one frame of logic and draw that frame against the total time available to achieve 60fps; this value usually ended up being around ~6% on my desktop at ~15% on my laptop in battery saving mode. It increased by only 1%.

This has taught me a valuable lesson that I already knew but should be taking more notice of – stop trying to pre-optimise. I really shouldn’t care at this point if my code takes a long time to run (this is MUCH different from how well written it is); if it ever gets to a point where I need to optimise then that’s when I’ll do it. It’s an unnecessary waste of time to do it before hand – in my case that was one or two percent trying to work around a problem that was much easier just to ignore.

Fun fact: I can handle about 15,000 shots before I start to take an FPS hit, I find it unlikely there will be ever more than 200 in the most extreme cases.

Here’s the current state of the alpha:

Game state

Cyan and magenta makes blue!

The main “difference” visually is the colour scheme – I just made in more in-line with some of the things Simon has shown me. The coloured tiles around the splitter are filters and they simply apply a colour to a beam. It doesn’t just work with white and another colour, you can see a colour wheel in the above screenshot. Unfortunately there isn’t a simple solution for mismatched colours (e.g.Red + Cyan). At the moment I’m just not doing anything, red beam + cyan filter = red beam. This will have to change in the future somehow.

The functionality is also there for any object to have a colour that is applied to the beam, but it didn’t look right on reflectors so I stopped using it. It’s not abandoned, it’s there to use if I find a good situation for it; it might work well for splitters (why didn’t I just call them prisms?).

Charging and health

The other new object in the screenshot is a charger, I’m toying with the idea of shots having some representation of health – mostly likely power/illumination. Different objects will dim the shot until eventually it dies. This is neat solution to stop the player having shots that continue on indefinitely by either redirecting shots back into a splitter or simply just getting a shot trapped between two reflectors. You can only charge a bullet once though, there is no allowance for recharging! This is because infinite loops (recursion in this case, kinda) cause crashes, the path tries to go round and round in a loop forever-more which means the program runs out of memory. The inability to recharge can be explained by overloading/overcharging the shot and it going poof!

There a few things I’ll be looking over the next week or so: black holes, switches/sensors, doors and walls; visually, Simon wants me to do something I have no clue how to do: dynamic light for shadows (I reluctantly see the sense in this..) and finally, looking at how a player would actually play a level which involves, I guess, having an ‘editing’ mode and a ‘solving’ mode as well being able to load levels in from files.

I’m sorry about the 10 day hiatus; it was ‘nice’ having to not think about having something to write… so I may shy away in future from religiously trying to have a daily post, especially when all I can write is “Didn’t do much today!”.

 

 

LightGame: Day 13

Probably going to take longer than I originally thought to get things nice, I won’t bother with the Day X posts until I’ve done tidying up the code!

LightGame: Day 12

Splitters: Done!

There was a pretty soul destroyed bug (see Help!) where I again realised my code is pretty addition unfriendly because I just couldn’t be bothered to fix it. It was pretty minor, but noticeable… so I’m taking this opportunity to migrate to a new project file whilst rewriting what I think needs to be written! I expect this will take at least two days, perhaps more!

Help!

The shots are having babies! Can you tell what’s going on here? :P

LightGame: Day 11

Had a chat with Simon today about what we should do going forward; he also showed me some visual concepts which I didn’t think suited my original vision or what the game feels like it should look like so he’s going back to the drawing board with that with more a laboratory/workshop feel in mind.

Simon also saw the alpha for the first time today, said it was fun!

LightGame: Day 10

Well, I managed to get those bugs I mentioned fixed, and in doing so I realised my code is a mess! Adding much more is going to make it unbearable to debug or create any additions to the game since the code is currently all over the place. The code structure also halts my progress somewhat because (for example) functions that would be better grouped together are spread over 3 different classes, but on the other and this isn’t entirely unexpected since I’ve been changing things along as I go to find out what’s right or what works… and this is technically still only a prototype.

I started working on the splitters today which are definitely more complicated than the reflectors were; as soon as I have them working I need to get Simon to have play so he  can see whether or not it is worth the time to reorganise the code and introduce some new classes/functionality get the “add-ability” I wanted. I personally think we have a good game in the making, but it’s become pretty clear that in the end, if the success of the game was to be put down to one thing it would be level design – regardless of how well all the objects connected and affected each other.

I would like to try getting this the first alpha (prototype, whatever!) working on OS X so that Simon has easier access to it; I would use Monogame for this. This is the reason why yesterday I was trying to get Mountain Lion working in a virtual machine but I think I had the wrong version so that’s… pending! :)

LightGame: Day 9

Took the day off to play video games and to get OS X running in a virtual box!

LightGame: Day 8

I added the shots that follow the path today, I completely changed my thinking in regards to how they would follow the path so much so they bullets are not even aware of the path now!

Laser shots

The line indicating where the light ends up is completely separate from how the bullets travel around. Whilst this sounds inefficient, what happens if the path changes so that a bullet is stranded? I would have to check for this frequently, and switch to the pathing new system anyway, unless I just destroyed the bullet as soon as it was no longer on the path… but that would far too ‘unfair’ and remove a lot of feedback from the system. There are two bugs though, the bullets only look for what is ahead of them once, and that’s when they interact with an object, and the other bug happens when a reflector is removed – the bullet will ignore anything else it meets and fly off the screen. Basically, reflector addition/removal will cause bullets in flight to ignore new reflectors or ignore any pre-existing reflectors it never originally thought it would! I hope that makes sense =P

There is a fix for this; I don’t have to deal with rotations/reflections because bounce off angle is retrieved the instant a collision with a reflector occurs, and removal of reflectors is very easy to deal with: just recalculate where the next obstruction is.

The first issue required more thought. Imagine a bullet travelling from A to B. A reflector (C) is placed between the two points somewhere. If the distance between the bullet and A is bigger than the distance between A and C then we don’t need to do anything – the bullet has passed C so will still collide with B anyway. If the reserve is true, we need to update the path because we will be colliding with C!

LightGame: Day 7

So, after a week I still don’t have a full prototype; I keep getting distracted by adding/implementing essentially useless stuff! I’ve not even thought about colour yet, and I still need to add splitters as well as laser shots rather than a constant beam, not to mention my code is far from perfect and could do with some reorganisation to help me to increase efficiency.