This is probably the wrong place to post this. but is there a GM specific page or group on this forum maybe? Or do you all just use GMC?
I'd like to "make friends" with other SA GM users, to help and learn, I'm really not going to change to Unity this year since I want to leverage what I know which is self taught GM...I didnt do a computer science degree.
So if you want to meet up or invite me to meet your GM group in person I'd really like that, in Cape Town area, please drop me an email at mornebooysen@gmail.com
So here's something I hope is an easy answer for... I want to zoom in and out as well as rotate the view around a centre point, so I looked up views.
view_angle is straight forward enough - it rotates the view around the centre of the view, awesome.
But I can't find a straight up way to zoom the view, it's view_wview and view_hview that changes the zoom level, but it's always "centred" around 0,0.
So if I want to zoom out and rotate around the centre point, I'd have to maths out where to put the 0,0 point for each angle and "zoom level" of the view?
I tried to use the view follow object thing - both in the view editor and as view_object, but the view_angle changes didn't hinge around the centre...
If it were just the zoom I could figure the maths out, but plus rotation... @_@
One of my students managed to do something like that a while back.
He assigned the scroll mouse in zoom in, but also changed the hbor and vbor for the views. I'm sure theres a smart way to do it that keeps your aspect ratio as well? Maybe look into multiplying/diving the screen with aspect ratio values?
Yeah the zooming isn't the hard part, it's the zooming while rotating that's got me stumped... I'd have to constantly work out a top left anchor according to the zoom size in relation to... omg I don't know @_@
So while working on zX I encountered a really weird problem "Audio file not found, using default ("Windows Ding") after a bit of searching I found a post on the GM forums that said GM would tell you which files were missing their sounds, ye that didn't work out to well.
So I went into the xml for the files and found that that that some had an absolute directory, and others a relative. Given that between retroFuture and myself working on the game some of the sounds had directories from each of our computers. So I wrote a script to strip out the absolute directory and make it relative, I then wrote another program to check which .gmx files were still missing audio so, and then modified my other programme to automate some of these. In the end I had about 5 I had to hand edit from a pool of about 70 sound files.
If you guys are curious I can upload my stuff to github so you guys can look at it/work with, though currently the implementations are specific to zX I could generatize it for people with similar problems.
In any case, related - what are you doing your sounds with, is it that ogg stuff that was previously posted? I'm thinking of going back into my GM Bearchuck files (My Unity one has scary bugs that I don't know what to do with at the moment) and fixing it up so at least the sound isn't totally *fooked* from that bear bear bear bear unknown audio bug...
We're using supersound.dll atm, but we need to move away from that and back into GM since you can't use .dlls for anything aside from windows builds (can probably use it for mac and ubuntu builds but I haven't confirmed this.)
@Gazza_N has shown me some of the audio stuff he's been doing (which was one of the newer things GM has done) and it works really nicely. So I'll be integrating that into zX.
With regards to BeatChuck is there any chance you can share the code that is playing audio? Would be curious to see if we can find the problem with it ;)
NOOOOOO, I was hoping that could solve the problem @_@
I'll pass you the whole source if you'd like, because I'm only using the bare basics GMS code and I swear I haven't been able to find the code that actually runs the sound 10000x over itself.
@Tuism will be glad to take a look at it :) looking at some GM code that isn't zX might help me refocus on getting some things done :) been trying to get into Unity ATM, but focusing on the 2D stuff when most of the resources are geared towards the 3D stuff has been rather interesting.
But I got around to writing up a blag about WTF I did with the audio issues I was having with GM and how I fixed them. Hope you guys find it interesting/useful.
Syntax in scripts. Just asking because I read it creates C++ from GML in any case. Or if we can write in a language besides GML, preferably one of the C's.
Syntax in scripts. Just asking because I read it creates C++ from GML in any case. Or if we can write in a language besides GML, preferably one of the C's.
There's a difference between C syntax and C the language. GML has multiple possible syntax declarations for symbols, so you can write code in GML that conforms to C syntax or Pascal syntax standards. You can't write C++ directly within GMS though because it will parse all of that code as being written in GML.
Yea, I mean C++ the language inside GMS. Not a big fan of GML. Just thought that seeing as yoyo compiler turns it into C++ you could therefore just code in C++ from the get go.
@iPixelPierre: What is it in particular about GML that you don't like? Is it an IDE-level feature like using GMS's code editor? Is it the dynamic typing and variable allocation? Is it the lack of SDL-like datastucture objects?
@iPixelPierre: GML's object notation is solid: object.variable works great - references are passed by value thanks identifier lookup table, but that's transparent so it doesn't matter...
Datastructures are handled with a similar identifier system. Want a linked list?
Yea, I mean C++ the language inside GMS. Not a big fan of GML. Just thought that seeing as yoyo compiler turns it into C++ you could therefore just code in C++ from the get go.
Correct me if I am wrong, but GameMaker uses it's own Just In Time compiler for its GML scripts, and I assume it compiles the script into bytecode that is injected into the game engine. The C++ comes in where you can create your own dll extensions for GameMaker which you can then use from your GML scripts.
Correct me if I am wrong, but GameMaker uses it's own Just In Time compiler for its GML scripts, and I assume it compiles the script into bytecode that is injected into the game engine. The C++ comes in where you can create your own dll extensions for GameMaker which you can then use from your GML scripts.
The YoYo Compiler (YYC) compiles through VS2012.
GM since since Studio has used C++ where it used Delphi/Pascal before that.
GM:S does have some neat new feature, but it is also a rather large departure from how things used to work in 8.1 it can be quite a jump to getting things, including your workflow, working smoothly in it. But once you get it down it becomes something really great to use.
A side note that if you have access to web-builds I recommend doing them frequently. Things that will run in normal GM compiler often don't get along with the web-builds: so it can save you quite a bit of a headache if you test them when you work ;)
Well you could probably just write a new .object.gmx and set your IDE to pull that from a template. The only real trouble with going that route is that you'll need to update the hash, and the object records in your master .gmx file.
Also GML object only have public variables, and you can't have member functions for objects.
What I don't like about GML is that you have to create "classes" using the UI as an object and can't do it in code. Unless I’ve been daft.
Example:
class Example
{
public Example (int a)
{
_a = a;
}
public int _a { get; private set; }
}
The design patterns I use to get around this are:
1. Setting up an object in it's create event with all the variables that object type is going to need - often that helps with inheritance as well.
2. Writing methods on objects as either scripts designed to target individual object types when I need to pass params for a method to work:
ScriptName(targetObject, param1, param2)
var targetObject, param1, param2; //create variables scoped only to this particular script
targetObject = argument0;
param1 = argument1;
param2 = argument2;
if (targetObject.object_type != SpecificType) return false; //or, y'know, do something to assert
with (targetObject1) //change scope of execution to be on the target object, not the script calling object
{
x += other.param1; //variables from the scope "outside" the with statement need to referenced using "other"
y -= other.param2;
... blah
}
return true;
3. Using object user events as polymorphic methods lets me do stuff where I can call a generalised event when, say, a projectile collides with an enemy. That means that to create a new bullet type, I only really have to use inheritance and change 1 event, yay :)
with (targetObject)
{
event_perform(ev_other, ev_user0);
}
Sure, these aren't the neatest things in the world, but they let you work smarter in GM ;)
I'm busy implementing a pause into Bear Chuck and erm, found an obsolete function that was popularly used to do pause: sprite_create_from_screen();
The use is to grab a screenshot of the screen so you can disable everything and put this in their place and pause the game... Is there a "modern" equivalent of this? How are you doing pause in GMS right now? (Google hasn't been helpful because it's saturated by the old answer...)
I googled screen_save, and found this - is this what you had in mind?
pause object
step
//paused hit?
paused = keyboard_check(ord("P"));
if(paused = false) exit;
//wait for pause key to release
while(keyboard_check(ord("P"))) io_handle();
//save, it's the safest way
screen_save("pause.bmp");
//load it back in to draw
spr = sprite_add("pause.bmp",<arguments to match your GM version>);
//while pause not hit again, you can use vk_any here
while(!keyboard_check(ord("P")))
{
//draw sprite, at 0,0...
draw_sprite(spr,0,0,0);
//...update screen, no view information is used here
screen_refresh();
//allow system to checks keyboard states
io_handle();
//give OS a break
sleep(100);
}
//cleanup
sprite_delete(spr);
Yes, for a pause screen, I mentioned that in my first post about it :) So... What other methods are there? I've been looking and hadn't been able to find them...
Yes, for a pause screen, I mentioned that in my first post about it :) So... What other methods are there? I've been looking and hadn't been able to find them...
Build every object in your game so that it checks for a pause state. If this state is set, no objects do anything. This is super time consuming and annoying to do...
Set your room speed to 0. In a pause controller object's step event, hijack GM normal execution cycle and keep drawing everything and force the screen to update. Keep checking for keyboard or mouse input that might end your pause loop. I have no idea if you can still do this in GMS. This does require that you have no gameplay logic in any draw events anywhere.
Yes, for a pause screen, I mentioned that in my first post about it :) So... What other methods are there? I've been looking and hadn't been able to find them...
Build every object in your game so that it checks for a pause state. If this state is set, no objects do anything. This is super time consuming and annoying to do...
Set your room speed to 0. In a pause controller object's step event, hijack GM normal execution cycle and keep drawing everything and force the screen to update. Keep checking for keyboard or mouse input that might end your pause loop. I have no idea if you can still do this in GMS. This does require that you have no gameplay logic in any draw events anywhere.
I was kinda afraid that's what someone is going to say. I mean I get the logic and I considered it, but for prototyping purposes I'm going to stick to the slow (saving that bitmap is slow damn) saving method...
Hi guys! Returning to GMS for true "rapid prototyping" :P
Have a question that google can't answer, and I hope there's an answer for it...
Edit: ok I might have misunderstood my game, it worked when I reduced the "edges" of my precise collision objects, so they don't "rub up" against each other and cause a collision, I think. So it wasn't a bounding box problem :)
How do I rotate an instance - like ACTUALLY rotate it, not with image_angle, as image_angle doesn't change the hitbox. I need the hitbox to rotate with, in fact, it's a precise collision hitbox too...
Suggestions like using Instance.direction then matching image_angle to it has been fruitless so far.
@Tuism: What's probably happening is that you're getting a collision when you're rotating the object (because, yes, image_angle totally does rotate the hitbox). Usually this isn't a problem, but if your objects are set to solid in GM, the engine won't let a solid object stay in a collision position, so it'll reset it back to what it was before you moved/rotated it. (This makes sense if you think about solid as a way to stop objects interpenetrating, not like a physics rigid body)
The best thing to do is to check if a rotation is going to cause a collision first with place_meeting() or another similar function, then rotating/moving it slightly less if there is a collision. Reducing your hitbox (which is what your precise collision reduction did) also tends to make this less of a problem because the outer corners of your object are rotating slower (in relation to the amount of pixels they cover) so you're less likely to get a corner interpenetrating and the solid defense getting triggered. (If you up your rotation speed you'll probably have the same problem again though)
When the proto is ready for viewing I'll show you, but I think it was edge-to-edge collision that was making me think that the hitbox wasn't rotating... And no I'm not using physics because it doesn't need physics :P I'll show you soon! Promise!
I'm creating a game mechanic in GM:S similar to a scratchcard where the player scratches at a surface revealing the reward underneath. How can I know when the player has uncovered the reward?
I'm using a surface and applying a subtraction blend mode to set the alpha layer to 0 revealing the sprite underneath. I tried iterating over the spritemask using draw_getpixel() but even for 64x64 pixels the game freezes unpleasantly.
What else can I do? Ideally, I'd like a percentage of the underneath sprite revealed.
I wouldn't check the pixels directly - too damned slow in GM. I'd build a boolean "reveal array" at a suitable resolution and clear/fill it with snapped mouse coordinates when the mouse button's down, and check it every couple of ticks.
Failing that, you could just time divide your pixel checks. Check the image progressively in segments over several ticks, instead of all of them at once. Shouldn't make much of a difference to your gameplay assuming you're running at 30 ticks per second or whatever works.
Please can someone look at my code and tell me what I'm doing wrong. This bug is driving me insane!
I have an object "scratchcard" that has an alarm and when it executes, if it passes a test it plays a sound should turn off. I use one instance (created by "selectionManager" in the "characterSelect" room) and it works properly.
However, I create 4 instances in the "combat" room (created by "combatManager") and when a scratchcard passes its test it continues with running the alarm. If I delete the other instances it works, but I can't figure out what's happening.
Please can someone have a look and offer some insight (see attached project)?
This is really weird. I created a new room and added 3 instances of "scratchcard" in the designer. I updated the alarm of "scratchcard" so that it'll only fire once and when it passes its test I use show_message to print the id of the instance. I then run the game and I get the message box 3 times all with the same id?
Edit: Even weirder, I remove all the code from the alarm and just execute show_message to print the instance id. I get each instance's id 3 times!?
OK, I think I found the problem, although I don't know how to fix it.
I deleted all the code in "scratchcard" except in the constructor setting the alarm and in the alarm showing the id. I was still getting each instance called as many times as there are instances in the room.
I clicked on the object's Show Information and found this:
Information about object: scratchcard
Sprite: spr_scratch
Solid: false
Visible: true
Depth: -1000
Persistent: false
Parent:
Mask:
Create Event:
execute code:
alarm[0] = 90;
Alarm Event for alarm 0:
for all scratchcard: execute code:
show_message(string(id));
Somehow I have "for all scratchcard" in the alarm event. it's not in my code (only the show_message) but this is probably what is causing it. Problem is, how do I remove it?
Edit: I deleted the event and re-added it and the "for all" is gone. WTF!!!
Somehow I have "for all scratchcard" in the alarm event. it's not in my code (only the show_message) but this is probably what is causing it. Problem is, how do I remove it?
Edit: I deleted the event and re-added it and the "for all" is gone. WTF!!!
If you're using drag and drop code elements, there's usually a radio button on each of them that tells GM where this particular command is executing. I presume it was set to the "all" option somehow (probably an alt-typo slip). This can apply to execute code events too, check for that radio button thing in the top right.
The last couple of weeks I've had the most maddening bug which would cause the camera to make these jerky movements as it followed the player.
Initially I just tried upping the speed at which the camera followed the player, but that didn't help at all. So I thought it had to have had to been with the movement code. And since I was working on a new input system the bug went on the back burner.
So I implemented GMInput in zX and tried just about anything to fix the jerky movement. Nothing worked. So exhausting movement as an option I started looking into the camera system again.
Eventually I found the problem could be solved by setting the camera borders to 0 and fixing the camera to be centered on the player in the pre_draw event. I honestly am not sure what exactly the issue was, but only that I seem to have solved it through some really weird method O_o
Now if you excuse me I need to fix my screenshake engine...
I am using Game Maker Studio and I am working on an isometric platformer side project. I have movement done, jumping done (single jump), jumping onto and off boxes (only one cube on the ground for now) and collision with the box object is done. Depth is also sorted. The reason I posted the above is if anyone needs help with this type of thing, I'd be glad to oblige.
There is something I need help with though and I have searched the internet yielding 0>results. How do I approach coding the collisions for isometric slopes/ramps?
Comments
Or do you all just use GMC?
I'd like to "make friends" with other SA GM users, to help and learn, I'm really not going to change to Unity this year since I want to leverage what I know which is self taught GM...I didnt do a computer science degree.
So if you want to meet up or invite me to meet your GM group in person I'd really like that, in Cape Town area, please drop me an email at mornebooysen@gmail.com
I want to zoom in and out as well as rotate the view around a centre point, so I looked up views.
view_angle is straight forward enough - it rotates the view around the centre of the view, awesome.
But I can't find a straight up way to zoom the view, it's view_wview and view_hview that changes the zoom level, but it's always "centred" around 0,0.
So if I want to zoom out and rotate around the centre point, I'd have to maths out where to put the 0,0 point for each angle and "zoom level" of the view?
I tried to use the view follow object thing - both in the view editor and as view_object, but the view_angle changes didn't hinge around the centre...
If it were just the zoom I could figure the maths out, but plus rotation... @_@
Halp? Thanks guys :)
He assigned the scroll mouse in zoom in, but also changed the hbor and vbor for the views. I'm sure theres a smart way to do it that keeps your aspect ratio as well? Maybe look into multiplying/diving the screen with aspect ratio values?
Tempted to just go to Unity XD
http://gmc.yoyogames.com/index.php?showtopic=466009
*casts rez*
So while working on zX I encountered a really weird problem "Audio file not found, using default ("Windows Ding") after a bit of searching I found a post on the GM forums that said GM would tell you which files were missing their sounds, ye that didn't work out to well.
So I went into the xml for the files and found that that that some had an absolute directory, and others a relative. Given that between retroFuture and myself working on the game some of the sounds had directories from each of our computers. So I wrote a script to strip out the absolute directory and make it relative, I then wrote another program to check which .gmx files were still missing audio so, and then modified my other programme to automate some of these. In the end I had about 5 I had to hand edit from a pool of about 70 sound files.
If you guys are curious I can upload my stuff to github so you guys can look at it/work with, though currently the implementations are specific to zX I could generatize it for people with similar problems.
In any case, related - what are you doing your sounds with, is it that ogg stuff that was previously posted? I'm thinking of going back into my GM Bearchuck files (My Unity one has scary bugs that I don't know what to do with at the moment) and fixing it up so at least the sound isn't totally *fooked* from that bear bear bear bear unknown audio bug...
@Gazza_N has shown me some of the audio stuff he's been doing (which was one of the newer things GM has done) and it works really nicely. So I'll be integrating that into zX.
With regards to BeatChuck is there any chance you can share the code that is playing audio? Would be curious to see if we can find the problem with it ;)
I'll pass you the whole source if you'd like, because I'm only using the bare basics GMS code and I swear I haven't been able to find the code that actually runs the sound 10000x over itself.
Thanks! Will share later when I can!
But I got around to writing up a blag about WTF I did with the audio issues I was having with GM and how I fixed them. Hope you guys find it interesting/useful.
I'm also unsure if you are asking if you can use C++ syntax in your scripts, or if you can use C++ things like STL inside GM.
Or if we can write in a language besides GML, preferably one of the C's.
Just thought that seeing as yoyo compiler turns it into C++ you could therefore just code in C++ from the get go.
Datastructures are handled with a similar identifier system. Want a linked list?
There are maps and queues and blah.
GM since since Studio has used C++ where it used Delphi/Pascal before that.
A side note that if you have access to web-builds I recommend doing them frequently. Things that will run in normal GM compiler often don't get along with the web-builds: so it can save you quite a bit of a headache if you test them when you work ;)
Example:
Also GML object only have public variables, and you can't have member functions for objects.
I think when I can afford it I'll get Unity pro.
1. Setting up an object in it's create event with all the variables that object type is going to need - often that helps with inheritance as well.
2. Writing methods on objects as either scripts designed to target individual object types when I need to pass params for a method to work:
3. Using object user events as polymorphic methods lets me do stuff where I can call a generalised event when, say, a projectile collides with an enemy. That means that to create a new bullet type, I only really have to use inheritance and change 1 event, yay :)
Sure, these aren't the neatest things in the world, but they let you work smarter in GM ;)
I'm busy implementing a pause into Bear Chuck and erm, found an obsolete function that was popularly used to do pause:
sprite_create_from_screen();
The use is to grab a screenshot of the screen so you can disable everything and put this in their place and pause the game... Is there a "modern" equivalent of this? How are you doing pause in GMS right now? (Google hasn't been helpful because it's saturated by the old answer...)
Thanks guys :)
_spr = sprite_add( "bg.png", 0, false, false, 0, 0);
return _spr;
Quick little hack script. Not really the best method for doing this. Will post a better one later, but this will work for now ;)
I googled screen_save, and found this - is this what you had in mind?
Like I said it's not the best method of doing it (there are quite a few limitations and considerations with using screen_save methods)
I'm also going on a limb and assuming you are using this for a pause screen?
Set your room speed to 0. In a pause controller object's step event, hijack GM normal execution cycle and keep drawing everything and force the screen to update. Keep checking for keyboard or mouse input that might end your pause loop. I have no idea if you can still do this in GMS. This does require that you have no gameplay logic in any draw events anywhere.
Thanks guys :)
Have a question that google can't answer, and I hope there's an answer for it...
Edit: ok I might have misunderstood my game, it worked when I reduced the "edges" of my precise collision objects, so they don't "rub up" against each other and cause a collision, I think. So it wasn't a bounding box problem :)
How do I rotate an instance - like ACTUALLY rotate it, not with image_angle, as image_angle doesn't change the hitbox. I need the hitbox to rotate with, in fact, it's a precise collision hitbox too...
Suggestions like using Instance.direction then matching image_angle to it has been fruitless so far.
Soooo... Halp? Thanks guys :)
The best thing to do is to check if a rotation is going to cause a collision first with place_meeting() or another similar function, then rotating/moving it slightly less if there is a collision. Reducing your hitbox (which is what your precise collision reduction did) also tends to make this less of a problem because the outer corners of your object are rotating slower (in relation to the amount of pixels they cover) so you're less likely to get a corner interpenetrating and the solid defense getting triggered. (If you up your rotation speed you'll probably have the same problem again though)
So... Why aren't you using physics for this? ;)
I'm using a surface and applying a subtraction blend mode to set the alpha layer to 0 revealing the sprite underneath. I tried iterating over the spritemask using draw_getpixel() but even for 64x64 pixels the game freezes unpleasantly.
What else can I do? Ideally, I'd like a percentage of the underneath sprite revealed.
Failing that, you could just time divide your pixel checks. Check the image progressively in segments over several ticks, instead of all of them at once. Shouldn't make much of a difference to your gameplay assuming you're running at 30 ticks per second or whatever works.
I have an object "scratchcard" that has an alarm and when it executes, if it passes a test it plays a sound should turn off. I use one instance (created by "selectionManager" in the "characterSelect" room) and it works properly.
However, I create 4 instances in the "combat" room (created by "combatManager") and when a scratchcard passes its test it continues with running the alarm. If I delete the other instances it works, but I can't figure out what's happening.
Please can someone have a look and offer some insight (see attached project)?
Edit: Even weirder, I remove all the code from the alarm and just execute show_message to print the instance id. I get each instance's id 3 times!?
I deleted all the code in "scratchcard" except in the constructor setting the alarm and in the alarm showing the id. I was still getting each instance called as many times as there are instances in the room.
I clicked on the object's Show Information and found this:
Somehow I have "for all scratchcard" in the alarm event. it's not in my code (only the show_message) but this is probably what is causing it. Problem is, how do I remove it?
Edit: I deleted the event and re-added it and the "for all" is gone. WTF!!!
Initially I just tried upping the speed at which the camera followed the player, but that didn't help at all. So I thought it had to have had to been with the movement code. And since I was working on a new input system the bug went on the back burner.
So I implemented GMInput in zX and tried just about anything to fix the jerky movement. Nothing worked. So exhausting movement as an option I started looking into the camera system again.
Eventually I found the problem could be solved by setting the camera borders to 0 and fixing the camera to be centered on the player in the pre_draw event. I honestly am not sure what exactly the issue was, but only that I seem to have solved it through some really weird method O_o
Now if you excuse me I need to fix my screenshake engine...
The reason I posted the above is if anyone needs help with this type of thing, I'd be glad to oblige.
There is something I need help with though and I have searched the internet yielding 0>results.
How do I approach coding the collisions for isometric slopes/ramps?
Any help will be appreciated.
Can't really help you with a solution - as slopes alone make me want to sob.
Although after a quick search through the Gamemaker site yields quite a few threads about Isometric slopes :).
Hope that helps at least find some help :P.