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

WIP: Week 1 -- INI Files and Resources!

Sign in to follow this  
studentTeacher

994 views

Hello!

What I hope to accomplish are weekly updates about my engine build, and go over some of the things I've been working on lately. This first one will cover what I did today, but future ones will cover an entire weeks worth of work.

Since last time I created an event system to tie my engine together, I began this weekend working on beginning my resource allocators. Since I wanted to start small and work my way up, I began with INI file types (with my own twist).

In reference to the voxel game I'm working on, I moved my voxel types from classes into a resource to load at runtime. No longer do I have to recompile my code just to change the color of a voxel; I can now fix the .conf file and re-run the executable! It was incredibly satisfying to get this working, and it allows an explosion of different voxel types to emerge rather quickly.

The BlockDef.conf file looks as follows (roughly):## Block Data information is in this file. Format (copy, paste):# [BlockName]# id = (int)# transparent = (bool -- true, false)# material = solid, liquid, gas (string)# color = (4 length array of floats)# [AirBlock] id = 0 transparent = true mat = "gas" color = {1, 1, 1, 1}[NullBlock] id = 1 transparent = false material = "solid" color = {0, 0, 0, 1} [StoneBlock] id = 2 transparent = false material = "solid" color = {0.2, 0.3, 0.4, 1}
For those of you that know the INI file structure, you'll notice one big difference -- there's arrays! I added this simple functionality in order to make defining colors, texture coordinates, and other such things easier to add. Overall it looks solid and is simple enough for newbies to learn!

In the engine, the results are viewable using nested C++ hashtables. Here's an example for gathering the color and name of a voxel from the results:[code=nocode:0]INIFILEMAP map = INIParser::parseFile("Resources/Blocks/BlockDef.conf");for (auto kv : map) { std::string voxel_name = kv.first; INIMAP voxel_data = kv.second; //... std::vector voxel_color = voxel_data["color"]; //...}
In the above code INIFILEMAP is the overall nested hashtable, and INIMAP is the interior labeled data from a specific entry in the INI file. Pretty sweet!

I'm not sure of what to work on next, but I've got the following list of things I can work on currently:

  • rendering buckets
  • transparency
  • texturing
  • resource management
  • python scripting (or lua.....not 100% sure yet on the pros/cons)
  • start physics engine
  • etc....

    Next time we'll see where I'm at with this list!
Sign in to follow this  


2 Comments


Recommended Comments

Ooh, a voxel engine. I am going to follow this.

Thanks for the interest! I'm trying to build a general-purpose engine underneath it for exploring/world generation games so it should be pretty interesting :D

Share this comment


Link to comment

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!