Friday 8 March 2019

How to profile Haxe HXCPP with Visual Studio.


Note: this should work with ANY executable under windows that has included debug information compatible with VS.

How many days have toy wasted in Haxe trying to solve bugs in HXCPP because you haven't figured out profile or debug properly?

To be honest , after several months and a game almost fully ported, I still don't know how to use HXScout, or making some debugger work in FlashDevelop (or HaxeDevelop).

I have wasted really over several hundred hours not really knowing what was going on under the hood after compiling HXCPP. The only weapon I had for debugging Haxe (HXCPP) was trace();

So you can imagine my code is full of those. Most are left overs just in case it breaks again.

But now I have figured out that I can use VisualStudio debug utils, which includes a profiler. A super powerful one I must say.

How Can we use it? Easy, check these steps carefuly:


Compile some haxe HXCPP program for windows using -debug.
I use Lime and OpenFL so my command would be:
lime build window -debug
 I think you need to add some parameters to the compilation project.xml. In openFL/lime I used:

<cpp build-library="hxcpp" />
<haxelib name="hxcpp" />
     <section if="debug">
         
        <haxedef name="HXCPP_DEBUGGER"/>
        <haxedef name="HXCPP_STACK_TRACE"/>
        <haxedef name="HXCPP_STACK_LINE"/>
        <haxedef name="HXCPP_CHECK_POINTER"/>
    </section>

   
 
Not sure if everything in there is necessary I just added them all. I'm too lazy (busy) to recompile removing one by one till I have an optimum configuration .  If you do it for me, I will edit the post.

Then once it has been fully compiled, you will need to open the EXE file. And right after, after go to Visual Studio and attach debugger to the process, like this:

 Next, find your computer and the executable (process) for debugging:

Attach it now, you will start seeing Events / CPU / Memory usage:
Then, lets profile this thing: Enable [Heap Profiling].
Now it's time to take snapshots to be able to analyse the data:
Nice, you should get now something like this:
Take another snapshot to be able to compare if, in this case, memory is properly allocated.
Click the difference memory text . And you will get a panel full of information , here on the left side...
 Now double click in one of the elements to see more information about it.

Now we get all the instances of that object type, how much memory is taking each one of them, and how long they have been allocated in memory.

You can even double click to view the source code and add breakpoints if necessary. It's great.

Et violá , this is all you need to get you started in the crazy world of profiling.

This is how you profile using Visual Studio . It's super handy for HXCPP developers.

You are welcome ;)

Tuesday 14 March 2017

Beekyr Reloaded. DEV LOG#19: Updating languages screen

Update #19
Updating languages screen

We decided to add flags to the language selection, it looks far more professional.


As an example, I added the screenshot in Spanish, still anyone can use this one right? It means it works.


Thursday 9 March 2017

Beekyr Reloaded. DEV LOG#18: Leaderboards

Update #18
Adding leaderboards
We've been very busy but here they are our cool leadeboards.

We took as reference our Vortex Attack style to later adept it to the needs of Beekyr Reloaded.

Vortex Attack (2015)

Then it was moment to improve it, only 15 positions was no good for this. We wanted to show top 10, your score and near scores, and all time hi-scores in the élite mode (old madness).


We wanted to display the players country (or at least a flag) and that not be automatic, some people like to represent the country they don't live in.
We also wanted to display the date, level and played difficulty.


Also we wanted to add an extra field, played ship, they are all secret except the basic one, this will make people look for them. Or at least that's what we think it should happen.

Once we fixed they layout it looked like this:

Beekyr Reloaded Leaderboards

We're happy with it Smiley

Tuesday 7 March 2017

Beekyr Reloaded. DEV LOG#17: Updating the game trailer

Update #17
Updating the game trailer

Can you spot the differences between the new and old version?

This is the latest trailer (2016)


And this was the first android trailer (2014)




I have also translated it to Japanese, it looks so cool!


Game is available now in STEAM. I will keep posting updates for the achievements and other minor updates.
http://store.steampowered.com/app/484930/

Thanks for reading already!

Thursday 2 March 2017

Beekyr Reloaded. DEV LOG#16: Adding extra feedback when picking up pollen in vertical stages.

Update #16
Adding extra feedback when picking up pollen in vertical stages.
Now when player collects pollen, a small pollen particle will go up for a small amount of time, it looks nicer and also if the plaer didnt understand the text or the signs in the first tutorial. This will display that you just collected pollen, and it is good for you.

The game

Game is available now in STEAM. I will keep posting updates for the achievements and other minor updates.
http://store.steampowered.com/app/484930/

Thanks for reading already!

Tuesday 28 February 2017

Beekyr Reloaded. DEV LOG#15: Adding more variety (boss attacks)

Update #15
Adding more variety (boss attacks)

I just carried on adding variety to the shooting patterns.  And I've decided to add fishes shooting bubbles, praying mantis shockwave or spider throwing some spiderwebs. Each one of these "bullets" behave very different. Some of them leave trails, some don't kill you but slow you down. All of this leads the game to have many interesing scenarios and patterns.



Praying Mantis + shockwave


Spider + Webs

Thursday 23 February 2017

Beekyr Reloaded. DEV LOG#14: Adding more variety (special attacks)

Adding more variety (special attacks)

Until now, the enemies were shooting almost the same: firing bullets with straight paths. The shape were different but still, same feeling.

I decided we could have some venom/poison coming from scorpions or baby-maggots. All of this leads the game to have many interesing scenarios and patterns.


Maggots shooting honey


Scorpion Boss + Poison