Saturday, June 14, 2014

Free From Memory

Another check in, the past few months I set off to remove all memory leaks from hero quest, using Valgrind (or more specifically, mem-check). However, I encountered this:
"At one end of the scale, Memcheck adds code to check every memory access and every value computed, making it run 10-50 times slower than natively."
One of the memory intensive things with most games is loading images or textures. As the character selection screen loaded the same images multiple times, whenever I was trying to free memory around there, I had to wait approximately 5 seconds for the screen to load. If you choose "VS Mode" in any computer game, you expect it to load the character selection screen instantly; 5 seconds is a long time.

This prompted me to add a caching layer on top of my image loading. However, my coding skills at the time of writing the graphics component were not at a level that enabled me to produce extensible code. So, I spent a few months doing the following:

  • Replacing SDL 1.2 with SDL 2.0 (SDL 2.0 was released)
  • Rewriting the graphics component from scratch
  • Updating existing code to use the rewritten graphics component
  • Finding memory leaks, and fixing them (if possible*)
* some leaks were detected in SDL and system libraries, I did not fix these

I'm happy to say the final result of this is the following Valgrind report:
==4498==
==4498== HEAP SUMMARY:
==4498==     in use at exit: 56,314 bytes in 469 blocks
==4498==   total heap usage: 129,540 allocs, 129,071 frees, 519,910,160 bytes allocated
==4498==
==4498== LEAK SUMMARY:
==4498==    definitely lost: 0 bytes in 0 blocks
==4498==    indirectly lost: 0 bytes in 0 blocks
==4498==      possibly lost: 0 bytes in 0 blocks
==4498==    still reachable: 55,998 bytes in 460 blocks
==4498==         suppressed: 316 bytes in 9 blocks
==4498== Reachable blocks (those to which a pointer was found) are not shown.
==4498== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==4498==
==4498== For counts of detected and suppressed errors, rerun with: -v
==4498== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 12 from 6)

What's next:

  • Launching a game instance with selected characters (including assigning an ai controller)
  • Maps / backgrounds
  • Interaction between characters


Monday, September 30, 2013

Awaken!

Been a while since I've posted, but Hero Quest went through another rewrite (I know =/). Here's where I've gotten up to since the rewrite:


That's running on Ubuntu - g++ on windows did not yet have support for atomic_int when I attempted to compile Hero Quest there; haven't re-attempted to compile on Windows yet.

Syntax for character data has changed to using xml, and hopefully it's going to make things easier. Check out heat.xml.

The app is also theme-able, and the widget animations scriptable: theme.xml.

My next major step is to get a control settings menu done, some refactoring, and then I'll start working on the parts needed for gameplay. Main reason is to get the "boring bits" out of the way first. Fun stuff will be fun.



Azriel~

Thursday, July 12, 2012

One More Menu

What's new? Well, I've adopted c++11, or at least, started to.  The GNU Compiler Collection doesn't yet have support for std::thread on Windows as far as I could tell, will be great when that's done.

For visible changes though, I've started work on the character selection menu (yay!).  Getting the logic done now, but for the actual design and how it will look in the end, that's something that will be done later. Here's a screenshot that doesn't look very exciting:


What it can do now is cycle through available characters and change teams (the border around the face pic changes colour).  I really enjoy working on this, but I might not be able to speed up progress just yet (will try though). Until next time.



Azriel~

Sunday, March 11, 2012

One year later

And no I haven't given up yet.  I have been busy, and with university over, and work started, I still have managed to do a little work on hq:


Interesting things in that screenshot:
  • Life bars (they change colour the lower the character's hp is)
  • Shadows
I don't really want the life bars to stick under characters while fighting, seems a bit distracting, although it helps identify the weakest target.  Probably will go with a user interface overlay.
For shadows, the direction the light comes from can be changed (left to right angle, and top to bottom angle), but currently the shadows are just rendered flat onto the ground.  I've been reading up on shadow mapping and perhaps I'll implement it in the future, but if I don't, then we might just revert to simple shadows.

Right now I'll be working on the user interface, and then on more of the in-game logic (catching is buggy). Oh and, characters can be killed now (the logic for how to deal with a "dead" character is harder than you'd imagine).



Azriel~

Saturday, March 12, 2011

Floating rocks... what next?



Work ended, university started, and I didn't feel like doing assignments, so, I took some time to work on the platforms for Hero Quest. I think it looks pretty shiny now, with the Storm Cliff map graphics drawn by Blue Phoenix. Not tested thoroughly, and certainly not bug-free. Anyways, I won't be working on HQ for another while while assignments keep coming. Till next time.



Azriel~

Saturday, November 27, 2010

Slowing down

Work starts on Monday (first day at a real software company, yay), but that means progress on hq will be slowed.  Anyway, things I've done since the last update:
  • background animation
  • parallax scrolling (includes acceleration/deceleration)
  • parsing character attributes (walking frame rate, speed, etc.)
  • linking character attributes with the processor
  • linking map friction with object behavior
  • object points for maps (creating objects at the start of a game)
  • correcting data parsing (various bugs)
  • pulled out the frame element parsing from the Frames class into a common parser so that the code can be reused (instead of duplicating the object point code into the Map class, a single call to the corresponding function can provide the same functionality)
Also, here's a video of the camera scrolling + background animation:



I plan to get platforms working next, but still thinking about the design (the last one had to perform operations on platforms in multiple places, going to see if that can be reduced and contained).



Azriel~

Friday, November 19, 2010

Maps


Exams over - time for an update. Cleaned up the loading code so it's easier to add objects to the game without having to recompile, and also wrote code for maps - analogous to backgrounds in Little Fighter 2.  However, maps will be more interactive and dynamic.

The syntax differs slightly from the LF2 background data files - filled rectangular areas now use rgba values to specify the colour, and pngs are able to be used for the images. The transparency tag hasn't been implemented, as you may use pngs if you want to have transparent areas in a layer

TODO list for maps:

  • parallax scrolling (with camera)
  • animation
  • layers that render over characters
  • linking map data with objects (bounds, friction, etc.)
Other things to do in the near future are opoints and interaction.  That's all for tonight.



Azriel~