Jump to content
  • Advertisement
Sign in to follow this  

Moddable Blocks Design

This topic is 2167 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Everyone,
So I have been working on a game mainly just for fun but it appears I am a bit stuck. It's mainly a design issue. First let me tell you a bit about the game and what I am trying to achieve. I am working on a game written in java. Mainly for the portability. The main focus of the game is to make a game that is extendable / moddable by a lot of users (not only programmers but also non-programmers).
The bit I am stuck in is that I would like to dynamically generate a world. The world will be voxel based (for those that do not know this is the same way worlds in minecraft look). The world consists of blocks which are either loaded from a txt file (or something similair) or compiled java class files (for the more advanced stuff).
Main Question
So now for the question :). The problem I am facing is how to set this up. The world generation part isn't really the problem but mainly how to create the list off all available blocks. 
I personally was thinking the following. Have 1 class called BlockBlueprint which contains information both of the block types use (meaning the txt one and the class one). The BlockBlueprint would contain information like: name, minOccurenceLevel, maxOccurenceLevel, frequency, textureFile, textureCoords, etc. Then fill this information for each block type creating a list with blockBlueprints (which in it's turn can be used in world generation). 
Then have a second class called BlockFactory which requires a blueprint. This factory would either invoke the BlockTxtLoader or BlockClassLoader to actually create the block (for the world). I am not quite sure what to return from both loaders (a superclass maybe with default functions, or a class which implements an interface).
What would be the best (or another way) of approaching this? Would you use a (blueprint / template / type) like class or...? Also would you use a superclass or interface?
Side Question
Also as my game always runs in Server / Client mode (server hosts world and client only displays world). I would probally need to send all classes over the network to the client and have a similar setup client side. Or are there any other alternatives i should consider?
With kind regards,

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • 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!