PDA

View Full Version : Game Maker Help Thread (Post your Qs here!)



Pages : 1 [2] 3 4 5

|-|1Pp13
19-11-2007, 11:25 AM
i have this code right?



ini_open("options.ini")

var_sound=ini_read_real("options","sound",2)

string_sound=""

switch (var_sound)
{
case 0: string_sound="Off" ;break;
case 1: string_sound="Low" ;break;
case 2: string_sound="On"; break;
}

with (button_sound) var_sound2= string_sound

ini_close()

And i get the error:

...
at position 34: Unknown variable string_sound

abort/ignore

when i click ignore it still runs although it does not display anything

Help please?

|-|1Pp13
19-11-2007, 12:37 PM
just need to check something-

can an object have multiple parents?

if yes please tell me how?

ShadowMaster
19-11-2007, 12:55 PM
just need to check something-

can an object have multiple parents?

if yes please tell me how?

I can't seem to find a guide about it, but what are you trying to do? There might be an easier way. Multiple Inheritance is very rarely useful, especially in a weakly-typed langauge.

|-|1Pp13
19-11-2007, 01:07 PM
i have a parent for collision in general(eg the player colliding with objects) and a parent for grenade interaction

now i want something that has the properties from both-eg my walls- the player walks into them and they get damage from ALL types grenades (will have 3 in the end)

dislekcia
19-11-2007, 02:07 PM
i have this code right?



And i get the error:


when i click ignore it still runs although it does not display anything

Help please?

A with statement changes the scope of the code inside it so that it's running on the object(s) specified in the with clause. Those objects don't have string_sound variables declared on them, so to get to the string_sound variable you're looking for, you need to use the keyword other to get "out" of the with clause: other.string_sound


just need to check something-

can an object have multiple parents?

if yes please tell me how?

No, you can only have one parent object specified, but that parent object can have a parent, which will then carry down the tree.

-D

|-|1Pp13
19-11-2007, 02:13 PM
A with statement changes the scope of the code inside it so that it's running on the object(s) specified in the with clause. Those objects don't have string_sound variables declared on them, so to get to the string_sound variable you're looking for, you need to use the keyword other to get "out" of the with clause: other.string_sound



No, you can only have one parent object specified, but that parent object can have a parent, which will then carry down the tree.

-D

Thanx. i actually fixed my error :D:

...
button_sound.var_sound2=...
...

Also thank you for the parent thing :p

01DT!m3r
01-12-2007, 08:19 PM
i have a question to do with the forum . wat does it mean if there is a road sign next to the little green dot that shows when a person is logged in.

|-|1Pp13
01-12-2007, 08:44 PM
its a little report person link :)

|-|1Pp13
06-12-2007, 02:57 PM
does GM have a "try" function like in delphi?

i cant find it in the help so i suppose there isn't?

dislekcia
06-12-2007, 03:44 PM
There's no explicit try-catch statement in GM, but you can test to see if an error has occurred or not using error_occurred and error_last. It takes a bit of thinking to implement them correctly (as well as turning off "Display error messages" in the game options) but you can do it.

There are also a whole bunch of functions to check if something exists or doesn't, you'll find them on the same page in the help as error_occurred.

-D

|-|1Pp13
06-12-2007, 03:49 PM
Thanking you

exactly what i needed :)

Banlam
17-12-2007, 04:04 PM
Hey guys quick Q. When I open a program I've made in GM, it always opens it in the middle of the screen, it's not a full screen program.

I actually want it to open at the bottom of the screen. I'm using GM 7, and I can't find a setting to change this anywhere. Any help appreciated.

Thanks

Tr00jg
17-12-2007, 05:21 PM
Hey guys quick Q. When I open a program I've made in GM, it always opens it in the middle of the screen, it's not a full screen program.

I actually want it to open at the bottom of the screen. I'm using GM 7, and I can't find a setting to change this anywhere. Any help appreciated.

Thanks

Afaik there isn't a way to change that... I might be wrong though. Why do you want it there anyway? Application?

CiNiMoDZA
17-12-2007, 06:06 PM
Please can someone help! So with my little game, Frozone, I need to do the grid system now. How this works is this, On a set grid block the following needs to happen. The attack of all the units who are in that blocks range are added up, then they are subtracted from the enemies defense, giving you a number. The same is then done for the enemy, and the higher number wins the square, this being shown by its colour. How do I make it change the variable of the square if it already exists. I can do it if Im creating it, but once it exists how do I change the variable of just that one square??? Please help :P

Link: http://www.gamedev.za.net/filecloset/data/files/298/Frozone.gm6

Banlam
18-12-2007, 09:13 AM
Why do you want it there anyway? Application?

Long story, but basically it's a window that opens up with a few buttons that are "pressed" as soon as you move your mouse into the button. Thing is the way you open your program, the cursor is left in the same place as where one of the buttons are, so as soon as the program opens, buttons are pushed. This is not what I am wanting.

Tr00jg
18-12-2007, 11:35 AM
Hmm... I'm sure there is an easier way to deal with that.

Why not make an "init" variable. ie, the button only activates if "init" is true. On the first occasion (as you go in), it doesn't activate, but sets "init" true. So the next time you press it, it does activate. If it so happens that your buttons does not get "init" pressed add an alarm in the creation event of the buttons that sets init true after a second or so.

Won't that help?

Chippit
18-12-2007, 11:55 AM
I think a simpler solution would just be to programmatically move the mouse cursor when the program starts so that it's away from the buttons. I'm fairly certain GM will have a function for that.

Tr00jg
18-12-2007, 01:01 PM
I think a simpler solution would just be to programmatically move the mouse cursor when the program starts so that it's away from the buttons. I'm fairly certain GM will have a function for that.

Nope, I tried finding something like that and it doesn't have anything like it...

Gazza_N
18-12-2007, 03:10 PM
Nope, I tried finding something like that and it doesn't have anything like it...

'Course it does. The FPS version of Deathbringer wouldn't exist without it.

window_mouse_set(x,y) positions your mouse cursor wherever you need it to go. Quick and simple. ;)

Gazza_N
18-12-2007, 03:15 PM
Please can someone help! So with my little game, Frozone, I need to do the grid system now. How this works is this, On a set grid block the following needs to happen. The attack of all the units who are in that blocks range are added up, then they are subtracted from the enemies defense, giving you a number. The same is then done for the enemy, and the higher number wins the square, this being shown by its colour. How do I make it change the variable of the square if it already exists. I can do it if Im creating it, but once it exists how do I change the variable of just that one square??? Please help :P


I'd use the collision_point(nutsandbolts) function to search for an instance of the grid tile object at the position of the battle. The function will return an ID handle for the object it finds, so assign it to a variable, i.e. ActiveTile=collision_point(stuff). Then just alter the variables using your ActiveTile handle. Unfortunately I haven't had a chance to pore through your code yet, so I don't know if that'll suit your purposes, but it seems to be a solution to what you've described. If not, you can kick me. Hard. :P

Tr00jg
18-12-2007, 03:17 PM
'Course it does. The FPS version of Deathbringer wouldn't exist without it.

window_mouse_set(x,y) positions your mouse cursor wherever you need it to go. Quick and simple. ;)

Aaah... I looked under "mouse" functions.

Banlam
18-12-2007, 07:31 PM
'Course it does. The FPS version of Deathbringer wouldn't exist without it.

window_mouse_set(x,y) positions your mouse cursor wherever you need it to go. Quick and simple. ;)

Ah, cool. Thanks Gazza, that should work perfectly.
Troojg, i also looked for a method like that in the Mouse Help section, but it said that the variables mouse_x and mouse_y could not be changed.

|-|1Pp13
21-12-2007, 08:04 PM
Long story, but basically it's a window that opens up with a few buttons that are "pressed" as soon as you move your mouse into the button. Thing is the way you open your program, the cursor is left in the same place as where one of the buttons are, so as soon as the program opens, buttons are pushed. This is not what I am wanting.

i did a simalar thing with my menu system, except when the user moves the mouse over the button a small tab underneath it pops up asking ok, and you move your mouse over this to continue. it cuts down on accidents dramatically.

also check out dontclick.it (http://dontclick.it/) (inspiration for no-click interface)

The function the other people mentioned (window_set_cursor(x,y) i think it was) works pretty well except dont move it to 0,0. it just doesn't feel right :p

Banlam
22-12-2007, 09:12 AM
i did a simalar thing with my menu system, except when the user moves the mouse over the button a small tab underneath it pops up asking ok, and you move your mouse over this to continue. it cuts down on accidents dramatically.

also check out dontclick.it (http://dontclick.it/) (inspiration for no-click interface)

The function the other people mentioned (window_set_cursor(x,y) i think it was) works pretty well except dont move it to 0,0. it just doesn't feel right :p

Cool, unfortunately the user this is designed for, it is easier for her to just have one button to move over. Fortunately if she clicks the wrong button it's not the end of the world.

That link looks interesting, will definitely check it out a bit more.

Ja the set cursor method works well, and i set it to the centre (horizontally) and about 100 pixels above the window.

Thanks for the help guys.

|-|1Pp13
23-12-2007, 09:06 PM
im trying a new interface which works by a short timer to activate the timer, works very well and no accidents :D (yet)

And does GM have a function for anything to do with Ping?
EG: get a ping from a session?

i want my game to only display sessions with a certain ping limit


EDIT:
and also can you search for a session by name?
Would getting the names of all of the sessions and storing them in a data structure and then searching that take too long? i got a feeling it might

|-|1Pp13
23-12-2007, 09:27 PM
My GM is acting weird (again)

now when i have "Let <Esc> end the game" unchecked it doesn't want to close when you click on the X :(
but when its on, it closes fine, no problems (using the X or Esc)

Any ideas why this is?


This is the reason:
http://i220.photobucket.com/albums/dd224/HiPp13/reaction.jpg
i dont want to mess up the interface with a "back" button, id rather use Esc to go back

dislekcia
24-12-2007, 01:04 AM
My GM is acting weird (again)

now when i have "Let <Esc> end the game" unchecked it doesn't want to close when you click on the X :(
but when its on, it closes fine, no problems (using the X or Esc)

Any ideas why this is?


This is the reason:
http://i220.photobucket.com/albums/dd224/HiPp13/reaction.jpg
i dont want to mess up the interface with a "back" button, id rather use Esc to go back

It's not possible to mess up an interface with a useful button. Honest.

As for the X thing not working, I have no idea why that would happen. Test it again after a restart.

-D

|-|1Pp13
24-12-2007, 09:47 AM
It's not possible to mess up an interface with a useful button. Honest.

As for the X thing not working, I have no idea why that would happen. Test it again after a restart.

-D

x thingy still not working :( ohwell back button it shall be

Gazza_N
24-12-2007, 11:08 AM
Why not disable the standard Windows border (there's a check box in your global game settings) and put your own X button in the corner? It shouldn't be too intrusive, and you keep your interface the way you want it.

I have a funny feeling that the esc key calls the same function as the X button, and that the check box disables ALL calls to whatever window close function GM uses. Just a thought. :)

|-|1Pp13
24-12-2007, 11:19 AM
Why not disable the standard Windows border (there's a check box in your global game settings) and put your own X button in the corner? It shouldn't be too intrusive, and you keep your interface the way you want it.

I have a funny feeling that the esc key calls the same function as the X button, and that the check box disables ALL calls to whatever window close function GM uses. Just a thought. :)

good idea! thanx

EDIT: it looks fine

|-|1Pp13
24-12-2007, 02:31 PM
sorry bout all the questions (this is what happens when i start trying new/old stuff) but heres another one:

my game wasn't joining a session correctly so at first i thought it was just some faulty code, so i went over it top to bottem and couldn't find out what was wrong

The next step i took was to make sure it wasn't just the game, maybe something wrong in GM

So i whipped up a little program that just alows me to test joining etc:
Theres 3 blocks in the first room- One creates, one joins, one makes a connection
after clicking create/join it takes you to the next room where it gives you server info (connection, no of players and whether you created/joined)

The first game makes a connection and creates fine
The second makes a connection but doesn't join the session =/
(EDIT: on the info it reads there is a connection, but it didn't join or create and there are NO players)

CODE:
Create:

mplay_session_create("TEST server",0,"player1")
room_goto_next()
Join:

mplay_session_find()
mplay_session_join(0,"player2")
room_goto_next()
Connection

mplay_init_tcpip("")



am i doing something wrong?
EDIT: finally found the pong example i downloaded ages ago, it doesn't work either :(

dislekcia
24-12-2007, 06:28 PM
The order that you need to use the networking commands in is:

Hosting: mplay_init_tcpip, mplay_session_create
Joining: mplay_init_tcpip, mplay_session_find, mplay_session_join

Try suppling the machine's IP address to the tcpip init command. I remember having problems with Monochrome on the same machine when I was testing initially. Supplying "" certainly isn't helping you, as I'd either leave the brackets empty or provide a physical IP, at the moment it's probably assuming that the "" is a DNS-able entry.

-D

|-|1Pp13
24-12-2007, 07:07 PM
The order that you need to use the networking commands in is:

Hosting: mplay_init_tcpip, mplay_session_create
Joining: mplay_init_tcpip, mplay_session_find, mplay_session_join

Ya i know that, thats not the problem though

-D





Try suppling the machine's IP address to the tcpip init command.
-D
uhm...explain please?



I remember having problems with Monochrome on the same machine when I was testing initially. Supplying "" certainly isn't helping you, as I'd either leave the brackets empty or provide a physical IP, at the moment it's probably assuming that the "" is a DNS-able entry.
-D

No there has to be a string as an IP and blank creates a LAN connection, ive networked before no probem on the same pc when testing this stuff, its only today when i tried it went pear shaped

dislekcia
25-12-2007, 01:54 AM
uhm...explain please?

Grab your machine's IP address using mplay_ipaddress() and supply that to the tcpip init command.


No there has to be a string as an IP and blank creates a LAN connection, ive networked before no probem on the same pc when testing this stuff, its only today when i tried it went pear shaped

There's no such thing as a "LAN" connection in GM. If you don't supply an IP address it simply uses DirectConnect's listen server capability and assumes that you're going to be connecting to the same subnet.

My point was either supply a valid IP address or don't supply anything at all (literally nothing in the brackets). Giving it something else is simply going to make DirectConnect think that you're passing it a domain name and it'll do a DNS lookup.

Also, just in case, make sure your network cable is plugged in. I had issues the first time I didn't supply a valid IP address and left my network cable out. Turned out that windows wasn't enabling loopback functionality until it had a non-home IP assigned to it. Loony, but it happened.

-D

|-|1Pp13
25-12-2007, 10:35 AM
absolutly blank brackets <()> gives an error

dislekcia
25-12-2007, 01:54 PM
absolutly blank brackets <()> gives an error

Well then, provide an IP ;)

Must have changed in GM7 and the helpfile still needs to catch up.

-D

|-|1Pp13
25-12-2007, 06:21 PM
Fixed it! thanx!

now about the ping...does GM have any functions for that?

dislekcia
26-12-2007, 02:25 AM
Fixed it! thanx!

now about the ping...does GM have any functions for that?

Nope. No built-in functions for ping, but it's not like it's hard to calculate: Simply send a message flagged with a specific timestamp from one machine to the other, when the other machine gets that type of message it simply bounces it back to the original sender, when the new message arrives you simply subtract the timestamp in the message from the current time and poof, you've got your ping.

You can use current_time to get a time value, although I suggest using a more accurate timer if you're serious about network stability. I used a timing DLL I found on the GM forums.

-D

|-|1Pp13
28-12-2007, 09:33 PM
i just want to check if this code will work?


ip=get_string("Enter the IP of the computer you wish to connect to:#Yours is:" + mplay_ipaddress() + "#(Make blank for LAN connection)",mplay_ipaddress())


mplay_init_tcpip(ip)
if error_occurred=true then
begin
show_error("Failed to make a connection",false)
exit
end


ini_open("settings.ini")
server_name=ini_read_string("personal","server_name","Server")
player_name=ini_read_string("personal","player_name","Player")
ini_close()

mplay_session_create(server_name,2,player_name)

if error_occurred=false then
begin
show_message("Server created with following settings:#
Server name: "+server_name+"#
Player name: "+player_name)
room_goto(room_waiting_for_players)
end
else
begin
show_error("Failed to create a server",false)
exit
end

CiNiMoDZA
31-12-2007, 04:26 PM
Please can someone help!! I cant understand why this wont work!!!

http://gamedev.openhazel.co.za/filecloset/data/files/305/Broken_World.gmk (23k)

Game Maker 7 unregistered

dislekcia
01-01-2008, 03:01 PM
I don't have GM here at the moment... If you post the error you're getting, what you're trying to do and what you'd like to happen, we can probably help without having to download and run the file ;)

-D

CiNiMoDZA
02-01-2008, 01:21 PM
Ok, Im making a little RPG, each of the classes is stored like this:

class[0,0] = "name" //class name
class[0,1] = 50 //strength
etc..
with the first number changing for the different class! Now I want the class to be random, so in the main characters create event I have:

c = choose(0, 1, 2, 3, 4)
name = class_obj.class[c,0]

But it says that the array is oput of bounds???

01DT!m3r
03-01-2008, 03:41 PM
I am looking to try programming mobile games in java .does anyone know of any free dev kits I can download?

|-|1Pp13
03-01-2008, 03:48 PM
I am looking to try programming mobile games in java .does anyone know of any free dev kits I can download?

google (http://www.google.co.za) it, theres tons

Cyberninja
04-01-2008, 01:08 PM
Hi guys. I've started working Marble Mania again. I have a question.

How do I get the game to display different types of messages*, when multiple marbles are hit within a specific time? Basically combo hits.

For instance, hitting Marble A then hitting Marble B shortly after, would display a "COMBO" message. How do I do this?

*I've created the custom message graphics already.

"COMBO" (2 hits)
"TRIPLE" (3 hits)
"MEGA" (4 hits)
"ULTRA" (5 or more hits)

Gazza_N
04-01-2008, 01:18 PM
Hmmmmm...

You could create a persistent, invisible object (or use an existing one if you have it) with a "hitcount" variable. Give the object a timer that clears the hitcount variable. If you hit the correct marble, it increments the hitcount variable by one and activates the timer. Then, using the variable, display the message you want. Obviously, if the player hits no marbles within your timeout period the variable will be cleared, and no bonus message will be shown.

I hope that makes sense...

Cyberninja
04-01-2008, 02:47 PM
Thanks Gazza. I'll will give that a try. :)

|-|1Pp13
04-01-2008, 03:01 PM
Gazza hit the nail on the head, remember to set your timers to seconds though, some kind of display could also work to show how long before they lose the combo

Squid
05-01-2008, 09:55 AM
I am looking to try programming mobile games in java .does anyone know of any free dev kits I can download?

What you want is the WTK (http://java.sun.com/products/sjwtoolkit/download.html).

Any IDE can compile for it and it has built in emulators and samples. It does have special NetBeans connectivity if you don't know what IDE will be best for it.

Squid
05-01-2008, 10:07 AM
google (http://www.google.co.za) it, theres tons

Eh? No, not really.

|-|1Pp13
05-01-2008, 02:14 PM
i found plenty a while back =/

luenardi
05-01-2008, 11:35 PM
i working on a 3d game in gamemaker..
it's got shaders
it a fps rpg similar to a fine blend of doom and sytem shock2
about 20% done
when i get a chance i will open a thread and post some screenies :)

|-|1Pp13
09-01-2008, 05:07 PM
with



script_execute(ind,arg0,arg1,...)

do you have to list all arguments?

and if so do you list 5 or 10?

dislekcia
09-01-2008, 05:11 PM
No, you don't have to list millions of arguments, just the ones your script uses.

So if you have a script called EffectiveScript that uses argument0 and argument1, the execute_script call would look like this:

execute_script(EffectiveScript, value, value);

However! I've never, ever used that command because you can run a script just by typing the script name:

EffectiveScript(value, value);

Works perfectly :)

-D

|-|1Pp13
09-01-2008, 05:19 PM
No, you don't have to list millions of arguments, just the ones your script uses.

However! I've never, ever used that command because you can run a script just by typing the script name:

EffectiveScript(value, value);

Works perfectly :)

-D

thanx!

CiNiMoDZA
14-01-2008, 04:24 PM
Does anyone know if there is a way to print documents in game maker???

dislekcia
14-01-2008, 09:04 PM
Does anyone know if there is a way to print documents in game maker???

I don't think you can from within the program itself... But you should be able to find a DLL designed to control printers on the GMC (http://forums.yoyogames.com/) somewhere.

-D

|-|1Pp13
15-01-2008, 05:28 PM
I don't think you can from within the program itself... But you should be able to find a DLL designed to control printers on the GMC (http://forums.yoyogames.com/) somewhere.

-D

in GM7 theres an extension package that comes with it for printing?

SplaT
17-01-2008, 03:46 PM
Sorry, I'm jumping on the forum out of nowhere. :P

Can anyone help me? I'm having trouble with animated sprites.
How can I make the animation play once and stop on the last frame?
So basically, I don't want it to loop.
I tried nearly everything. (within my very limited skill that is)
:(

dislekcia
17-01-2008, 03:57 PM
Sorry, I'm jumping on the forum out of nowhere. :P

Feel free! That's what this place is for :)


Can anyone help me? I'm having trouble with animated sprites.
How can I make the animation play once and stop on the last frame?
So basically, I don't want it to loop.
I tried nearly everything. (within my very limited skill that is)
:(

In GM there's a variable on objects called image_speed that controls how many frames an animation progresses every frame. A value of 0 means the animation doesn't change at all (paused/stopped), 1 means it goes at 1 frame per frame, with values less than 1 being "slow motion" and faster than 1 being "fast forward" (although you don't see intervening frames that get skipped over like that).

The variable image_single tells GM which sub-image of a sprite to show, it's the current frame, if you think of it like that. Every frame GM adds image_speed to image_single to find the new current frame.

There's also a wonderfully handy event in the Other events section: Other->Animation End.

So, to stop an animation playing when it ends instead of looping around: All you need to do is add an Animation End event to your object that has the animated sprite and set image_speed to 0 in there. It might also be a good idea to set image_single to the final frame of the animation, just in case, which you can get from the image_number variable.

Hope that helps :)

-D

Squid
17-01-2008, 04:02 PM
Probably the easiest way to do it is to simply change the sprite in the end of animation event. Look under "other events".

EDIT: Damn your ninja quick posting D...

SplaT
17-01-2008, 04:31 PM
Wow, thank you for replying so fast.
:D

Okay, the animation that I don't want to loop is my character's jump animation. When I tried the Animation End event before, it screws up the running animation.
So I tried adding something like:
if sprite_index == spr_Jumping
image_speed = 0;

But with that, not a single animation even starts to play. So that was obviously not the way to do that.

I also tried a boolean jumping var to check if the character was currently jumping, and then replace it with another single-frame sprite, until the character gets back to the ground. Also to no avail.

dislekcia
17-01-2008, 04:44 PM
Wow, thank you for replying so fast.
:D

Okay, the animation that I don't want to loop is my character's jump animation. When I tried the Animation End event before, it screws up the running animation.
So I tried adding something like:
if sprite_index == spr_Jumping
image_speed = 0;

But with that, not a single animation even starts to play. So that was obviously not the way to do that.

I also tried a boolean jumping var to check if the character was currently jumping, and then replace it with another single-frame sprite, until the character gets back to the ground. Also to no avail.

Are you resetting the image_speed back to 1 when you want the other animations to play?

-D

SplaT
17-01-2008, 05:16 PM
Are you resetting the image_speed back to 1 when you want the other animations to play?

-D

I am now. The animations are.... working.
:P
I found the problem in this code at the last second (before posting again)

if sprite_index == spr_charJump
{
image_single = 6;
image_speed = 0;
}

I remembered that the animation has only 6 sub-images.
So I changed it and now it's working.

Thanks a million for helping!
:D

Another thing if I may:

EDIT: Nvm, fixed.

dislekcia
17-01-2008, 07:11 PM
Thanks a million for helping!
:D

No problemo :) So when are you uploading what you're working on so that we can all play it?

-D

SplaT
17-01-2008, 11:45 PM
No problemo :) So when are you uploading what you're working on so that we can all play it?

-D

Hahaha, well. Seeing that I just got the walking/jump sorted out, it'll be quite a while.
xD

|-|1Pp13
18-01-2008, 09:37 PM
Im thinking of doing a simple Hex (http://en.wikipedia.org/wiki/Hex_game) remake and i was wondering how would you make sure hexegonal (spelling?) tiles would align with a grid?

ShadowMaster
18-01-2008, 09:55 PM
Im thinking of doing a simple Hex (http://en.wikipedia.org/wiki/Hex_game) remake and i was wondering how would you make sure hexegonal (spelling?) tiles would align with a grid?

You know the height difference between rows stays constant, so you just use a constant.

To get the correct alignment on the x-axis though you have to offset(ie move it) every second row a certain amount.

To do that you can just take the row number modulus 2 and depending if is one or zero offset it a certain amount. For instance if the row number leaves 1 modulo 2 you offset it by the amount otherwise not.

By far the hardest part in this process is to get the images to lock together correctly, so try to get it to do, by using copy and paste to get a grid going, that before trying to work out the constants.

dislekcia
20-01-2008, 02:11 PM
ShadowMaster is right, the easiest way to work out a hex grid (or even an isometric one) is to simply shunt odd rows over a certain amount when you create them.

The mathematics of the hex configuration (assuming that you've got your hexes set up with two sides vertical instead of horizontal) is to move each row down by half the height of the hex sprite and shunt odd rows over by half the width of the hex sprite. If you do that, they'll tesselate perfectly.



for (j = 0; j < numRows; j += 1 ) {
for (i = 0; i < numColumns; i += 1) {
instance_create(i * width + ((j mod 2) * width * 0.5), j * height * 0.5, Hex);
}
}


-D

|-|1Pp13
20-01-2008, 07:45 PM
ShadowMaster is right, the easiest way to work out a hex grid (or even an isometric one) is to simply shunt odd rows over a certain amount when you create them.

The mathematics of the hex configuration (assuming that you've got your hexes set up with two sides vertical instead of horizontal) is to move each row down by half the height of the hex sprite and shunt odd rows over by half the width of the hex sprite. If you do that, they'll tesselate perfectly.

-D

thanks guys got the grid going but how would you make a hex align with this grid?

ShadowMaster
20-01-2008, 08:14 PM
thanks guys got the grid going but how would you make a hex align with this grid?

Please explain more. Because I can't see how can you have a grid and not be able to align hexes to it.

That is, tell me what exactly this grid is, that you are talking about.

SplaT
26-01-2008, 12:40 PM
Could someone please help me out here again? :)
I have this little problem that makes me want to kick puppies.

In the same "game" as before, I'm trying to make my character run and look at the mouse pointer at the same time.

At the moment I had to separate the head sprite, the body sprite and the arms sprite (So that the arms can aim a gun at the pointer too), so now I'm struggling to draw it on top of each of each other.
It kinda works, but now it's getting harder and harder to make it look good. (The separate sprites are breaking apart when some animations play, ect.)

Is there an easier way to do something like this?

|-|1Pp13
27-01-2008, 12:19 PM
Is there an easier way to do something like this?

im also wondering, ive always avoided it because its just too much work

Extension packages, is there one for multiplayer? i did a quick search, found nothing so i decided to make my own =)

EDIT: here (Multiplayer.gex-5kb) (http://www.gamedev.za.net/filecloset/data/files/315/Multiplayer.gex) it is

dislekcia
28-01-2008, 10:14 PM
Extension packages, is there one for multiplayer? i did a quick search, found nothing so i decided to make my own =)

EDIT: here (Multiplayer.gex-5kb) (http://www.gamedev.za.net/filecloset/data/files/315/Multiplayer.gex) it is

There was a multiplayer extension package on the old GMC. Dunno if that's still up... Generally if you're doing MP stuff you'd be using scripts a lot anyway, which makes extension packaged and drag n drop code kinda redundant...


Could someone please help me out here again? :)
I have this little problem that makes me want to kick puppies.

In the same "game" as before, I'm trying to make my character run and look at the mouse pointer at the same time.

At the moment I had to separate the head sprite, the body sprite and the arms sprite (So that the arms can aim a gun at the pointer too), so now I'm struggling to draw it on top of each of each other.
It kinda works, but now it's getting harder and harder to make it look good. (The separate sprites are breaking apart when some animations play, ect.)

Is there an easier way to do something like this?

Well, you're always going to have synchronisation and display issues like that... Your best bet is to keep track of where all your "anchor" points are throughout all your animations and draw everything in only one object. It's not a good idea to have tons of separate objects form the player when it's the same conceptual entity.

But yes, you're going to need to start thinking about attachment points and how things move around. The two lengthdir_x/y commands are going to become really useful ;)

-D

SplaT
29-01-2008, 03:53 PM
Thanks so much, diskekcia.
I'll keep that in mind, but I'm gonna push that aside for now and try something simpler first.
Cause I'm having way too much trouble by trying to make something way beyond my skill level (Which would be about... 0).

dislekcia
29-01-2008, 04:21 PM
Thanks so much, diskekcia.
I'll keep that in mind, but I'm gonna push that aside for now and try something simpler first.
Cause I'm having way too much trouble by trying to make something way beyond my skill level (Which would be about... 0).

Heh, no worries. That's how everyone learns ;)

-D

|-|1Pp13
29-01-2008, 08:19 PM
Im making one of those "match 3 or more blocks of the same type and watch them dissappear" type games, how would i check if there is a group of 3 or more? (without a ton of code)

dislekcia
30-01-2008, 01:44 AM
Im making one of those "match 3 or more blocks of the same type and watch them dissappear" type games, how would i check if there is a group of 3 or more? (without a ton of code)

You've got two options:

1) Store your blocks in an array and write a piece of code to check how many are in contact with each other.

2) Go the object approach and create invisible objects after every move that propagate in all 4 directions if the block in that direction is the same colour as the block they're on and doesn't already have an invisible object on it. Then, once the chain stops, anything under one of those invisible objects has to be touching and of the same colour (as long as there are 3 or more invisible objects...)

Both will require a fair amount of code and a bit of logical thinking, but they're not too hard.

-D

FuzzYspo0N
30-01-2008, 03:06 PM
you can aalso, if its 2d use a getPixel thing type function, that u can take you position and check pixel color at positions adjacent, if its blue it matches, do it per block and u can do it with a small bit of code

dislekcia
30-01-2008, 03:48 PM
you can aalso, if its 2d use a getPixel thing type function, that u can take you position and check pixel color at positions adjacent, if its blue it matches, do it per block and u can do it with a small bit of code

It's a lot easier in GM to just use instance_position() ;)

You don't have to check colours or whatever, you can just get the actual object at that specific position.

-D

|-|1Pp13
30-01-2008, 03:50 PM
you can aalso, if its 2d use a getPixel thing type function, that u can take you position and check pixel color at positions adjacent, if its blue it matches, do it per block and u can do it with a small bit of code

its not really a colour thing, its numbers (match the 3's etc)
so that wont work =(

besides im getting this error message:


___________________________________________
ERROR in
action number 1
of End Step Event
for object normal_block:

Error in code at line 4:
if global.array[x+32,y]=number then neighbours+=1

at position 12: Unknown variable array or array index out of bounds

explanation, i have an object that initiailizes global.array

At the moment you use an index the array is generated
global.array[0,0]=0 (im using the x and y values as indices in the array instead of 0,1,2 etc)

can someone please explain this error message? im not using a negetive or extremely arge array, and it has been created (in the room start)...so i dont know =?

dislekcia
30-01-2008, 04:20 PM
its not really a colour thing, its numbers (match the 3's etc)
so that wont work =(

besides im getting this error message:


___________________________________________
ERROR in
action number 1
of End Step Event
for object normal_block:

Error in code at line 4:
if global.array[x+32,y]=number then neighbours+=1

at position 12: Unknown variable array or array index out of bounds

explanation, i have an object that initiailizes global.array

global.array[0,0]=0 (im using the x and y values as indices in the array instead of 0,1,2 etc)

can someone please explain this error message? im not using a negetive or extremely arge array, and it has been created (in the room start)...so i dont know =?

Ok, a couple of things here:

Firstly, it's a really bad idea using the x and y locations themselves, AFAIK GM can only handle arrays with up to a hundred elements (although that might have only been a limitation in older versions). That means that you have [0, 1, ... , 98, 99] indices. It'd be a much better idea to store your blocks in the array logically at 0, 1, 2, etc.

You can do that by simply saying block_array_x = floor((block.x - offset_x) / block.sprite_width), assuming that offset_x is the x position that the top left block appears at. Similarly, block_array_y = floor((block.y - offset_y) / block.sprite_height)...

That will give you contiguous array values that make sense. You can simply convolute that equation to get a "real world" x position like so: block.x = (block_array_x * block.sprite_width) + offset_x, easy :)

Secondly, whenever you are iterating through an array you need to be aware of edge cases: That means you need to think of what happens when you're iterating AT THE FURTHEST EDGES of the array. In your case you'd need to put a guarding if statement around your array check: Something like if (x < maximum_x_extent_of_grid) check for neighbour to the right.

Fix both of those (and apply the second point's logic to all edge cases: top, left, bottom, right) and you won't go out of bounds on arrays anymore.

-D

|-|1Pp13
30-01-2008, 05:04 PM
I think the limit is only on the older versions

The system puts a limit of 32000 on each index and 1000000 on the total size.
thats why i didn't think anything about using x,y

i'll try the edge cases now and see if it works =)

dislekcia
30-01-2008, 05:45 PM
I think the limit is only on the older versions

thats why i didn't think anything about using x,y

i'll try the edge cases now and see if it works =)

Really though, don't use x and y as array indices without filtering them first. The whole point of arrays is that they're contiguous lumps of memory. Keeping most of it empty like that is just plain wrong... It hurts us, precious ;)

-D

|-|1Pp13
30-01-2008, 08:19 PM
Really though, don't use x and y as array indices without filtering them first. The whole point of arrays is that they're contiguous lumps of memory. Keeping most of it empty like that is just plain wrong... It hurts us, precious ;)

-D

thanx point taken =P

|-|1Pp13
31-01-2008, 08:43 PM
Can you pause a game in GM?

i know you can do it in debug mode but can you like have a button that the player presses to temorarily stop the game? (i searched for it in the help but found nothing :()

dislekcia
01-02-2008, 12:58 AM
Can you pause a game in GM?

i know you can do it in debug mode but can you like have a button that the player presses to temorarily stop the game? (i searched for it in the help but found nothing :()

There are a few ways to do it: Either you build in a boolean (or for more flexibility, numeric) flag into every moving/gameplay object that you can set manually to determine if the game is paused.

Or you can hijack GM's actual gameloop, suspend it by setting the room speed to 0 and running a continuous loop to test for keyboard input in a script and un-hijack the game loop by setting the room speed back to 30 (or whatever you had it set at).

Or you could mark your room as persistent, tell GM to re-render everthing to a surface, pop the player into another room with a pause menu and display a faded version of that surface as the "paused game" in the background.

Which one are you keenest on?

-D

SplaT
01-02-2008, 07:08 AM
There are a few ways to do it: Either you build in a boolean (or for more flexibility, numeric) flag into every moving/gameplay object that you can set manually to determine if the game is paused.

Or you can hijack GM's actual gameloop, suspend it by setting the room speed to 0 and running a continuous loop to test for keyboard input in a script and un-hijack the game loop by setting the room speed back to 30 (or whatever you had it set at).

Or you could mark your room as persistent, tell GM to re-render everthing to a surface, pop the player into another room with a pause menu and display a faded version of that surface as the "paused game" in the background.

Which one are you keenest on?

-D

Stuff like this makes me sick to my stomach.
:(
I'm one of those people that needs 8 months to make a Pong game.

Seems that I'm learning rather slowly, tho. But learning nonetheless.

dislekcia
01-02-2008, 02:27 PM
Stuff like this makes me sick to my stomach.
:(
I'm one of those people that needs 8 months to make a Pong game.

Seems that I'm learning rather slowly, tho. But learning nonetheless.

No worries :)

Everyone progresses at their own rate, the trick is to keep progressing.

-D

|-|1Pp13
01-02-2008, 02:40 PM
There are a few ways to do it: Either you build in a boolean (or for more flexibility, numeric) flag into every moving/gameplay object that you can set manually to determine if the game is paused.

Or you can hijack GM's actual gameloop, suspend it by setting the room speed to 0 and running a continuous loop to test for keyboard input in a script and un-hijack the game loop by setting the room speed back to 30 (or whatever you had it set at).

Or you could mark your room as persistent, tell GM to re-render everthing to a surface, pop the player into another room with a pause menu and display a faded version of that surface as the "paused game" in the background.

Which one are you keenest on?

-D

cant set room speed to 0 =( tried that already, because (correct me if im wrong) if there isn't atleast one step it means the game isn't really running, it cant check for input or anything so GM doesn't let you set it to 0 (or smaller because that would be running backwards =P)

ill probably do the first or 3rd option


No worries :)

Everyone progresses at their own rate, the trick is to keep progressing.

-D

and another trick is to ask on these forums =P Dis is much better than the GM help =P

SplaT
01-02-2008, 02:50 PM
Okay, I apologize if this is mentioned inside the help file, but I r not finding it nowheres.

I have text that moves slongside a character, but when the character gets to the side of the window, the text is drawn outside of it.
What can I do to make it sort of align against the window border instead of drawing it outside?


@Dislekcia
Haha, thanks. I'm progressing pretty slow.
Sort of like an angry blowfish inside a condom.
But I'll calm down and swim out eventually.

SkinkLizzard
01-02-2008, 03:34 PM
with reference to pause
just run a loop inside step event that all it does is check for your keyboard
controls, this'll bog down the game and not let anything else happen until you
press the right key to exit the loop. mind you you'll have to refresh the screen manually.

Anilihst
01-02-2008, 07:39 PM
Okay, I apologize if this is mentioned inside the help file, but I r not finding it nowheres.

I have text that moves slongside a character, but when the character gets to the side of the window, the text is drawn outside of it.
What can I do to make it sort of align against the window border instead of drawing it outside?


If you know the length of the text just check in the draw event if the character X value plus the text's length > room or current view then just draw the text minus the required X value. ex


if (room_width - text_legth) > character_x then
text_x = room_width - text_length;
else
text_x = character_x

*this is in sedo code not GML so just convert it

Otherwise you could guess if you text is at font size 10 then one character in the string would take say 5 pixels(I am guessing here so don't try this values) then you could get the string length(check help file). This value must then be multiplied by your character constant(I guessed 5) then you can just plug that into the above code and presto. It aligns.

btw There could be a GML function for this but I gave a language independent solution. I also haven't tested it.

dislekcia
01-02-2008, 08:09 PM
Okay, I apologize if this is mentioned inside the help file, but I r not finding it nowheres.

I have text that moves slongside a character, but when the character gets to the side of the window, the text is drawn outside of it.
What can I do to make it sort of align against the window border instead of drawing it outside?


@Dislekcia
Haha, thanks. I'm progressing pretty slow.
Sort of like an angry blowfish inside a condom.
But I'll calm down and swim out eventually.

That's a remarkably descriptive image there... O_o

Regarding your text problem: All you have to do is check to make sure that the text isn't being moved outside the window each time you reposition it, if it is then simply set it to some pre-determined maximum.

For instance, in your text's positioning code:
x = player.x;
y = player.y;
if (x > room_width - 40) x = room_width - 40;
if (y > room_height - 5) y = room_height - 5;

The logic is relatively simple, it's just that you have to watch for those situations yourself instead of expecting GM to know what you want it to do automatically ;)


with reference to pause
just run a loop inside step event that all it does is check for your keyboard
controls, this'll bog down the game and not let anything else happen until you
press the right key to exit the loop. mind you you'll have to refresh the screen manually.

Perfectly feasible :) Create an infinite loop that reads the keyboard to see if it should exit and redraws the screen. You have to use the lower-level GM commands though, don't rely on keyboard_string because that only gets updated every step, it won't change during your loop.


cant set room speed to 0 =( tried that already, because (correct me if im wrong) if there isn't atleast one step it means the game isn't really running, it cant check for input or anything so GM doesn't let you set it to 0 (or smaller because that would be running backwards =P)

ill probably do the first or 3rd option

True. I think I got confused as to what GM allows for room speeds there, my bad.


and another trick is to ask on these forums =P Dis is much better than the GM help =P

Dis often just quotes the GM help ;)

-Edit- Ah, pipped by Anihilist ;) Nice!

Just for the record:

string_width(string) Width of the string in the current font as it would be drawn using the draw_text() function. Can be used for precisely positioning graphics.
string_height(string) Height of the string in the current font as it would be drawn using the draw_text() function.

-D

|-|1Pp13
01-02-2008, 08:15 PM
Dis often just quotes the GM help ;)

-D

lol, no your more helpful because you know where in the help everything is =P

The game.dev website, how often does it get updated?

EDIT: when you get the resources thread up ;) you can put this in there (very helpful)
http://www.asciitable.com/

SplaT
02-02-2008, 12:14 PM
Thanks a bunch, Anilihst and dislekcia.

I'm still having some major trouble with it.
Sometime it only aligns correctly on one side of the screen but it still draws on the outside on the other.

After some crying, Christmas liqueur and Western songs, I came up with this:


Information about object: obj_speechController

Sprite: <no sprite>
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
execute code:

stepsdrawn = 100;

Step Event:
execute code:

if stepsdrawn == 0
{
instance_destroy();
}

Draw Event:
execute code:

//defining variables
text_length = string_width(global.speech);
y = obj_character.y;
x = obj_character.x;

//align at right side
if obj_character.x > ((room_width - text_length))
{
x = room_width - text_length;
}
else x = obj_character.x

//align at left side
if obj_character.x < (text_length / 2)
{
x = text_length / 2;
}
else x = obj_character.x

//draw the text
draw_set_halign(fa_center);
draw_set_color(c_blue);
if stepsdrawn > 0
{
draw_text(x,y-180,global.speech);
stepsdrawn -= 1;
}


With this, it only aligns with the left side of the screen.
The align at right side part seems to get completely ignored.

PS, the Text Length was divided by 2 cause I aligned to text to center.

Chippit
02-02-2008, 12:36 PM
What you need to do is kill those else clauses. You don't need them, and, if your right-align code runs, then the else portion of your next if statement is simply going to override the x-setting you make in the first. Remember that the x and y values are already set, you don't need to else there to make sure they have valid values.

Also note that if you're center aligning, that the code for the right edge also needs a text_length / 2, otherwise it will snap to the border a little bit too early.

Your draw should look like so:

//defining variables
text_length = string_width(global.speech);
y = obj_character.y;
x = obj_character.x;

//align at right side
if obj_character.x > (room_width - (text_length / 2))
{
x = room_width - (text_length / 2);
}

//align at left side
if obj_character.x < (text_length / 2)
{
x = text_length / 2;
}

//draw the text
draw_set_halign(fa_center);
draw_set_color(c_blue);
if stepsdrawn > 0
{
draw_text(x,y-180,global.speech);
stepsdrawn -= 1;
}

SplaT
02-02-2008, 01:32 PM
What you need to do is kill those else clauses. You don't need them, and, if your right-align code runs, then the else portion of your next if statement is simply going to override the x-setting you make in the first. Remember that the x and y values are already set, you don't need to else there to make sure they have valid values.

Also note that if you're center aligning, that the code for the right edge also needs a text_length / 2, otherwise it will snap to the border a little bit too early.


Ah! Thanks a lot, Chippit. It's working.
^_^

I actually did add the divide by 2 at the right edge code before.
But I see now that the problem there was that I used:

x = (room_width - text_length) / 2;

Instead of:

x = room_width - (text_length / 2);

Stupid mistake, yes I know.
:(

That, together with the unnecessary else statements, the game was doing some extremely weird stuff.
But I noted my mistakes and hopefully won't make them again.

|-|1Pp13
02-02-2008, 10:36 PM
quick question,

what would look better? scaling a small sprite bigger? or scaing a big sprite down?

im guessing latter

ShadowMaster
02-02-2008, 10:54 PM
quick question,

what would look better? scaling a small sprite bigger? or scaing a big sprite down?

im guessing latter

Depends, memory wise a small sprite, but quality wise the large sprite.

I don't know which is faster though.

Cyberninja
03-02-2008, 11:35 AM
Hey guys. I'm having problems creating button sequence actions for a fighting game (GM). I know how to activate an event when 3+ buttons are pressed simultaneously, but how do I get the action to activate when 3+ buttons are pressed in a sequence?

Eg: Down arrow, forward arrow, "B" button: creates fireball..etc.

|-|1Pp13
03-02-2008, 11:48 AM
Key Mapping (again)

Can you map the Mouse buttons to Keyboard buttons?

Chippit
03-02-2008, 12:39 PM
Hey guys. I'm having problems creating button sequence actions for a fighting game (GM). I know how to activate an event when 3+ buttons are pressed simultaneously, but how do I get the action to activate when 3+ buttons are pressed in a sequence?

Eg: Down arrow, forward arrow, "B" button: creates fireball..etc.
I would assign every key a specific character, (like F for forward, D for down, etc.), and then on every keypress I'd append that character to the end of a special combo string. Then all you need to do is check if that string ends with a specific combination of characters ('FDB', for your example), and if it does you'll perform the special move and clear the string.

You'll probably want to check for timing between keypresses too, and clear the string if there's, say, more than a quarter second gap between the current keypress and the previous one.

dislekcia
03-02-2008, 02:14 PM
Key Mapping (again)

Can you map the Mouse buttons to Keyboard buttons?

Not as far as I know... You can, however, spoof mouse commands by doing the following:

with (all) event_perform(ev_mouse, ev_left_released);

So all you need to do is put that code in the key you want to trigger the mouse event.


I would assign every key a specific character, (like F for forward, D for down, etc.), and then on every keypress I'd append that character to the end of a special combo string. Then all you need to do is check if that string ends with a specific combination of characters ('FDB', for your example), and if it does you'll perform the special move and clear the string.

You'll probably want to check for timing between keypresses too, and clear the string if there's, say, more than a quarter second gap between the current keypress and the previous one.

Suggestion made entirely of win!

I'd add a few things to that though: Only continue a combo string if such a combo exists, so that you don't always have a ton of "possible" non-combos clogging up the string; Clear the string when something has been entered that ends a combo; And search said string for combos, but only if they terminate at the end of the string.

Otherwise it's an awesome way to do it :)

-D

FuzzYspo0N
04-02-2008, 12:29 AM
Hey, another really out there option.

www.autohotkey.com

its the best scripting tool iv ever seen, and you can attach the EXE inside yours, to run as your game runs. Its pretty simple to map any key to anything, any command to anything, anything to anything.!

lol. just a weird idea tho

Anilihst
04-02-2008, 04:39 PM
Hi guys. I was wondering what would be the easiest way 2 check the following : over which instance and how many of each have a path gone over. I thought of a collision check with a counter but then I sometimes get a double hit on an instance. I then put in an alarm but this solution is way 2 bulky for my game.

It will be great if there is a better way of which I don't know. Thanks in advance.

Cyberninja
04-02-2008, 05:07 PM
Thanks guys. I will try that. =]

dislekcia
05-02-2008, 12:37 AM
Hi guys. I was wondering what would be the easiest way 2 check the following : over which instance and how many of each have a path gone over. I thought of a collision check with a counter but then I sometimes get a double hit on an instance. I then put in an alarm but this solution is way 2 bulky for my game.

It will be great if there is a better way of which I don't know. Thanks in advance.

I'm not quite sure what you mean by a path... An actual GM path? A path followed by an object? Clarification needed there...

However, there are two ways to deal with something colliding with the same object multiple times: First, keep a list of instances that have been collided with and second, programmatically prevent multiple collisions by a single object.

1) This is relatively, simple. All you do is set up a linked list to store the ids of objects that have been collided with and then only count the collision if it's not part of the list yet.


//Create event:
collisionList = ds_list_create();

//Collision event:
if (ds_list_find_index(collisionList, other.id) < 0) {
//This is a new collision, record it...
ds_list_add(collisionList, other.id);
//And now do stuff, like trigger an effect or whatever...
}

The number of collisions that have then happened is equal to ds_list_size(collisionList).

2) This approach uses a "still colliding" flag to prevent multiple collisions, the logic is similar to the list version, except you don't use a list...


//Create event on the collided object:
stillColliding = false;

//Alarm 0 event on the collided object:
stillColliding = false;

//Collision event on the "path" object:
if not other.stillColliding {
//Do collision important stuff, increase a counter, etc.
other.stillColliding = true;
}
other.alarm[0] = 1; //This will keep getting reset every frame that there's still a collision...


-D

Anilihst
05-02-2008, 02:37 PM
Thanks Dis

Yes the path is a GM path.

So there isn't an more effective way to do it. I used the 2nd method but since I did this calculation a lot I was just wondering if there was another way too do it faster.

I will just continue on with the 2nd method then.

SplaT
06-02-2008, 06:14 PM
This totally baffles me.
I really thought it would be easy...

How can I make a collision system for a billiard like game?
Edit: Clarification! How can I make Ball 1 hit Ball 2 so that Ball 2 goes in the correct direction and speed.

This first image I probably would be able to figure out given enough time. :P
http://i105.photobucket.com/albums/m207/forkss/Example1.jpg

But this second event really wants to make me shave and see the outside world:
http://i105.photobucket.com/albums/m207/forkss/Example2.jpg

GM's bounce function doesn't seem to do the trick, plus it is rather slowish.

Free smexytime for anyone who can help.
Pretty please!
:)

01DT!m3r
06-02-2008, 07:22 PM
I found the error don't use this

Gazza_N
06-02-2008, 08:40 PM
EDIT: Ooooer... Needs a rethink. Sorry. ^^;

SplaT
07-02-2008, 12:45 PM
EDIT: Ooooer... Needs a rethink. Sorry. ^^;


I found the error don't use this

Was these originally answers to my question?
:O
Haha, thanks anyway.

So far I have discarded 21 games that was too difficult to make.
So I thought an AirHockey game would be simple enough.
Once again, I was mistaken.
:(

Gazza_N
07-02-2008, 12:52 PM
It's doable, it's just that the maths needs quite a bit of thought. For what it's worth, this little circular collision setup you have is very similar in principle to the orbital mechanics I want to implement for Rockets!. Solving it would benefit us both. ;)

cairnswm
07-02-2008, 01:56 PM
So far I have discarded 21 games that was too difficult to make.
So I thought an AirHockey game would be simple enough.
Once again, I was mistaken.
:(

Sounds like where I started!

The first game I managed to finish had a little man running from one side of the screen to the other, dodging falling rocks. And it took me about 3 months to get right!

Dont give up, dont ever give up!

dislekcia
07-02-2008, 02:31 PM
Was these originally answers to my question?
:O
Haha, thanks anyway.

So far I have discarded 21 games that was too difficult to make.
So I thought an AirHockey game would be simple enough.
Once again, I was mistaken.
:(

No worries, often games that seem based on simple processes are actually complicated under the hood. That said, I'm pretty sure you could pull off air hockey, provided you get into rigid body dynamics a little...


This totally baffles me.
I really thought it would be easy...

How can I make a collision system for a billiard like game?
Edit: Clarification! How can I make Ball 1 hit Ball 2 so that Ball 2 goes in the correct direction and speed.

This first image I probably would be able to figure out given enough time. :P

But this second event really wants to make me shave and see the outside world:

GM's bounce function doesn't seem to do the trick, plus it is rather slowish.

Free smexytime for anyone who can help.
Pretty please!
:)

GM's bounce function simply doesn't have enough information to be accurate, plus it has no understanding of the shapes of sprites or objects that it's colliding. It's designed to give you a simple, reliable response to bouncing one object off a wall or similar surface.

To really simulate billiards-like collisions with accuracy you need quite a bit more information. You also need an understanding of how physics processes tend to work. Read this (http://chrishecker.com/Rigid_Body_Dynamics), it's awesome.

At this point you have two options:

You can either try to implement a rigid body system using what Chris Hecker was talking about in the explanation above... Remember that sphere-sphere and sphere-plane interactions (which make up airhockey and billiards) are relatively simple to do, compared to other dynamics situations. You can use GM's standard collision events and get roughly enough data from things like centre points and a few stored variables to calculate contact points, from there your logic is easy.

OR you could use one of the many physics engines and DLLs that have been put together for GM. The best and easiest to use of these is undoubtedly GMPhysics, google it and see what crops up.

Good luck. You haven't picked an easy problem, but it's definitely got a solution that's doable ;)

-D

Kensei
07-02-2008, 02:44 PM
Since my question might not be answered in my main thread, I will repeat it here:

If I want to make a Sprite animation, how do I go about doing that?
[I know how to do it in the Java framework for mobile games...but not GM ]

I understand that I need to load several images of the sprite, my tribble in this case, I just need to know how to cycle through the difference images under certain conditions

01DT!m3r
07-02-2008, 02:57 PM
Use an image index i think something like : if your conditions are met set spitesname.index = image number

01DT!m3r
07-02-2008, 03:00 PM
@splat . I asked my maths science and electronics teachers and only my maths teacher said to research vectors . But he couldnt actually work it out, :p

|-|1Pp13
07-02-2008, 05:13 PM
The way id do it (not sure if it would work but nyways)
is somehow inverse the directions, if it hits at 25 degrees the other ball should move in the away in the inverse direction (ie -25 degrees)

to make it simpler on my brain id add 90 to any direction (because GM starts with 0 facing right)

so in the collision event:
with (other).direction=(direction+90)*-1+90

explanation:
it will set the other balls direction to the inverse
the +90 in the brackets is for the first ball (so it faces up)
and the second +90 is for the other ball, so it also faces up

but then again, i dont know all that much =P

SplaT
07-02-2008, 05:57 PM
Sounds like where I started!

The first game I managed to finish had a little man running from one side of the screen to the other, dodging falling rocks. And it took me about 3 months to get right!

Dont give up, dont ever give up!

Hahaha!
That gave me anti-depressing hope.

I'm at my 22nd attempt at a game, each time I think: "Okay, maybe I should try something simpler"
And each time it turns out even more difficult than the last one.

But I'll get a game out! I swore to myself. I'll get something fun working eventually.

I actually did co-made a game with Skinklizzard called Cups! which didn't receive any responses on this forum, so I thought it was too crappy to pass as a game.

That all aside, I won't likely give up.


No worries, often games that seem based on simple processes are actually complicated under the hood. That said, I'm pretty sure you could pull off air hockey, provided you get into rigid body dynamics a little...


GM's bounce function simply doesn't have enough information to be accurate, plus it has no understanding of the shapes of sprites or objects that it's colliding. It's designed to give you a simple, reliable response to bouncing one object off a wall or similar surface.

To really simulate billiards-like collisions with accuracy you need quite a bit more information. You also need an understanding of how physics processes tend to work. Read this (http://chrishecker.com/Rigid_Body_Dynamics), it's awesome.

At this point you have two options:

You can either try to implement a rigid body system using what Chris Hecker was talking about in the explanation above... Remember that sphere-sphere and sphere-plane interactions (which make up airhockey and billiards) are relatively simple to do, compared to other dynamics situations. You can use GM's standard collision events and get roughly enough data from things like centre points and a few stored variables to calculate contact points, from there your logic is easy.

OR you could use one of the many physics engines and DLLs that have been put together for GM. The best and easiest to use of these is undoubtedly GMPhysics, google it and see what crops up.

Good luck. You haven't picked an easy problem, but it's definitely got a solution that's doable ;)

-D

I actually have GMPhysics, but I don't think I like the idea of implementing it and afterwards -still- not know what is going on under the hood. I think I'd rather know and understand the math involved in what I'm making and seeing.

That is where Chris Hecker's information would be extremely helpful. Thanks a lot for posting it.

I'm gonna check out the pfd's and only if I'm about to kill myself out of confusion, will I probably use GMPhysics for now and leave the actual learning of physics math for later.


@splat . I asked my maths science and electronics teachers and only my maths teacher said to research vectors . But he couldnt actually work it out, :p

At first I thought of using something like this:
http://i105.photobucket.com/albums/m207/forkss/Example3.jpg

Where I could use a couple of Trig equations to get the result speed and angle.
But since there is a lot of problems with this idea, I decided to stand back and ask around first.


The way id do it (not sure if it would work but nyways)
is somehow inverse the directions, if it hits at 25 degrees the other ball should move in the away in the inverse direction (ie -25 degrees)

to make it simpler on my brain id add 90 to any direction (because GM starts with 0 facing right)

so in the collision event:
with (other).direction=(direction+90)*-1+90

explanation:
it will set the other balls direction to the inverse
the +90 in the brackets is for the first ball (so it faces up)
and the second +90 is for the other ball, so it also faces up

but then again, i dont know all that much =P

I can see a couple of flaws popping up with this equation as it seems a bit limiting with not being physically correct on all situations.

It might be, however, worth a try nevertheless.

01DT!m3r
07-02-2008, 06:10 PM
What nag mag was the tutorial on the golem master level editor in?

|-|1Pp13
07-02-2008, 06:43 PM
I can see a couple of flaws popping up with this equation as it seems a bit limiting with not being physically correct on all situations.

It might be, however, worth a try nevertheless.

ya its the easy but not so good route =P

01DT!m3r
07-02-2008, 06:53 PM
My attempt that was later covered up by my discovering of it not working . Was basically the same as hippies attempt.

dislekcia
07-02-2008, 06:57 PM
What nag mag was the tutorial on the golem master level editor in?

October 2006.

-D

dislekcia
07-02-2008, 07:52 PM
Since my question might not be answered in my main thread, I will repeat it here:

If I want to make a Sprite animation, how do I go about doing that?
[I know how to do it in the Java framework for mobile games...but not GM ]

I understand that I need to load several images of the sprite, my tribble in this case, I just need to know how to cycle through the difference images under certain conditions

GM will play a sprite with several subimages by default. Cycling through each image at a speed controlled by the object-level variable image_speed, which defaults to 1, meaning 1 image per frame.

If you want to manually control which subimages are being shown, use the image_single variable and set it to the specific subimage number you want to see. You can write code to control this value every step, giving you animation.

I tend to lump animations into single sprites and switch sprites using sprite_index = <sprite name> or the drag and drop function whenever I need a different look.

-D

01DT!m3r
07-02-2008, 08:02 PM
Thanks dis :)

SkinkLizzard
08-02-2008, 09:44 AM
@splat: your problem is a basic 2 dimensional collision
you need to decide what your coefficient of restitution is going to be this is a number between 0 and 1 that determines the elasticity of the collision 0 being the two balls stick together 1 being they bounce perfectly no energy lost.

e = V2-V1/U1-U2
where e is the coefficient, V1 and 2 are the velocities after collision, U1 and 2 are velocities before.

U1M1 + U2M2 = V1M1 + V2M2
thats the same basic momentum equation from school, you just now need to break
it up into two directions.
http://i98.photobucket.com/albums/l249/skinklizzard/oblique_collision.jpg
use W and Z to make calculation easier then convert your results to x and y.
your main problem is perhaps going to be finding the common normal and tangent plane
as well as converting your velocities from a W Z reference to X Y.
good luck.

edit: forgot to mention the component of velocity in the direction of the tangent plane is unaffected.
U2z = V2z; U1z = V1z

SplaT
08-02-2008, 01:24 PM
@splat: your problem is a basic 2 dimensional collision
you need to decide what your coefficient of restitution is going to be this is a number between 0 and 1 that determines the elasticity of the collision 0 being the two balls stick together 1 being they bounce perfectly no energy lost.

e = V2-V1/U1-U2
where e is the coefficient, V1 and 2 are the velocities after collision, U1 and 2 are velocities before.

U1M1 + U2M2 = V1M1 + V2M2
thats the same basic momentum equation from school, you just now need to break
it up into two directions.
http://i98.photobucket.com/albums/l249/skinklizzard/oblique_collision.jpg


Ah, cool. Thanks.

I see how this could work, but as this is an Air Hockey game, if circle A was the Paddle, V1 can't exist.
Does that change anything?
Also, I'm still not sure how I'm going to calculate the correct direction of only the Puck OR how I'm going to implement all this in GML.
Or am I missing something in your explanation?

Seems you have forgotten who you are trying to teach, skink.
:P

01DT!m3r
08-02-2008, 02:10 PM
In gamemaker how many steps are in a sec ?

SkinkLizzard
08-02-2008, 02:47 PM
splat V1 will still exist, you'd make the paddle approximately infinite mass
so V1 = U1.

01DT!m3r: there are room_speed number of steps to one second

01DT!m3r
08-02-2008, 05:32 PM
I remember someone telling me that before :) thanks skink

Aval4nche
22-02-2008, 06:26 PM
When changing an object into another, how do I make the view follow it?

dislekcia
22-02-2008, 07:03 PM
When changing an object into another, how do I make the view follow it?

By setting view_object[0] to the id of the new object.

Read the GM help on view_object for a good explanation of everything you can do with views and why view_object is an array :)

-D

Aval4nche
22-02-2008, 07:12 PM
thanks 4 the assistance:)

Anilihst
28-02-2008, 07:06 PM
I want to use a database to store my unit data(this is static data I just load it no writing) in. Can any1 pls tell me if this is possible in GM. If not could you maybe suggest other options.

dislekcia
28-02-2008, 07:29 PM
I want to use a database to store my unit data(this is static data I just load it no writing) in. Can any1 pls tell me if this is possible in GM. If not could you maybe suggest other options.

Very possible. You have several options, your best bet is probably to just use normal file access (stick that in the GM help and you'll get all you need to know about it) and read in text values. That'd be useful if you don't know how many units you're going to have... Otherwise you could set up an ini file and use GM's built-in functions to handle pulling values from that, or you could even use a DLL to have GM interact with an SQL database. But that last idea would be difficult to reproduce on user machines: They'd have to have a working SQL server installed.

-D

Anilihst
28-02-2008, 09:04 PM
I just want to store the default or starting values for my units. eg. A archer unit has 30 HP 10 atk and 5 defence. I then load those values into variables and forget about the file until I next start the game.

That was just for clearing up the use of the file.

Now the problem with the text file is that it is difficult to keep people from changing them except by incription which in turn makes them difficult to update.

The SQL is like you said not even an option in my case.

I guess this means that I will have 2 make my own dll to do it. Thanks anyway.

Anilihst

dislekcia
28-02-2008, 10:38 PM
I just want to store the default or starting values for my units. eg. A archer unit has 30 HP 10 atk and 5 defence. I then load those values into variables and forget about the file until I next start the game.

That was just for clearing up the use of the file.

Now the problem with the text file is that it is difficult to keep people from changing them except by incription which in turn makes them difficult to update.

The SQL is like you said not even an option in my case.

I guess this means that I will have 2 make my own dll to do it. Thanks anyway.

Anilihst

Hey, sometimes allowing players to change and edit settings like that isn't a bad thing... After all, Red Alert allowed that and it made for some awesome little experiences ;)

I wouldn't be too worried about users editing values, most won't. Especially if you use a non-standard file extension (you don't have to use .txt for GM to open a text file) as "text" is just a format. You could also always use a binary file instead, those aren't really human-readable.

There's really no point going overboard and writing a DLL just to stop the people that want to mess around. They will anyway. Rather get the game out there and playable.

-D

FuzzYspo0N
28-02-2008, 11:06 PM
Dis is right, i cud probably do to a dll what i can with a text file :)

i made a simple protection thing, u encrypt the strings using a lame encryption thingy, and then write it. and each time u read it, unencrypt it, that way they cant change it and u can still do what u need..

Thing is u will need a read write tool to edit those :) shud be quick to make tho, and good experience.

dislekcia
28-02-2008, 11:16 PM
Dis is right, i cud probably do to a dll what i can with a text file :)

i made a simple protection thing, u encrypt the strings using a lame encryption thingy, and then write it. and each time u read it, unencrypt it, that way they cant change it and u can still do what u need..

Thing is u will need a read write tool to edit those :) shud be quick to make tho, and good experience.

No. My point is that writing something to protect game data like that is silly. Most players won't want to mess with values and if you call the file "nameofgame.usf" (Unit Settings File) instead of "unitsettingsfile.txt" people won't even notice that they can change things.

Spend your time on gameplay instead of things that aren't needed.

-D

Cyberninja
28-02-2008, 11:17 PM
Hey guys. I'm improving the "Super Moves" in my fighting game. I've run into a problem though. What I want to do:

When buttons 4+5+1 are pressed, Instance A transforms into Instance B.

Could somebody show me how I would accomplish this using GML? I can't seem to get this to work. An example with be most appreciated. I'm extremely confuzzled. O_o

dislekcia
29-02-2008, 12:16 AM
What about the handy instance_change command?


instance_change(obj,perf) Changes the instance into obj. perf indicates whether to perform the destroy and creation events.

I'm not sure exactly how you're testing for those keys pressed, but all you need to really be aware of is that instance_change acts on the object that calls it. So if you're running the triggering code on an object other than the one you want to change, all you need to do is this:


with (instanceToBeChanged) {
instance_change(typeToChangeTo, doYouWantTheCreateEventToFireAgain);
}

-D

FuzzYspo0N
29-02-2008, 12:24 AM
Spend your time on gameplay instead of things that aren't needed.

yes, apologies. i have all the experience in time wasting >.< hehe, so for me its quicker. i agree tho more time on gameplay

Anilihst
29-02-2008, 09:22 AM
Thanks Dis and Fuzzy I will have a look at the binary and text files. I can always change it later if it becomes a problem.

Anilihst

Cyberninja
29-02-2008, 11:46 AM
Thanks Dis! I will try that. :)

*Cyber continues with some serious game-deving...

CiNiMoDZA
04-03-2008, 02:29 PM
Is there any way in GM to say that if just one specific button is not being pressed an action must stop. I want a vehicle to slow down when the up key is not being pressed!

FuzzYspo0N
04-03-2008, 02:55 PM
if(keypressed) increase speed else (if speed > 0) decrease speed?

like that?

Liszt
08-03-2008, 11:32 AM
About beign an intermediate composer and professional musician... where can I fit into the local gaming scene?

Perhaps, composer for South African titles (free games are the best of course, so is gamedotdev). Any use for me? Where should I start?

I have access to my own MIDI studio at home (with Cakewalk, ACID ect).

Liszt...

Chippit
08-03-2008, 01:32 PM
Welcome, Liszt

I can imagine the developers around here will be more than happy to make use of your services if you show us what you can and/or have done.

We're quite lacking in terms of audio specialists, so your presense and assistance will be more than welcome.

dislekcia
09-03-2008, 03:30 PM
About beign an intermediate composer and professional musician... where can I fit into the local gaming scene?

Perhaps, composer for South African titles (free games are the best of course, so is gamedotdev). Any use for me? Where should I start?

I have access to my own MIDI studio at home (with Cakewalk, ACID ect).

Liszt...

Hi Liszt!

Welcome to the forums, I was just talking about not having much available in terms of musical skills for games locally, then you pop up. Good timing :)

In terms of starting, I recommend downloading a few of the games here (and I'm sure people will ask you to take a look at their games, especially if you create a Music Request thread) and putting together small samples of what you imagine music for them sounding like. I can virtually guarantee that any songs you send to developers will be put straight into their games ;)

Remember, game music is a huge field: You've got orchestral epics like the Halo theme sharing space with chiptune retro music and everything inbetween. Come in, experiment, have fun and we all hope you stay (because I want music in my games too!)

-D

Gazza_N
09-03-2008, 04:37 PM
I have access to my own MIDI studio at home (with Cakewalk, ACID ect).

Liszt...

Welcome! Where has someone like you been all this time? :P

Liszt
12-03-2008, 08:59 AM
Yip! (Whoosh, I came shootin up the pipe and here I am!!!)

The MOST important motif of a game SHOULD be a main theme and a Leitmotif as first used by Wagner and later in games such as LeChucks Revenge (eg. Largo LeGrand's Theme, LeChucks theme) with later installments (my favourite beign Escape from Monkey Island) themes like "Pegnose Pete", "The Scummbar" (which reoccur throughout the game in the shape of variations), Herman Toothrot ect.

THUS, we conclude: a motif or theme for a character or event is most certainly the MOST important aspect of gaming, characters and events.

Following, most games lack a proper theme. Theme's should consist of Memorable music.

However, STRONGLY reccomend the music of "Monkey Island" (all games), "The Secrets of DaVinci" (a stunning soundtrack with a divine mixture of harpsicord and piano - never heard before!), "Hitman", and "Call of Duty 4: Modern Warfare". I also strongly reccomend "Tomb Raider: Angel of Darkness". Although the game may be foul, the soundtrack (with the London Symphony Orchestra) is a smash. Another little game soundtrack (which I found quite Diverting!) was "Gesundheid". Matt Hammill did a great job with his recorder and bass guitar! Well done!

As for the texture, game music should be a profound mixture of BOTH classical music and modern genre's (like rock, punk, R&B ect), using the choir in dramatic events.

YES! I am here to share/compose/mix music. I AM here to stay. The Force is Stong with me!!!

Then again, start small (with you) before moving on to professional developers. Perhaps, make a name before going on.

Liszt
12-03-2008, 09:00 AM
AND beign a junior member, I would appreciate it if I could have some help making a "MUSICAL" thread. I haven't got access to that yet.

dislekcia
12-03-2008, 10:59 AM
AND beign a junior member, I would appreciate it if I could have some help making a "MUSICAL" thread. I haven't got access to that yet.

You've just been moved into the member group, you should now be able to start new threads :)

-D

dislekcia
12-03-2008, 11:09 AM
The MOST important motif of a game SHOULD be a main theme and a Leitmotif as first used by Wagner and later in games such as LeChucks Revenge (eg. Largo LeGrand's Theme, LeChucks theme) with later installments (my favourite beign Escape from Monkey Island) themes like "Pegnose Pete", "The Scummbar" (which reoccur throughout the game in the shape of variations), Herman Toothrot ect.

THUS, we conclude: a motif or theme for a character or event is most certainly the MOST important aspect of gaming, characters and events.

Following, most games lack a proper theme. Theme's should consist of Memorable music.

However, STRONGLY reccomend the music of "Monkey Island" (all games), "The Secrets of DaVinci" (a stunning soundtrack with a divine mixture of harpsicord and piano - never heard before!), "Hitman", and "Call of Duty 4: Modern Warfare". I also strongly reccomend "Tomb Raider: Angel of Darkness". Although the game may be foul, the soundtrack (with the London Symphony Orchestra) is a smash. Another little game soundtrack (which I found quite Diverting!) was "Gesundheid". Matt Hammill did a great job with his recorder and bass guitar! Well done!

Fully agreed on the power of music to emphasise and create dramatic characters. I wish I had that available as a tool to play around with... Now I'm wondering what a musical score for an ambulatory sausage sounds like ;)

And, speaking of recurring themes in music, I found the Battlefield "dun dun da DUN-DUN" really, really powerful. They used it amazingly well at the end of everything they put out to create a feeling of brand with the epic scale that they were aiming for. That piece of music is probably a major factor in the way the games feel to me.

-D

Liszt
12-03-2008, 08:49 PM
At the end, music is composed to the atmosphere that the game should haul. I have used that same battlefield silent drum in a song, quite effectively.

As for an ambulatory sausage, what is the atmosphere of the game? It suggest music in the style of the immortal "Gesundheid", however, in a more dramatic way. Perhaps, a brawdy like song. Perhaps.

NOW, the billion dollar question: WHAT is the purpose of the music? What idea/emotions should it convey? I believe ideal music for an ambulatory sausage would be light, rag like.

Your comment???

|-|1Pp13
13-03-2008, 06:55 PM
outbreak.gmk (http://www.gamedev.za.net/filecloset/data/files/385/Outbreak.gmk)

im having a problem generating the board. the first time it does it perfectly but when i reload the room (to try do another board) it doesn't work, it just makes a clump of blocks. ive posted the source code so please take a look, i dont know whats wrong

SkinkLizzard
14-03-2008, 07:11 PM
|-|1Pp13 in the left released event for
your redo_generation object, after you have randomize()
you need to put
event_perform_object(block_creator_controller,ev_o ther,ev_game_start);
this reruns your game start code for the block_creator_controller
so it reinitializes your global block variables. restarting the room doesn't effect global variables
the same as switching rooms doesn't :)

|-|1Pp13
14-03-2008, 08:07 PM
|-|1Pp13 in the left released event for
your redo_generation object, after you have randomize()
you need to put
event_perform_object(block_creator_controller,ev_o ther,ev_game_start);
this reruns your game start code for the block_creator_controller
so it reinitializes your global block variables. restarting the room doesn't effect global variables
the same as switching rooms doesn't :)

thank you :) ill see if it works soonish

Anilihst
18-03-2008, 06:23 PM
For TBS multiplayer game is MPlay good enough or should I use 39dll?

The game that I am going to use it on will have a lot of traffic but it is not speed dependant but it should be reliable.

dislekcia
18-03-2008, 07:07 PM
Depends, do you want to play on a LAN or over the internet? If you want LAN more than internet, mplay is great: It handles session joining, authentication, etc. for you. With a winsock wrapper dll you'd have to do all that yourself, or hope someone implemented it well enough.

-D

Anilihst
18-03-2008, 09:44 PM
Thanks Dis for my game it is mainly LAN with only limited internet so I will go with the mplay.

dislekcia
18-03-2008, 10:05 PM
Thanks Dis for my game it is mainly LAN with only limited internet so I will go with the mplay.

We'll be having a DevLan soon about multiplayer stuff in April. If you're in Gauteng you should really try to come, I'll be talking about networking tips and tricks as well as lobbing around a simplified framework that Monochrome uses.

-D

Anilihst
18-03-2008, 10:59 PM
Sweet I will really try to make it. I am very interested in the multiplayer side of games.

dINGLE
20-03-2008, 04:58 PM
To all the GM experts:

Can you somehow turn on anti-aliasing in GM?
Im remaking a game I did in java which had it, but I cant find it in GM.

Thanks!

dislekcia
20-03-2008, 05:57 PM
To all the GM experts:

Can you somehow turn on anti-aliasing in GM?
Im remaking a game I did in java which had it, but I cant find it in GM.

Thanks!

http://img86.imageshack.us/img86/9149/antialiasinggmvp1.jpg

That turns on bilinear filtering for the whole game, which I assume is what you want. It smooths things out a lot, good if you're using drawn or higher-res art.

-D

dINGLE
20-03-2008, 07:49 PM
http://img86.imageshack.us/img86/9149/antialiasinggmvp1.jpg

That turns on bilinear filtering for the whole game, which I assume is what you want. It smooths things out a lot, good if you're using drawn or higher-res art.

-D
Thanks but I don't think thats what I'm after.
Im not using any sprites at all.
I'm looking to smooth out the jagged edges created by the draw_line and draw_circle functions.
I tried that filtering and it didn't work.

dislekcia
20-03-2008, 09:02 PM
Thanks but I don't think thats what I'm after.
Im not using any sprites at all.
I'm looking to smooth out the jagged edges created by the draw_line and draw_circle functions.
I tried that filtering and it didn't work.

Hmmm. Those are vertex functions, so you'd have to manually turn anti-aliasing on on your actual 3D card to smooth those draw functions out... GM doesn't expose those switches, because it doesn't recognise them.

Your best bet is to make a 10x1 pixel sprite and stretch that for your lines. For the circles you might want to do one really high-res circle and scale that down accordingly. Sorry, I know neither of those are 100% optimal :(

Do you really need the anti-aliasing for the gameplay?

-D

dINGLE
21-03-2008, 12:12 AM
Hmmm. Those are vertex functions, so you'd have to manually turn anti-aliasing on on your actual 3D card to smooth those draw functions out... GM doesn't expose those switches, because it doesn't recognise them.

Your best bet is to make a 10x1 pixel sprite and stretch that for your lines. For the circles you might want to do one really high-res circle and scale that down accordingly. Sorry, I know neither of those are 100% optimal :(

Do you really need the anti-aliasing for the gameplay?

-D
Well it is true that I don't absolutely have to have it for the game to work,
the game is based on two territories, one on each side of the screen,
so right now there is a big jagged line down the middle of the screen,
which looked really nice and professional with anti-aliasing in java :(

Thanks for the suggestion though
Ill try experimenting with sprites if I don't figure out something else.

FuzzYspo0N
21-03-2008, 12:14 AM
make it a background, as an image? = whatever quality you want?

dINGLE
21-03-2008, 11:44 AM
make it a background, as an image? = whatever quality you want?

the line separating the territories is dynamic so it has to be drawn since there are too many possibilities.

Vexo
23-03-2008, 07:28 PM
Hey guys
I don't have much experience with game maker did the first tutorial a few months ago and now i finally have enough time to learn some more and try get a game done.
I have 2 problems.
First let me explain the game.
It is a top down shooter with monsters spawning randomly from all sides.

First problem is the spawning
(First only make them spawn from top)
This is what I have so far:

Object
Create
Set variable spawntime to 1
Set variable topx to 0
Set variable topy to 0
Alarm
Set variable spawn time to 0
Step
Execute a piece of code

// to spawn monster from the top of the screen
if (spawntime == 1){
spawntime = 0;
topx = random(room_width);
topy = room_width;
alarm[0] = 150 ; //// will be controlled later fixed value for now
monster = create_instance(topx,topy,monster); // this step seems to be the problem i want it to create a monster1 object at those values.
}

Please help with last line and let me know if this will even work or if there is a better way.

Second problem
This question is actually more about photoshop
Because it is a top down game i can just rotate my picture and then have pictures of the character facing all directions.
( Need this for character to face cursor )
But when i use photoshop's rotate the pictures the quality decreases.
How can i rotate my picture without loosing any quality ?

dislekcia
23-03-2008, 09:17 PM
Hey guys
I don't have much experience with game maker did the first tutorial a few months ago and now i finally have enough time to learn some more and try get a game done.
I have 2 problems.
First let me explain the game.
It is a top down shooter with monsters spawning randomly from all sides.

First problem is the spawning
(First only make them spawn from top)
This is what I have so far:

Object
Create
Set variable spawntime to 1
Set variable topx to 0
Set variable topy to 0
Alarm
Set variable spawn time to 0
Step
Execute a piece of code


// to spawn monster from the top of the screen
if (spawntime == 1){
spawntime = 0;
topx = random(room_width);
topy = room_width;
alarm[0] = 150 ; //// will be controlled later fixed value for now
monster = create_instance(topx,topy,monster); // this step seems to be the problem i want it to create a monster1 object at those values.
}

Please help with last line and let me know if this will even work or if there is a better way.

Two problems that I can see right away:

Firstly, topy should be 0, not room_width, hopefully that's a typo.

Secondly, you have an object type of the same name as a variable you're trying to use. That's not going to work. Change your object type name to Monster (yes, case does make a difference in GM, I tend to make types start with uppercase) or change the variable to myMonster = instance_create(blah blah blah) and it'll work.


Second problem
This question is actually more about photoshop
Because it is a top down game i can just rotate my picture and then have pictures of the character facing all directions.
( Need this for character to face cursor )
But when i use photoshop's rotate the pictures the quality decreases.
How can i rotate my picture without loosing any quality ?

You can use the image_angle variable to rotate a sprite directly in GM, without having to make hundreds of sprites facing different directions :)

-D

Vexo
23-03-2008, 09:30 PM
yea sorry happened when copy/paste from original code


if i run i get this

FATAL ERROR in
action number 1
of Step Event
for object spawn:

COMPILATION ERROR in code action
Error in code at line 7:
Monster = create_instance(topx,topy,monster);

at position 12: Unknown function or script: create_instance

SkinkLizzard
23-03-2008, 10:24 PM
that would be because its instance_create() :) and not the other way round:)

Vexo
23-03-2008, 10:26 PM
ahh found a problem its supposed to be instance_create not create_instance although it doesn't give errors anymore the monsters still doesnt spawn

edit: tnx SkinLizzard noticed that just now
@ dislekcia image_angle is only in pro version don't have it yet.

SkinkLizzard
23-03-2008, 11:04 PM
the sprite editor has a rotate function... under animation
add rotation 36 frames one for every 10 degrees

edit and
try change
Alarm
Set variable spawn time to 0

to Alarm
Set variable spawn time to 1

and also make sure that the monsters step event has
y += 5; //or some other appropriate value;

dislekcia
23-03-2008, 11:23 PM
ahh found a problem its supposed to be instance_create not create_instance although it doesn't give errors anymore the monsters still doesnt spawn

edit: tnx SkinLizzard noticed that just now
@ dislekcia image_angle is only in pro version don't have it yet.

Your monsters are spawning, they're just spawning so far down the screen that you're not seeing them: You set topx to random(room_width) and topy to room_width, so it'll spawn at some point way off the bottom of the screen, unless your room is narrower than it is high... topy should be 0 or less than 0. Like I said originally...

-D

Vexo
23-03-2008, 11:37 PM
topy is set to 0 like i said in my second post

yea sorry happened when copy/paste from original code

i was copying and adding comments to post and must have pasted room_width on the wrong place but in my original code it is set to 0
( my room is 800 by 800 at moment and the monsters are set to come straight towards me )

@ skinlizzard tnx saw you can make i rotate

Vexo
23-03-2008, 11:59 PM
ah i am so stupid. I go through everything to try figure out whats wrong and then i realized i never added the object spawn in the room http://www.fortunecity.com/campus/ink/659/baby16.gif
but tnx for the help

Squid
24-03-2008, 12:02 PM
and then i realized i never added the object spawn in the room
but tnx for the help

This happens all the time. To everyone. It's a plague.

Vexo
24-03-2008, 02:37 PM
This happens all the time. To everyone. It's a plague.

Good to know i am not the only one :)

I did allot of work last night and I have a few new questions.

Problem 1
My sprites gun is on the right hand side of my sprite at the moment and i want to make the bullet come from the gun and not the center of the picture. I thought of putting the origin of the sprite on the gun and then use something like sprite_origin to get the origin values
but they don't seem to have a function for that.

Problem 2
How do i changes the speed my .gif go. I made a gun to fire in photoshop and made it the perfect speed but when i load it it is to slow. Maybe use alarm or is there other ways ?

tnx for all the help so far

SkinkLizzard
24-03-2008, 06:36 PM
image_speed is the animation speed of the sprite
and if you set the origin to the gun
x and y will refer to that origin, which should work providing you don't do any rotation about the origin.
other wise use the lengthdir_x and lengthdir_y functions to get the position of the gun.

assuming ship sprite faces up

bullet.x = x+lengthdir_x(<horizontal distance from orig to gun>, direction-90)+lengthdir_x(<vertical distance from origin to gun>,direction)


edit: and don't let vectors screw with your head

Vexo
24-03-2008, 08:16 PM
tnx il try that

Vexo
24-03-2008, 09:16 PM
ok next one :)
some more code problems
Ok so all my monsters spawn from random sides and come straight towards me.
This makes it kinda boring.
So i wrote this to make the monsters check how far the player is from them and if the player is far they will rather check the players position and depending on user key press they will try go there and cut him of. The problem is the monsters just stand still and dont move at all -_-
please help

1

MonsterFromManDistance = point_distance(x,y,man.x,man.y);
ManFromRightDistance = point_distance(man.x,man.y,900,man.y);
ManFromLeftDistance = man.x;
ManFromTopDistance = man.y;
ManFromBottomDistance = point_distance(man.x,man.y,man.x,900);

if (instance_number(man) == 1 ){
if (MonsterFromManDistance >= (room_width div 4)){

if (keyboard_check_pressed('d') == true){
move_towards_point((man.x +(ManFromRightDistance div 2)) ,man.y,monster.speed);
}
else if (keyboard_check_pressed('a') == true){
move_towards_point((ManFromLeftDistance div 2) ,man.y,monster.speed);
}
else if
(keyboard_check_pressed('w') == true){
move_towards_point(man.x,(ManFromTopDistance div 2),monster.speed);
}
else if
(keyboard_check_pressed('s') == true){
move_towards_point(man.x,(man.y+(ManFromBottomDist ance div 2)),monster.speed);
}
else { move_towards_point(man.x,man.y,speed);}


}
else {move_towards_point(random(x),random(y),speed); }
}




edit:
2
Second question
i made a fireball that travels through the monsters.
I don't want it to be destroyed but i think it is doing the colliding step once for every step meaning when
the fireball starts touching the object it does say 20 damage but it then continuous doing 20 for every step or so i think. How can i fix this ?

|-|1Pp13
24-03-2008, 09:22 PM
Need help with my multiplayer game please

At the moment only the quick start button has code
it should:
if theres a server, join it
if there's no server it can join it must create one

Theres 3 maps and it randomly chooses one

Now the second player joins, i know he joins because it sends a message '<their name> has joined'
and he goes to the correct room, and doesn't create the player -.-

The other players dont do this, not sure whats wrong though -.-

The way ive done it is the player is created, and the other players are created as enemy objects with unique ID's

source code (.gmk) (http://www.gamedev.za.net/filecloset/data/files/410/SA_source_code.gmk)
(sorry theres no comments so it may be slightly confusing :p)

Additional Info:
-->message id's
1-x coordinates
2-y coordinates
3-colour of player thats been created
4-assigning unique id to the player thats just been created

50-player name
51-just to promt the server to send what room its in
52-what room the servers in

luenardi
28-03-2008, 12:39 AM
Has anyone ever seen any good 3D physics egine for GM.
I have never found any on any forum or site and i have been around.
the best example of physics i saw was in basic 2d i was realy good. it even used The NTXCOOKING.DLL for hardware physics acceleration.

Vexo
28-03-2008, 05:16 AM
ok next one :)
some more code problems
Ok so all my monsters spawn from random sides and come straight towards me.
This makes it kinda boring.
So i wrote this to make the monsters check how far the player is from them and if the player is far they will rather check the players position and depending on user key press they will try go there and cut him of. The problem is the monsters just stand still and dont move at all -_-
please help

1

Originally Posted by code
MonsterFromManDistance = point_distance(x,y,man.x,man.y);
ManFromRightDistance = point_distance(man.x,man.y,900,man.y);
ManFromLeftDistance = man.x;
ManFromTopDistance = man.y;
ManFromBottomDistance = point_distance(man.x,man.y,man.x,900);

if (instance_number(man) == 1 ){
if (MonsterFromManDistance >= (room_width div 4)){

if (keyboard_check_pressed('d') == true){
move_towards_point((man.x +(ManFromRightDistance div 2)) ,man.y,monster.speed);
}
else if (keyboard_check_pressed('a') == true){
move_towards_point((ManFromLeftDistance div 2) ,man.y,monster.speed);
}
else if
(keyboard_check_pressed('w') == true){
move_towards_point(man.x,(ManFromTopDistance div 2),monster.speed);
}
else if
(keyboard_check_pressed('s') == true){
move_towards_point(man.x,(man.y+(ManFromBottomDist ance div 2)),monster.speed);
}
else { move_towards_point(man.x,man.y,speed);}


}
else {move_towards_point(random(x),random(y),speed); }
}




edit:
2
Second question
i made a fireball that travels through the monsters.
I don't want it to be destroyed but i think it is doing the colliding step once for every step meaning when
the fireball starts touching the object it does say 20 damage but it then continuous doing 20 for every step or so i think. How can i fix this ?

Anybody ?
Really need to get these things sorted please help

SkinkLizzard
28-03-2008, 09:26 AM
I cant help you with part 1 but as for the fireball
make a blank mask sprite then
put in the monster collision with fireball event:

mask_index = blank_mask
alarm[11] = 5

then add event alarm 11
and in there put

Mask_index = sprite_index

adjust the alarm time as needed

luenardi
28-03-2008, 04:52 PM
This is kids stuff.

edg3
28-03-2008, 05:37 PM
This is kids stuff.
Then dont read this thread. easy.

@vexo:
I read over your code, made one simple change (added variables instead of having 'a' in the keyboard_check_pressed() function.
Im not exactly sure how its supposed to behave, but my only issue being that if the monster gets too close, it seems to become undecided about where to go, but Im sure you can get through that.

And finally, for a probable reason why it wasnt working: you had a random space in your code in the middle of a variable, and you didnt have the ord() values of the keys :)


move_towards_point(man.x,(man.y+(ManFromBottomDist ance div 2)),monster.speed);

Here is the slightly modified code (to work with arrow keys, but Ive commented to show what to do.

MonsterFromManDistance = point_distance(x,y,man.x,man.y);
ManFromRightDistance = point_distance(man.x,man.y,900,man.y);
ManFromLeftDistance = man.x;
ManFromTopDistance = man.y;
ManFromBottomDistance = point_distance(man.x,man.y,man.x,900);

//I added this just while neatining the code
//for your checks you had keyboard_check_pressed('A') etc, which doesnt work as aparently you need the ordinal value
//Quote from GM help file: For the letter keys use for example ord('A').
//(The capital letters.) For the digit keys use for example ord('5') to get the <5> key.
k_up = vk_up; //replace vk_up with "ord('W')"
k_down = vk_down; //replace vk_down with "ord('S')"
k_right = vk_right; //replace vk_right with "ord('D')"
k_left = vk_left; //replace vk_left with "ord('A')"


//I just spaced this evenly for easier reading and found an error
if (instance_number(man) == 1 ){
if (MonsterFromManDistance >= (room_width div 4)){
if (keyboard_check_pressed(k_right) == true){
move_towards_point((man.x +(ManFromRightDistance div 2)) ,man.y,monster.speed);
} else if (keyboard_check_pressed(k_left) == true){
move_towards_point((ManFromLeftDistance div 2) ,man.y,monster.speed);
} else if (keyboard_check_pressed(k_up) == true){
move_towards_point(man.x,(ManFromTopDistance div 2),monster.speed);
} else if (keyboard_check_pressed(k_down) == true){
//in the following line, you had a space halfway through the variable ManFromBottomDistance
move_towards_point(man.x,(man.y+(ManFromBottomDist ance div 2)),monster.speed);
} else { move_towards_point(man.x,man.y,speed);}
} else {
move_towards_point(random(x),random(y),speed);
}
}

a gmk file with it in: http://realdev.co.za/egfiles/GMht1.gmk

Vexo
28-03-2008, 10:06 PM
@SkinkLizzard thanks allot man never really knew what masks where now i see how useful they are :)

@ edg3 thanks for the help! I didn't see that specific part in the help file about using letters . Sorry that there was no indentation to my code, don't know why i didn't do it, normally I do. I found that random space just forgot to update my post but i left the post because it still didnt work now i know it was because of the ord() values of the keys . This code still needs a bit of work but it is getting there. Thanks again

Squid
28-03-2008, 10:25 PM
This is kids stuff.

No need to be patronising. Take that attitude somewhere else, we make games here.

Chippit
28-03-2008, 10:52 PM
No need to be patronising. Take that attitude somewhere else, we make games here.
That is, when we're not throwing random references around. ;)

Squid
29-03-2008, 09:48 AM
That is, when we're not throwing random references around. ;)

Yes, well...

er... lets not derail another thread. Carry on.

Gazza_N
29-03-2008, 11:06 AM
This is kids stuff.
Then offer some advice, if you'd be so kind. We're here to help each other out, not mock the inexperienced.

Kensei
29-03-2008, 12:30 PM
Has anyone ever seen any good 3D physics egine for GM.
I have never found any on any forum or site and i have been around.
the best example of physics i saw was in basic 2d i was realy good. it even used The NTXCOOKING.DLL for hardware physics acceleration.

Unfortunately I have not seen any, sorry :(

@|-|1Pp13: I have not looked at the code - but I have been told I am good at asking stupid questions that sometimes contain a basic thing that the person overlooked - bare with me, m'kay?

If I don't make sense I will look at the code and then re-phrase the questions :P

How is the player created? Is each player an object in the room?
For testing purposes could you create a simple object to represent the player? Just to prove the section of code where the player is created in the room is working?

Erm, this might not be true for GM but do you need to create an instance of the object in the room for it to display?

luenardi
30-03-2008, 02:38 AM
Sorry my apologies, no offence ment... mabey i can help with some stuff?

i am really a very nice guy...

01DT!m3r
30-03-2008, 07:35 PM
can anyone help me with a horrible GM problem . in a game i want to post online soon .I noticed that when I change the room size my custom mouse cursor seems to get "blocked" by some invisible force while the actual windows cursor can move freely .does it have anything to do with resolution and how can I fix it ? thanks!WOAH! i just read the rest of this thread . . . Was there a flame war happening or something (might be a fire war I need to check on that :\)

Gazza_N
30-03-2008, 08:30 PM
No no no, far from a flame war. We just don't consider it tactful to post something like "this is kid's stuff" in a help thread established especially for newbies. But don't worry, no lifelong vendettas have been declared here, at least not from my side. Everything's good. :)

@01DT!m3r: How are you positioning your custom cursor? Are you using the mouse_x and mouse_y variables, or some other method? Also, are you changing the room size in-game, or while you're editing the room?

|-|1Pp13
30-03-2008, 08:58 PM
@|-|1Pp13: I have not looked at the code - but I have been told I am good at asking stupid questions that sometimes contain a basic thing that the person overlooked - bare with me, m'kay?

If I don't make sense I will look at the code and then re-phrase the questions :P

How is the player created? Is each player an object in the room?
For testing purposes could you create a simple object to represent the player? Just to prove the section of code where the player is created in the room is working?

Erm, this might not be true for GM but do you need to create an instance of the object in the room for it to display?

dont worry, im rebuilding it with an object that gives me all the multiplayer information, i used it in that one, everyone joined correctly, they didn't go to the room though, or get created, but they were definitly in the server

(PS if you want the object i can upload it, just merge it with your game, it displays info(ping, IP address etc) and can save it to a text file )



@01DT!m3r: How are you positioning your custom cursor? Are you using the mouse_x and mouse_y variables, or some other method? Also, are you changing the room size in-game, or while you're editing the room?

and by custom cursor you mean the function where you set the cursor as a sprite? or are you using an object that jumps to the mouse co-ordinates

if your doing the latter simply draw the sprite at mouse_x and mouse_y and leave out the jump bit

|-|1Pp13
30-03-2008, 09:12 PM
Sorry for the double post, but this is a completely different topic

heres the map saver, it'll save the contents of a map, it comes with comments and notes.
mapeditor.zip (http://www.filedropper.com/mapeditor)

mplaydebug.gmk (http://www.filedropper.com/mplaydebug)
sorry theres no comments.. lowest ping may return 0, my apologies

(Oldtimer wanted it :P)

Gazza_N
31-03-2008, 07:21 AM
01DT!m3r, are you sure that you're changing the room size (room_width, room_height), and not the viewport size (view_wport, view_hport)? Remember that resizing the viewport (ie, the resolution of your window) and resizing the room itself are two entirely different things. I think that's the most likely cause of your problem (and I've made that mistake before as well :p).

Vexo
31-03-2008, 08:39 AM
@01DT!m3r
I had a similar problem. The game works 100&#37; on my pc ( 19" LCD) but when i tested it on my friends pc ( 17" CTR) that same invisible wall seemed to apear.I have been making a few changes and havent tested it on his pc again but will try again when i get to

|-|1Pp13
31-03-2008, 01:09 PM
How woud you get a name from a colour code?

EG: 32768=Dark green

01DT!m3r
01-04-2008, 09:42 AM
01DT!m3r, are you sure that you're changing the room size (room_width, room_height), and not the viewport size (view_wport, view_hport)? Remember that resizing the viewport (ie, the resolution of your window) and resizing the room itself are two entirely different things. I think that's the most likely cause of your problem (and I've made that mistake before as well :p).

I am fiddling with both actually and in real time in the game.okay I am making a random room generator that adjusts the size of the room depending on what difficulty you have eg. a number
of objectives .and on certain numbers this thing happens.I will try to upload it soon.

@hippie thanks for the map thing it rocks:)

Gazza_N
01-04-2008, 12:08 PM
What I suspect is happening is that your room is being dimensioned to be smaller than your viewport. Because your custom cursor object can only exist in "room-space", and your room dimensions are smaller than your viewport dimensions, it simply hangs against an "invisible wall". The solution would be to ensure that your view dimensions match your room dimensions.

EDIT: My apologies. Just tried it out on my side, and everything was working perfectly. Looks like I'm wrong.

01DT!m3r
03-04-2008, 02:26 PM
Everytime i start up ultimate quest it crashes :( . Is there anything special it needs to run or how would i get it to work . I will post the error message soon .

dislekcia
03-04-2008, 02:59 PM
Everytime i start up ultimate quest it crashes :( . Is there anything special it needs to run or how would i get it to work . I will post the error message soon .

It needs the XNA redists AFAIK.

-D

01DT!m3r
03-04-2008, 03:03 PM
It needs the XNA redists AFAIK.

-D

THANKS DIS! But where do I get it?

Gazza_N
03-04-2008, 03:08 PM
Everyone loves Google (http://www.microsoft.com/downloads/details.aspx?familyid=15FB9169-4A25-4DCA-BF40-9C497568F102&displaylang=en). ;) One XNA redist version 2 link, with fries.

01DT!m3r
03-04-2008, 03:09 PM
Everyone loves Google (http://www.microsoft.com/downloads/details.aspx?familyid=15FB9169-4A25-4DCA-BF40-9C497568F102&displaylang=en). ;) One XNA redist version 2 link, with fries.

Thanks Gazza!:)

AWWWW ! It still doesnt work.

dislekcia
03-04-2008, 03:46 PM
I think UQ was done in XNA version 1. Give us the error message, it might be that you're missing the .NET libraries or something...

-D

Chippit
03-04-2008, 03:48 PM
Yeah, that's not the right redist.

You want this one:
http://www.microsoft.com/downloads/details.aspx?familyid=A7DA4763-6807-4BD5-8D18-18C60C437F93&displaylang=en

Gazza_N
03-04-2008, 03:58 PM
Ah, apologies. I saw version 2 and assumed backward compatibility. Bad Gazza!

01DT!m3r
03-04-2008, 04:18 PM
Yeah, that's not the right redist.

You want this one:
http://www.microsoft.com/downloads/details.aspx?familyid=A7DA4763-6807-4BD5-8D18-18C60C437F93&displaylang=en

thanks chippit let me see if it works
@DIS: its a normal don't send microsfot error.
It works .YAY!! thanks guys

ShadowMaster
07-04-2008, 11:52 PM
How do you check if the current object(ie the one you are in code wise) is obstructed at some point (x2, y2)?

Thanks in advance.

dislekcia
08-04-2008, 04:06 AM
How do you check if the current object(ie the one you are in code wise) is obstructed at some point (x2, y2)?

Thanks in advance.



place_free(x,y) Returns whether the instance placed at position(x,y) is collision-free. This is typically used as a check before actually moving to the new position.
place_empty(x,y) Returns whether the instance placed at position (x,y) meets nobody. So this function takes also non-solid instances into account.
place_meeting(x,y,obj) Returns whether the instance placed at position (x,y) meets obj. obj can be an object in which case the function returns true is some instance of that object is met. It can also be an instance id, the special word all meaning an instance of any object, or the special word other.
position_meeting(x,y,obj) Returns whether at position (x,y) there is an instance obj. obj can be an object, an instance id, or the keywords self, other, or all.


I tend to use place_meeting and position_meeting the most...

-D

DragonR
11-04-2008, 03:05 PM
Yo I really think this forum should have sub folders cause I am always 2 lazy 2 shearch 12 pages 2 see if the thread already exist

ps. I wanna make a game development team I have a over creative emagination and want 2 see what it brings 2 this polygon driven indestry

Kensei
11-04-2008, 03:14 PM
ps. I wanna make a game development team I have a over creative emagination and want 2 see what it brings 2 this polygon driven indestry

Start simply, DragonR - Propose your game ideas in a thread (like others have done) - title it Game Idea: <idea name here>
And discuss it with the game.dev people.

Alternatively, learn Game Maker and start creating your games in that ;)

::gets off her soap box and offers it to dislekcia::

DragonR
11-04-2008, 03:31 PM
No this dream is a dream that want to lossen the grip of the companies produsing games To see the futer and 2 encouredge more and more people 2 see that a great game isnt made in in a computer but by the mind and creativety of people thats its just a mater of getting the right tools a useing it right

Besides I cant make a thread says sumthing of me having unotherized sumthing LOL +-)

So fr0m here on I am making the FreedomGamersCo.

Co=Co-operation

|-|1Pp13
11-04-2008, 05:05 PM
No this dream is a dream that want to lossen the grip of the companies produsing games To see the futer and 2 encouredge more and more people 2 see that a great game isnt made in in a computer but by the mind and creativety of people thats its just a mater of getting the right tools a useing it right

Besides I cant make a thread says sumthing of me having unotherized sumthing LOL +-)

So fr0m here on I am making the FreedomGamersCo.

Co=Co-operation

okay mr junior member, spelling is important (see bold examples :p)

Do you have any game making experience? Ever worked in a team before? Small/large? or would you rather feed the ideas in and watch the team make them?

DragonR
11-04-2008, 08:42 PM
I wanted 2 make games since I was 5 just watching at the microsoft screensaver of that maze u know

I am 15 have almost no game dev skills

But I'll give the ideas

ps. whats wrong with my spelling Im Afrikaans so u can be happy if its this good LOL

Obi Two Kenobi
11-04-2008, 08:59 PM
Hey guys. I'm creating a top-down shooting game in which the character shoots a pistol. Now I have no idea how to make him reload the clip after a few shots.

Note: there is no need for the character to pick up ammo, it's unlimited.

|-|1Pp13
11-04-2008, 09:14 PM
Hey guys. I'm creating a top-down shooting game in which the character shoots a pistol. Now I have no idea how to make him reload the clip after a few shots.

Note: there is no need for the character to pick up ammo, it's unlimited.

weeell the way id do it is have a variable that counts down every time a bullet is created, if the variable=0 then set a timer (while the character reloads), when the timer expires reset the variable

hope that helps, im not the best at explaining =/

DragonR
11-04-2008, 09:24 PM
Umm can I post pics here?

They are my idea feeds?

The reason I am asking this has to do with the fact that I got 2 warnings today OUCH

ps. This is not off-topic this is to do with Game.dev

Ok thanks in advanced

Obi Two Kenobi
12-04-2008, 10:13 AM
@|-|1Pp13 - Thanks, I hope that works :D

Obi Two Kenobi
13-04-2008, 02:20 PM
Hope someone can help me again. In the top-down game I'm creating, the character I'm controlling is the first room, I then let him go to the next room by touching an object. When he enters the next room, he's like under the background but I can still move him around.

I tried changing the depth and persistent values but no luck.

Any ideas?

Kensei
13-04-2008, 02:44 PM
Hope someone can help me again. In the top-down game I'm creating, the character I'm controlling is the first room, I then let him go to the next room by touching an object. When he enters the next room, he's like under the background but I can still move him around.

I tried changing the depth and persistent values but no luck.

Any ideas?

Check that you have the depth values correct... smaller values are drawn on top of those with larger values.

e.g. Object A with a depth of 5 will be on top of Object B that has a depth of 10

Edit: I mean check the depth of both the background (can't remember if this is possible :/) and the actual object

dislekcia
13-04-2008, 04:23 PM
Yeah, chances are that the depths are misunderstood ;) Higher depths are "deeper" into the screen.

-D

DragonR
14-04-2008, 05:25 PM
No the lower depths are deeper

ps. are you using GameFactory or GameMaker?

edg3
14-04-2008, 05:38 PM
GameMaker

And

A higher value in the depth means deeper which means underneath. thats what this means:

Higher depths are "deeper" into the screen.

Anilihst
14-04-2008, 05:42 PM
Please help me with the following code:

sString = get_string('type','hallo,hi');
iCount = string_count(',',sString);
for (iLoop = 0; iLoop < iCount; iLoop += 1;) {
iPos = string_pos(sString,'l');
show_message(string_copy(sString,0,iPos));
sString = string_delete(sString,0,iPos+1);
}

For some reason the pos function always returns 0. What am I doing wrong?

dislekcia
14-04-2008, 06:00 PM
Please help me with the following code:

sString = get_string('type','hallo,hi');
iCount = string_count(',',sString);
for (iLoop = 0; iLoop < iCount; iLoop += 1;) {
iPos = string_pos(sString,'l');
show_message(string_copy(sString,0,iPos));
sString = string_delete(sString,0,iPos+1);
}

For some reason the pos function always returns 0. What am I doing wrong?

string_pos() is returning 0 because the substring you're looking for ('l') isn't in sString. I think you meant to look for ',' instead...

-D

Anilihst
14-04-2008, 06:17 PM
lol sorry Dis yeah I was looking for ',' but still it should have found the 'l' , and I only changed it to the 'l' later because it did not work. btw it is still not working.

this is the new code:

sString = get_string('type','hallo,hi');
show_message(sString);
iCount = string_count(',',sString);
show_message(string(iCount));
for (iLoop = 0; iLoop < iCount; iLoop += 1;) {
iPos = string_pos(sString,',');
show_message(string(iPos));
show_message(string_copy(sString,0,iPos));
sString = string_delete(sString,0,iPos+1);
}

just to see what is happening

dislekcia
14-04-2008, 08:05 PM
You're using string_pos() the wrong way around ;)

string_pos(substr,str)

-D

Aval4nche
14-04-2008, 08:13 PM
How would you go about implementing procedural generation in Game Maker. I want to create random maps for a turn based strategy game I am making.

Gazza_N
14-04-2008, 08:33 PM
What I've always done (in, like, the two dirt-simple generators I've written so far :p) is placed my generation code in the Create event of an invisible "Level" object that spawns immediately when the level room loads. For multi-pass generators, you'd make use of timers or a routine in the Step event.

If you're looking for info on writing the generation code itself, that's not so simple. Implementations will vary depending on how your levels are put together and what rules you want to govern the generator. In that regard, you'll implement procedural generation in GM the same way you'd implement procedural generation in any other programming language. :P

Anilihst
14-04-2008, 09:18 PM
thx Dis I'm feeling very stupid now.

|-|1Pp13
14-04-2008, 09:18 PM
If you're looking for info on writing the generation code itself, that's not so simple. Implementations will vary depending on how your levels are put together and what rules you want to govern the generator. In that regard, you'll implement procedural generation in GM the same way you'd implement procedural generation in any other programming language. :P

and if we dont know how to do it in any other language? =P

Gazza_N
14-04-2008, 09:38 PM
and if we dont know how to do it in any other language? =P
Then I haven't been very helpful, have I? :P

The simplest way I can think of would be to randomly splatter "seed" objects across the map that iteratively expand into forests, lakes, mountains, or whatever else you need according to the size/ shape limits you specify. Then based on that terrain, you can place resources and spawn points for players, making sure that they're correctly placed according to more rules (minimum distance from other resources, minimum distance to other players, etc). Alternately, you could just build a huge library of lake, mountain and terrain objects and randomly select and scatter them across the map. In either case, GM's got loads of functions to help you run the checks necessary to do this. Of course, I'm making a whole bunch of assumptions as to how you want your levels to look and play, but that should give you an idea of how to go about it.

Of course, dislekcia will probably pop in later tonight and provide an infinitely better method, but I can try, can't I? ;)

dislekcia
14-04-2008, 10:44 PM
thx Dis I'm feeling very stupid now.

No worries! Happens to all of us ;)

-D

dislekcia
14-04-2008, 11:01 PM
Of course, dislekcia will probably pop in later tonight and provide an infinitely better method, but I can try, can't I? ;)

Hahahaha! Like I'm going to swoop in and cover procedurally generating a terrain with some magic algorithm in 5 lines or less ;)

You've got it pretty much nailed, having implemented a few yourself... I think the most important part is understanding the nature of what it is that you're trying to generate, being aware of the patterns that matter to your gameplay and finding sneaky/clever/cheated ways to reproduce those.

For instance, if you're making a platformer, it doesn't help to simulate rainfall so that you can get realistic tree-growth, that's just too much fidelity. What would be more important is knowing how the player can move around the platforms so that you can ensure that some platforms aren't unreachable.

There are two main approaches to procedural generation, top down and bottom up. What Gazza wrote about is more of a bottom-up approach: Where you start at the lowest level of your final generated content (trees, mountains, etc) and then work those out according to rules to populate the whole playing field. A bottom up implementation tends to need a lot of checking and backtracking to prevent the world getting into states where it won't be fun for the player.

A top down approach goes in the other direction: Starting out at the largest level of your content and then drilling down with each iteration until the small details are put into place. Each iteration has rules and patterns that ensure it generates a world/system that's fun for the player. You might start with grid that you randomly populate with height information, then break that down into 10 squares per grid and decide on terrain types according to height (foliage, mountain, plain), then you could do a water-content pass on those squares, giving you river maps and allowing you to decide what kind of foliage would exist/what type of plain/if there's snow on the mountains, etc.

The big key to procedural generation is working with the right pieces and working your random in at a far enough abstraction that it doesn't confuse the player... A random ship generator that I built worked on a simple idea: Most spaceships could be broken down into a core polyhedron; If you then do random things to the outside edges of that polyhedron, you get a randomly designed ship-shape; The best part is that if you use similar parameters for the random things (distance to extrude, likelyhood of sideways movement, cone vs box, number of iterations) you end up with ships that are differently designed but "look" similar enough to have come from the same alien race in the game ;)

-D

Aval4nche
15-04-2008, 05:08 PM
Thanks guys, I'll play around with your advice and see what I come up with

edg3
15-04-2008, 05:54 PM
I wrote a simple piece of code that generates my random levels in Pea Adventures. Its quite messy and dirt simple, but it works if you have one collision object:

Notes:
replace 71 and 50 under the comment //decide on number of pixels tall and wide with your wall/block object's size
replace o_block with the name of your wall/block
you can completely remove the code after //create the damned pea as it doesnt apply here.
you can remove code after //create spawners as it doesnt apply either.
el = elevation (how high the game can create the next platform from the first one)
start_p and end_p are the start and end positions of the shelf.
difficulty affects the number of shelves and spawners

//arg0 = difficulty
difficulty = argument0;

//decide on number of pixels tall and wide
rm_w = room_width div 71;
rm_h = room_height div 50;

//top border and bottom border
for (i = 0; i < rm_w; i += 1) {
instance_create(i*71,0,o_block);
instance_create(i*71,(rm_h - 1)*50,o_block);
}

//left and right border
for (i = 1; i < rm_h - 1; i += 1) {
instance_create(0,i*50,o_block);
instance_create((rm_w - 1)*71,i*50,o_block);
}

//create shelves
start_p = 0;
end_p = 0;
level = 1;
num_shelf = round(random(rm_h div 3) + difficulty);
for (i = 1; i < num_shelf; i += 1) {
length = random(rm_w/2);
if (length < 4) { length = 4 }
el = round(random(1) + 1);
start_p = round(random(rm_w - length));
end_p = start_p + length;
//create the objects of the shelf
for (j = start_p; j < end_p; j += 1;) {
instance_create(j*71,(rm_h - level - el)*50,o_block);
}
//adjust out level
level = level + el;
}

//create spawners
//num_spawn = round(difficulty * 0.5);
//for (i = 0; i < num_spawn; i += 1) {
// _x = 71*round((random(rm_w - 2) + 1));
// _y = 50*round((random(5) + 1));
// while (collision_point(_x+1,_y+1,o_block,true,true)) or (collision_point(_x+1,_y-1,o_block,true,true)) {
// _x = 71*round((random(rm_w - 2) + 1));
// _y = 50*round((random(5) + 1));
// }
// instance_create(_x,_y,o_spawn);
//}

//create the damned pea
//_x = room_width/2;
//_y = room_height/2;
//while (collision_circle(_x,_y,30,o_block,true,true)) {
// _y -= 15;
//}
//instance_create(_x,_y,o_pea);

//run the last final script of completeing the level
//last lines removed, they do not apply for this post

And now for the reason why I didnt remove what doesnt apply completely: I was hoping peoples could help with any suggestions to add more variation and interesting patterns to this script?

ShadowMaster
16-04-2008, 03:36 PM
How do you use quotation marks in strings in GML?

cause "this, \", is a quotation mark" doesn't work.

Thanks in advance.

FuzzYspo0N
16-04-2008, 05:03 PM
my guess is it wud be /" not \"

Chippit
16-04-2008, 05:16 PM
I'd try doubling the quotes like in Pascal. "" for quotation marks in strings, in other words.

dislekcia
16-04-2008, 05:18 PM
How do you use quotation marks in strings in GML?

cause "this, \", is a quotation mark" doesn't work.

Thanks in advance.

AFAIK GM doesn't have an escape character. The trick is to simply add the quotation mark into the string in a way that doesn't confuse the compiler, like so:

myString = "this, " + '"' + " is a quotation mark";

Or you could use the chr() command if you know the ASCII value of " :)

Edit: FYI, that's not a double quotation mark up there, it's a single, then the double, then another single (' " '). That's how GM denotes single chars.

-D