Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

lorewap3

5
Posts
1
Topics
6
Following
A member registered Oct 04, 2019

Recent community posts

Sorry for the confusion. I attached only the obj_emu_demo object because it's the only thing I changed from the base demo. I thought having that as the only file would make that clear but re-thinking that logic makes no sense. So yeah, use that obj instead and it should produce the leak. 

Yeah I eventually found the text var and just tried updating that directly, but I'm still getting this weird mem leak that makes no sense. Here's another version where I'm updating the text var directly:

https://drive.google.com/file/d/1R_7FbTHdrQh2l97G6tBNuKuNz2Ifb1Ui/view?usp=shari...

(It's only the 1 obj since we've established that's all I changed ;)
I'm just incrementing timers... it's weird. It's only when the summary tab is in focus does the memory just steadily climb. 
Maybe you've fixed it in your newer version, though. I haven't had a chance to update anything based on your post. But I'd still be curious for you to check it out. Just for my sanity. 

Thanks for the quick reply! If you don't mind, I have another question for you.

The UI options are awesome, and I know I'll eventually use them, but my first use-case is really just organizing debugging output. I have on-screen debugging for alot of things, just simple draw_text calls in the location where the equivalent debug object is positioned in the room. State variables is one of these. As you can guess, I quickly had 10+ state debugging objects everywhere. So I want use EmuUI tabs and tab groups to organize them, so I can have all states in one window and switch between the ones I'm debugging. Just tabs in a tab group with ALOT of EmuText in each tab getting destroyed/recreated every frame. As you might imagine, this absolutely tanked performance, though I didn't realize how much it would. My test case had 10 tabs, with a dozen or so EmuText lines. I would love any suggestions as to how to do this better. I have the same debugging data being output before, so it's not the computation of the data, it has to be the constant deletion/creation of so many structs constantly. It quickly goes from 400fps to 60 and then drops slowly after that.

But I'm unsure I'm even clearing the content correctly, as a call to Destroy() on the tabs seemed to cause a crash. RemoveContent() seems based on having the struct ids, so I added a RemoveAllContent that just cleared the contents ds_list. 

But besides that, one issue I did notice, which is compounded in my project, is there seems to be a small memory leak. I tested with the demo project, adding a frame counter in the create event and then incrementing and setting that to the summary. Here's a link to get the modified obj_emu_demo

https://drive.google.com/file/d/1UfcZQG7oyPpUgDn_mkT0-xOE-LLHPjxM/view?usp=shari...

It's small, but you can notice the mem usage just climb over time, which it doesn't do in the base demo. If you look at the code, though, I'm just removing content (via the variable itself), re-creating, and re-adding. As far as I can tell I'm doing everything I should be doing. I'd much appreciate your insight!


Thanks again!

Will

Hey man, just letting you know I picked this up and gave a donation for you. Much appreciate this asset. I have a lot of programming experience but new to game dev, that's why I started with gamemaker. But quickly came to long for a way to implement OOP. Structs are close enough! 

Still wary about callback functions, though. Most of my xp is web dev, and I love Javascript, but I'm wary about doing it with structs atm. *Shrug*. Keep up the great work!

Btw, you have a bug in the dialog buttons in the demo. Needs header_width in EmuDialog. Also, first thing I did was invert the colors as I prefer dark modes, and your list selection is hardcode to c_black in EmuList. I just added another macro for it in emu_init.

Hey Matharoo,

Sorry I didn't respond until now. It was going to be difficult to send you the project as it currently is, I load alot of json files from the filesystem and the code that calculates the attach_point is buried below a good number of inheritance that would've taken just as long to explain hah. But I figured it out. I just had to think it through procedurally. I have sprites that I flip the image_xscale , image_yscale, and image_angle after that so I just needed to process it in order. 

Here's the code in case you are interested!

In essence I get the current image_index, then calculate what the attach_point would be considering ONLY image_xscale and image_yscale, which isn't too bad. Then after that's all done I calculate the image_angle. What was throwing me off is that once you flip the image on the x or y axis, it also flips the attach_point direction the opposite way. So the code I had was already correct, it just wasn't the result I expected. 

Thank you for replying so quickly though, I appreciate your willingness to help! I appreciate your videos!


var _curr_index = floor(image_index);

if (_curr_index >= array_length_1d(_attach_points)) {
_curr_index = array_length_1d(_attach_points) - 1;
} else if (_curr_index < 0) {
_curr_index = 0;
}

var _curr_attach_point = _attach_points[_curr_index];

_offset_x = _curr_attach_point[0];
_offset_y = _curr_attach_point[1];
_attach_point_direction = _curr_attach_point[2];

// **************************************
// **************************************
#region Calculates x/y coordinate and direction of attach point assuming image_angle = 0
// Normal direction
if (image_xscale > 0 && image_yscale > 0) {
_adj_offset_x = _offset_x;
_adj_offset_y = _offset_y;
_adj_attach_point_direction = _attach_point_direction;

// Flipped horizontally
} else if (image_xscale < 0 && image_yscale > 0) {
_adj_offset_x = _offset_x * -1;
_adj_offset_y = _offset_y;
_adj_attach_point_direction = 180 - _attach_point_direction;

} else if (image_xscale > 0 && image_yscale < 0) {
_adj_offset_x = _offset_x;
_adj_offset_y = _offset_y * -1;
_adj_attach_point_direction = 360 - _attach_point_direction;

} else if (image_xscale < 0 && image_yscale < 0) {
_adj_offset_x = _offset_x * -1;
_adj_offset_y = _offset_y * -1;
_adj_attach_point_direction = 180 + _attach_point_direction;
}

_adj_attach_point_direction = wrap(_adj_attach_point_direction, 0, 359);
#endregion
// **************************************
// **************************************

// **************************************
// **************************************
#region Calculate x/y/direction taking image_angle into account
if (image_angle != 0) {
// Gets angle of the straight line drawn from center of player object to attach point
_attach_point_direction_from_center = point_direction(0,0,_adj_offset_x, _adj_offset_y);

// Once starting direction is determined, calculate adjusted based on image_angle
_img_angle_adj_direction_first = _attach_point_direction_from_center + image_angle;

// Get length of line from center of player object to attach point
_length = sqrt(sqr(_adj_offset_x) + sqr(_adj_offset_y));

// Gets new x/y coordinates of new attach_point angle when you add in image_angle
_img_angle_adj_x = lengthdir_x(_length, _img_angle_adj_direction_first);
_img_angle_adj_y = lengthdir_y(_length, _img_angle_adj_direction_first);

// Finally, add direction of actual attach point to new calculated direction
//_img_angle_adj_direction = _img_angle_adj_direction_first + _adj_attach_point_direction;
_img_angle_adj_direction = _adj_attach_point_direction + image_angle;
} else {
_attach_point_direction_from_center = "N/A";
_img_angle_adj_direction_first = "N/A";
_length = "N/A";

_img_angle_adj_x = _adj_offset_x;
_img_angle_adj_y = _adj_offset_y;
_img_angle_adj_direction = _adj_attach_point_direction;
}
_img_angle_adj_direction = wrap(_img_angle_adj_direction, 0, 359);
#endregion
// **************************************
// **************************************

emitterX = x + _img_angle_adj_x;
emitterY = y + _img_angle_adj_y;
emitterDirection = _img_angle_adj_direction;

Hey Matharoo, 

I'm really enjoying the tool, its immensely helpful! I was hoping you could help me out with a little implementation, though. 

The attach points work fine with a character with image_x/yscale = 1 and image_angle = 0, but in betweens I'm having trouble figuring out the correct algorithm. 

I got the 4 combinations of image_xscale -1 / 1 and image_yscale -1 /1 to work right using 4 if statements, but adding image_angle to the mix has been difficult. I'm thinking I need to remove image_yscale from the mix and just use image_xscale and image_angle. I would appreciate any thoughts you might have on the subject. Or perhaps you wouldn't mind sharing the code that you use? 

Here's a sample of the code I'm using. The attached point is a particle emitter, so emitterX/Y/Direction are the values I use after recalculating from the original attach points.

var _curr_attach_point = _attach_points[_curr_index];

var _offset_x = _curr_attach_point[0];
var _offset_y = _curr_attach_point[1];

var _length = sqrt(sqr(_offset_x) + sqr(_offset_y));

var _adj_x = lengthdir_x(_length,image_angle);
var _adj_y = lengthdir_y(_length,image_angle);

// Normal direction
if (image_xscale > 0 && image_yscale > 0) {
emitterX = x + _adj_x;
emitterY = y + _adj_y;
emitterDirection =  _curr_attach_point[2];

// Flipped horizontally
} else if (image_xscale < 0 && image_yscale > 0) {
emitterX = x - _adj_x;
emitterY = y + _adj_y;
emitterDirection = 180 - _curr_attach_point[2];

// Flipped vertically
} else if (image_xscale > 0 && image_yscale < 0) {
emitterX = x + _adj_x;
emitterY = y - _adj_y;
emitterDirection = 180 - _curr_attach_point[2];

// Flipped horizontally and vertically
} else if (image_xscale < 0 && image_yscale < 0) {
emitterX = x - _adj_x;
emitterY = y - _adj_y;
emitterDirection = 180 + _curr_attach_point[2];
}

emitterDirection += image_angle;


I appreciate any help you can give! I'm really liking your tool! As well as your tutorials!

Will