Archive for the ‘Lighting’ Category

Monster Spawning and AI Code

February 18, 2012

I’ve added the firstĀ  monster to the game, the Slime. They hop around at random, until the player or an NPC gets within their 16-block aggro range, and then they start chasing it. The monsters will tend to head towards the town center block like the NPCs do, if they don’t have a target. Monsters will need to be taken care of as you build your town.

I fixed the spawning system so that things appear anywhere within the active portion of the game world, except for within the town limit and too close to the player. Right now things spawn every half-second, to the set limit of 64 monsters and 8 NPCs, so the town would be swarmed pretty quickly. Obviously I won’t be leaving it that way.

I had a problem with massive slowdowns if anything fell off the edge of the map, so I’m now killing anything that gets under the map by 100 units. If the player hops off the side, I’m just respawning him.

I took the time to fix the sprite lighting a bit, so now they’ll be colored to match the time of day. It isn’t as smooth as I’d like, but I’m moving forward:

The monsters will chase now, but there’s no entity collision testing yet. That will be the next step.


SG’s Game Development Video Diary ep 8

February 16, 2012

I made a vid about the stuff I’ve updated since I started up the blog. As always, sorry about the sharp “S”es. I don’t have any way to soften those yet. Here it is:

Day-night cycle lighting

February 13, 2012

I wanted to get the day-night cycle lighting finished up today, and so I did. The last thing I did was to add the day/night cycle along with the sky and land color changing, but I hadn’t yet set it up to smoothly transition. Now it does. I’m not going to bother making a video specifically for this. It’s one small insignificant thing. I’ll show it off when I add something worth making a video over.

A small problem with the lighting is that I actually need two lights to do the cycling properly – at the switch from nighttime to sunrise, the lighting snaps to the other direction from the moon side to the sun side to light sunrise properly. When it goes from daytime to sunset I imagine it happens too. I think Minecraft suffered from the same problem too.

I haven’t yet tackled underground/indoor lighting yet nor sprite lighting, and I don’t plan on it anytime soon. I have a general idea about how to handle them, but for now I want to put these little visual details aside and get to work on core gameplay.