Powered by Create your own unique website with customizable templates.
CREVIS
  • Home
  • Devblog
  • Apply
  • About
  • Download
ALEC'S

Developer Blog

Using Color to Store Multiple Values In One Grid Cell

12/2/2017

0 Comments

 
Hello everyone!

Sorry for the extensive break I've had from Crevis. I've several things in the past month and a half, most of which are fairly boring.

I first continued where I left off and implemented the day/night system into the game. It looks great, but I plan to add shaders to the sun to give it an edge of realism.
Picture
I spent the rest of the time trying to resolve a particularly annoying lag spike, and I've been pressed with a particularly hard decision. A major lag spike happens when entering a new chunk and lasts for about a fourth of a second. It may not seem very long but it can be very annoying when exploring new terrain. Unfortunately, I wasn't able to find a way to remove the lag. One way of reducing the overall lag is to rewrite the inventory system, as its pretty inefficient.

My personal knowledge of memory management and arrays have grown greatly over the past year, and the inventory system that I created last March is not as efficient as it can be. I plan to rewrite the inventory system shortly, which should bump the game's frames up by at least fifty.

Now, onto the meat of the post - using color to store multiple values.
​
make_color_rgb(r,g,b);

The GameMaker coding language doesn't have very many datatypes. For example, a vector3 ​would have easily allowed us to put three values into a grid cell. Unfortunately we don't have that data type. This presented me with a problem. I needed at least one metadata slot, so I created a separate grid to hold metadata. As time went on the need for metadata kept coming up - durability, random block sprites, enchantments, and so on. These are values that cannot be held by a single slot.

I had to find a way to put multiple values into one grid cell. At first I used ds_lists but they ate up way too much memory. I made a post on the forum and someone mentioned make_color_rgb.

This function allows you to create your own colors by inserting a value for red, green, and blue. The value it produces is a 24 bit number that stores the three values, perfect for what I need. Today and tomorrow I will be re-organizing item property lists and will be implementing a system that can incorporate the function into the game.
Until next time!
0 Comments

    Task

    February's task is to improve the combat system and create a system for enemies and their AI.

    RSS Feed

    Author

    The author of the blog is Alec. He posts weekly, usually on the weekends on Saturday.

    Categories

    All
    Crevis
    Life
    Nesus
    Website

    Archives

    March 2020
    February 2020
    July 2019
    March 2019
    February 2019
    October 2018
    December 2017
    October 2017
    August 2017
    July 2017
    May 2017
    April 2017
    March 2017
    February 2017
    January 2017
    December 2016
    November 2016
    October 2016
    September 2016
    August 2016
    July 2016

Powered by Create your own unique website with customizable templates.
  • Home
  • Devblog
  • Apply
  • About
  • Download