Liberated Pixel Cup Day 14

Today was the day of mining camps and Wood Mills. Wood Mills and mining camps have to be within a certain distance of their respective map tiles to be place-able on the map. Beyond that the rest of the day was dedicated to fixing bugs and updating collisions checks. Hopefully tomorrow I will be able to get the rest of the buildings into the game. The main challenge in getting this done will be getting images for all the buildings out of the limited set of provided graphics. Hopefully all will go well and I will be able to post screenshots tomorrow!

Liberated Pixel Cup Day 13

Made a decent amount of back-end and graphics progress today. The back-end consisted of two main parts. Firstly I got caves properly showing on the map. This is essential to add mining camps as a building type to the game. Second I re-factored all the collision code into a single function in the simulation class. This class will handle everything from not placing buildings on top of each other, to placing mining camp and wood buildings within a certain distance of their map tiles, to even requiring roads be hooked up to buildings. In addition I made all collision functions pass around a rectangle of the building. This leads to more parameters in each parameter list, but is way more flexible than passing around different objects. Lastly I converted all my psd files to png for the game. It looks a lot better without a bunch of solid box placeholders!

Liberated Pixel Cup Day 12

More of the same today. I continued to look into image creation for the various buttons and images, and I also started on a ‘MapTile’ hierarchy. This will contain logic for both trees (forests for wood), and caves (for ore). Things are overall progressing nicely. It looks like I’ll have a decent chance of having something to play-test by the end of the weekend.

Liberated Pixel Cup Day 11

Not a whole lot of code work done today. I did make a villager class that all people in your village will come from. They have information so far on the job they perform (ie, what they do), and where they live. A quick addition even as I type this is they have to know -where- they work, so if you delete buildings, the right people will be reassigned. By itself you’d think that wouldn’t really be important, but it is important to note that when you assign a person to a job, they will go to the ‘best’ place for that job.

Most of my time was spent looking for images for the various buildings and preparing them for the game. So far I have the add farm button done as well as the actual farm ‘image’ for on screen.

Perhaps more tomorrow (though I do have a test in summer school :/)

Liberated Pixel Cup Day 10

Zero completed today due to a long day at work and evening class. While sitting at work, I did come up with a quick solution for dealing with the requirement of wood production buildings being near forests. Each set of ‘forest’ tiles will be in their own data structure (not part of tilemap). You of course won’t be able to build buildings on them (even better since there is no water on the maps, and thus no need for collision detection in tilemaps). It will then be trivial to check if a forest tile is close enough to generate x wood/turn. I’ll probably follow a similar approach for mining as well.

Liberated Pixel Cup Day 9

Pretty much nothing new to report today. I added the placement of farms, which is just a copy and paste from the housing code (I wonder if there is a better way of doing this than a bunch of copy and pastes that does not have too much overhead in terms of development time??) I also gave each Image object its own alpha value, instead of each Surface in memory. This will let me have two identical source images with different alpha values.

I’m also going to add another directory in my project for I can have Photoshop (.psd) files. So far I’ve just been exporting the things to png, sometimes even forgetting what I did for like images which is silly (like transparency values).

Another perfect build in linux rounded out the day.

Liberated Pixel Cup Day 8

I created a new Object class that all future buildings will inherit from and was able to move the castle class over to that as well as a house class. I was then able to add the ability to place houses on the map. Each time the ‘Add House’ button is clicked, the actionBar is disabled and you get to place a house. If you hit escape you are put back into normal mode and the actionBar is shown again. The same can be said if you actually place the house. I also added basic collision detection for you can’t place a house on another house or the castle. While I didn’t get through the objectives that I had hoped by adding farms, it should be really easy to add since for now its the exact same workflow as houses.

I’m still holding out hope that I can finish all the features in the design doc by the end of next Sunday. That may change in the next few days though.

Here’s a screenshot. Still not a whole lot to show for all my work, but each day I’m getting more and more back-end stuff complete.

Liberated Pixel Cup Day 7

I’ve started to slowly look at the design document and implement things as they come. So far that means I can place a castle, and there is a button to place a house (though you can’t actually place it yet). I’ve also happily increased the screen resolution from 800×600 to 1024×768 which gives me a lot more room to play with.

Hopefully more tomorrow!

Liberated Pixel Cup Day 6

Not much more to report today. I was able to get the main application to fully load all the loaders (sound, image, font) and got it to display a 50×50 tilemap. I then fully extended the functionality of TileMap with ScrollingMap. This lets me scroll across the map that is larger than the display screen by either the keys wasd or hovering the mouse on any edge of the screen.

I did run into a problem but it was easily solved for at least now. So far the game is just drawing the map and nothing else, but it was taking 25ms per game loop. This already sets me at a 40fps. While I do not need that high (shooting for at least 30 really), you have to realize how little of the game is complete. Luckily I was able to pull some tricks and get it down to 10ms per game loop. if I’m going for the 30fps that means I have 23ms more to budget. Of course that is the bare minimum and I’d really want at least 40fps, giving me 15ms more budget. I’m hoping on two things to be able to accomplish this. Firstly I am hoping that the 450 or so tiles I’m displaying on screen with the tilemap is the vast majority of the overall images I’ll ever be drawing in a frame. Secondly I’m hoping the drawing itself is incredibly inefficient compared to normal logic since it is SDL an nothing low level like opengl or directX. I really do not have the time to research either one fully so only time will tell at this point.

Small screenshot of what I got so far, nothing super impressive.

More tomorrow.

Liberated Pixel Cup Day 5

Another day with little progress. The one thing I did manage to make is a MouseImage class. This class basically allows you to have an image move around the screen with the cursor. This will be great for placing the castle at the beginning of the game as well as specific buildings.

On another great note, the linux build required no syntax changes for the second straight day!