Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Update 1 - Building Structures

Sign in to follow this  


As I mentioned previously, the game engine I am using is a custom one built completely from scratch. This left me with a bit of a problem in implementing my GUI as I realized the Android code was probably not portable. I eventually settled on the idea of creating a single Display class which could pass messages to and from the Game itself, meaning that only the Display would need to be re-written when I try porting the thing to PC later. All update calls are sent to Display, which calls the Android UI, while all return messages are sent using classes and formats that the engine understands.

After I got the GUI working, I decided to focus on building structures as opposed to a crafting system because I'm still unsure of how I am going to display the players inventory to them. And plus, building little pretend villages is so much more fun than crafting a bunch of random junk, that is useless given that units still con't actually hold equipment.

I feel that the implementation was a bit more convoluted than it should be: All of the players input is channeled through a script called the CursorScript, when the player wishes to build a structure, they hit a button on the UI which is passed to the CursorScript. The CursorScript then calls display passing it a list of structures the player can build. On the Android system, a dialog appears with the name of the structure (material costs and descriptions are in the manual, there are only about 6 structures the player can build). When the player makes a choice, the Display class then calls the game and sends it an Evaluate command, which the is passed to the CursorScript, which then calls the scene to create an entity and finally an entity loader to load the appropriate structure. But it works and I can't see any glaring theoretical flaws (yet).

I'll probably end up passing the script directly to Display, there isn't really any reason for the Game to worry about this part, but that might cause a concurrency issue, since the Display must run on the UI thread while the game runs on its own thread.

Now that I a construction system working, I need to add resource costs and resource selection, and then ensure that certain structures are built only from certain resources. Then probably an inventory system, then item crafting or unit creation.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!