Okay, GM: Studio's help file warns that ds_maps are changed in GM: Studio, and that some things are slow. However, it doesn't really do a good job as specifying what's slow and what's fast.
I assume that ds_map was changed for a reason, and that it would be rather absurd to make everything slower.
So - what's slower, and what's faster? In particular, is ds_map_find_value fast?
Thanks for any help.
- Game Maker Community
- → Viewing Profile: Topics: CobraA1
CobraA1
Member Since 09 Oct 2003Offline Last Active Jun 29 2012 03:31 PM
Community Stats
- Group New Member
- Active Posts 542
- Profile Views 1229
- Member Title Logic Fanatic
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Not Telling
-
Location
Tomahna
1
none
Topics I've Started
GM: Studio's implementation of ds_map
20 June 2012 - 05:12 AM
Odd error
15 June 2012 - 08:03 PM
I was working with a friend with some coding, when we stumbled across an error that doesn't happen while editing, but happens when trying to run the game.
This code:
Gives us this:

Uploaded with ImageShack.us
I don't think that we'll really be using file_text_eoln, but I do want to know what the issue is.
Ideas?
EDIT: GameMaker Studio v1.0.240
This code:
var txtfile;
var n;
txtfile = file_text_open_read("map1.txt"); /*file_text_open_read(fname) opens file fname for reading*/
index = 1;
do {
if (file_text_read_string(txtfile) != "") {
read[index] = file_text_read_string (txtfile);
show_message("does string read");
}
if (file_text_read_string (txtfile)==""){
read[index] = file_text_read_real (txtfile);
show_message("does real read");
}
/*file_text_read_real(opened_file) reads a real value from the line
that Game Maker is currently on in the text file from the opened_file text file*/
//The use of the array read[] is to capture all of the data
index += 1; //For the array...
/*file_text_readln(opened_file) goes to the next line in the opened_file text file*/
//file_text_readln(txtfile);
} until(file_text_eoln(txtfile)); /*file_text_eof(opened_file) returns whether we have reached the end of the text file*/
file_text_close(txtfile);
//} until(file_text_eof(txtfile)); /*file_text_eof(opened_file) returns whether we have reached the end of the text file*/
Gives us this:

Uploaded with ImageShack.us
I don't think that we'll really be using file_text_eoln, but I do want to know what the issue is.
Ideas?
EDIT: GameMaker Studio v1.0.240
Anything wrong with this code? (solved)
12 May 2012 - 05:29 PM
Okay, so I have two scripts with one purpose: To move a point around another point in a circle. Each of these scripts is meant to be executed once per step. One script returns the X coordinate, the other the Y coordinate for the next step.
How it works: It converts the coordinates to polar coordinates (accounting for the fact that I am rotating around another point, rather than an origin at 0,0), changes the angle, and converts back to rectangular coordinates (I have separate scripts for x and y return values, I don't think GameMaker is capable of multiple return values?).
Intended result: The first point is moved around the second point by "amount" in a circle.
What I get: It seems to be crazy with large numbers, with small numbers, the Y coordinate seems static at a weird position.
moveAroundPoint_x
moveAroundPoint_y
How it works: It converts the coordinates to polar coordinates (accounting for the fact that I am rotating around another point, rather than an origin at 0,0), changes the angle, and converts back to rectangular coordinates (I have separate scripts for x and y return values, I don't think GameMaker is capable of multiple return values?).
Intended result: The first point is moved around the second point by "amount" in a circle.
What I get: It seems to be crazy with large numbers, with small numbers, the Y coordinate seems static at a weird position.
moveAroundPoint_x
// Moves x, y, around x2, y2 by an amount var x1, y1, x2, y2, amount, angle, length; x1=argument0 x2=argument1 y1=argument2 y2=argument3 amount=argument4 // Find angle, length for polar coordinates angle = arctan2(y1-y2, x1-x2); length = sqrt(sqr(x2-x1) + sqr(y2-y1)); angle = angle + amount; // Rotate around point by amount return cos(angle)*length + x2; // Convert back to rectangular and return X coordinate
moveAroundPoint_y
// Moves x, y, around x2, y2 by an amount var x1, y1, x2, y2, amount, angle, length; x1=argument0 x2=argument1 y1=argument2 y2=argument3 amount=argument4 // Find angle, length for polar coordinates angle = arctan2(y1-y2, x1-x2); length = sqrt(((x1-x2)*(x1-x2)) + ((y1-y2)*(y1-y2))); angle = angle + amount; // Rotate around point by amount return sin(angle)*length + y2; // Convert back to rectangular and return Y coordinate
- Game Maker Community
- → Viewing Profile: Topics: CobraA1
- Privacy Policy
- GMC Rules and Forum Rules ·



Find content