Pages: [1]
  Print  
Author Topic: Addressed variable doesn't get refreshed  (Read 786 times)
Offline (Unknown gender) Woffelson
Posted on: September 25, 2018, 10:13:43 AM

Member
Location: Finland
Joined: Aug 2015
Posts: 9

View Profile
I tested one of my Game Maker projects which is in early development for now and I decided to look how it works on Enigma. There seemed to be only one major issue.

Deactivation/activation codes weren't working as they should. It seems that the activated region was locked to its beginning position. I'll explain how this affects my project and maybe why.

There's an object that handles the core mechanics of the game. In the beginning it creates two players and stores their ids into variables something like:
Code: [Select]
p1 = instance_create(0,0,obj);
Then in the step event objects are activated based on the whereabouts of players something like:
Code: [Select]
instance_deactivate_all(1);
instance_activate_region(p1.x-480,p1.y-128,960,960,1);

However, the region never moves out of its beginning position as it's supposed to, and when the player hits the edge of region, it gets deactivated. Maybe setting the variables in create event has something to do with this lockdown of id variables?

Oh, and other small thing: backgrounds doesn't seem to tile outside the room. (Quite annoying when trying to generate endless rooms.)
Logged
Offline (Male) Goombert
Reply #1 Posted on: October 01, 2018, 01:06:33 AM

Contributor
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3147

View Profile
Hi, Woffelson! Allow me to address some of the points of your post here. ENIGMA, being open source, understandably has some differences from GM. In recent months though, we've been taking a lot of steps to address this including the addition of continuous integration, engine cleanup, abstraction, and additional testing. There is much work to be done still but things have demonstrably been improving.

Quote
Deactivation/activation codes weren't working as they should.
I am not surprised, we have some open issues in regards to instance activation and deactivation.
https://github.com/enigma-dev/enigma-dev/issues/743
https://github.com/enigma-dev/enigma-dev/issues/851

Quote
It seems that the activated region was locked to its beginning position.
Your bug is interesting and sounds as if it could be related to the persistent rooms issue I linked above.

Quote
Maybe setting the variables in create event has something to do with this lockdown of id variables?
Using show_message(str) to verify all of your assumptions would be a great start if you really think that is the cause. It would also help with getting the bug fixed too, since finding the actual issue in a way that's reproducible is half the task of fixing it.

Quote
Oh, and other small thing: backgrounds doesn't seem to tile outside the room. (Quite annoying when trying to generate endless rooms.)
Ah, I was curious about this one myself while going through the graphics code sometime recently. Luckily, we are actually in a much better position to fix this now that all of our background drawing code has been generalized (meaning we have only 1 version of the functions used by all graphics systems; D3D no longer has its own function different from GL).

I actually already apparently have an issue open for this that we haven't closed yet:
https://github.com/enigma-dev/enigma-dev/issues/646

We draw the tiled backgrounds here:
https://github.com/enigma-dev/enigma-dev/blob/4e8ad7c3857794f490610c621ae64ae54b3456b0/ENIGMAsystem/SHELL/Graphics_Systems/General/GSscreen.cpp#L83

draw_background_tiled_ext is implemented here:
https://github.com/enigma-dev/enigma-dev/blob/4e8ad7c3857794f490610c621ae64ae54b3456b0/ENIGMAsystem/SHELL/Graphics_Systems/General/GSbackground.cpp#L217

If you want to experiment with the code in your local copy, changes to ENIGMA's source code take effect as soon as you save the source file and run the game again.
« Last Edit: October 01, 2018, 01:10:13 AM by Goombert » Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) Woffelson
Reply #2 Posted on: October 06, 2018, 01:36:22 PM

Member
Location: Finland
Joined: Aug 2015
Posts: 9

View Profile
Thanks for the response! It's still a bit unclear for me what are all the variables I should check. Nevertheless, at least I debugged the variable p1.y with draw_text. It seemed to work fine (gets refreshed every step) so there might be something fishy with the (de)activation functions indeed. However, when the player object got deactivated by reaching the end of region, p1.y went to back zero. I'm not sure should it behave like that or how GM deals with it. Hmm, I'll try to look this more closely if I can.

About background tiling, maybe I should've mentioned I've just ticked room editor's "tile horizontally/vertically" for that. Not sure does it matter.
Logged
Offline (Male) Goombert
Reply #3 Posted on: October 09, 2018, 10:01:40 PM

Contributor
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3147

View Profile
You're welcome and yeah, just like you did was what I was suggesting. Sorry I can't look into it deeper right now because I am trying to direct all my focus and attention at rapidly getting the new RGM IDE to beta with fundies help. With Java going the way that it is, we simply can't keep up with it fast enough for me to even attempt maintaining LGM and if it continues we'll soon be out of an IDE altogether, hence my attention to RGM. I promise when we get into a better position, I will be devoting more time back to fixing engine bugs for people again and as I linked we already have an issue filed for the backgrounds issue.

The background tiling I don't believe has anything to do with it, we are just bounding the draw background in our screen_redraw to the room area. That needs fixed and so do the other draw_background tiled functions but I need time to test all of those. Sorry, but I will get to it at some point. Feel free to try working around the issue for now or if somebody else wants, send the pull request to GitHub.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Pages: [1]
  Print