Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 20 Dec 2006
Offline Last Active Apr 14 2015 02:56 AM

Topics I've Started

Moddable Blocks Design

03 January 2013 - 02:16 AM

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,

[C++] Enums

16 February 2010 - 12:48 AM

Hi all, At the moment I am working on a project written in Visual Studio 2008 (2005 compatible). I am trying to convert this project to an eclipse CDT project (in combination with GCC) (because I want to have a project that is also compilable on Linux / Mac / XBox / PS3 / etc). The existing project contains 2 types of enums:
enum myEnum
enum myEnum : unsigned int

The second enum declaration is not working in GCC (which is normal because it's a Visual Studio definition). I have created the following declaration to keep the project compatible with visual studio:
#define ENUM8PRE
#define ENUM8POST : unsigned char
#define ENUM8PRE __attribute__((__packed__))
#define ENUM8POST

I then define my enums as following:

When i create a single file (as a test project) this works like a charm. But when I add it to the main project (which consists of 2 seperate libraries) I get a lot of 'does not name a type', 'was not declared in this scope' and 'has not been declared' errors. The anscii drawing below shows the project setup: | - API | - myClass.cpp (includes platform.h && myenums.h) | - Core | - platform[/indent] | - platform.h[/indent][/indent] | - Shared | - myenums.h Any ideas on why the project is giving so much errors about enums not being defined With kind regards, EyeSize [Edited by - EyeSize on February 17, 2010 4:41:39 AM]

What is the best way of doing this

05 May 2008 - 10:52 AM

Hi all, Well I have a bit of experiance programming 3D Games using DirectX. But now I decided to create a full game (and its comming along nicely). I wanted to add a menu because I need the player to select a player profile (so I can load the players info). But now I have a bit of a problem because how should I draw my menu items. I want to create (sort of) a gui system. It only needs to contain a list box (custom made with images and stuff), buttons and labels. I have them all set up and added them to my render list. But now I have to tell my program how to render. Should I render them a sprites (so I can add nice transparency and rounded items) or should I create vertex buffer planes to draw them on. Or is there a better way. I already tried it with vertex buffers but didn't like the fact that (when creating a mouse pointer) I have to matrix move my vertex buffer and didn't have a pointer (it was more like a box moving on the screen). Also when I create sprites it works nicely only problem is that when i move my mouse and after clearing the scene redraw it it leaves a blue square behind (on top of my background (blue is my clearing color)). So how to create menus (and later on in-game huds)? I tried searching but couldn't really figure out what keywords to search on (tried main menu, sprites vs vertexbuffers, etc). So if anyone could give me some advice I would really apriciate it. (also tried irrlighh or something like that (the 3d engine) to see how its done but didn't find out. With Kind Regards, EyeSize