Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411469 Posts in 69368 Topics- by 58422 Members - Latest Member: daffodil_dev

April 23, 2024, 06:26:14 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Game Maker For Beginners: Part I
Pages: 1 ... 7 8 [9] 10 11
Print
Author Topic: Game Maker For Beginners: Part I  (Read 327257 times)
Skofo
Level 10
*****



View Profile
« Reply #160 on: November 11, 2008, 02:32:11 AM »

It's not about which *language* is harder. Coding in C++ is no more difficult than coding in GML. It's what Game Maker *includes* that makes making games faster and easier in it: all kinds of systems are included.

As an example, let's say you wanted to make a 2D top-down RPG. In C++, you'd have to code the entire tiling engine from scratch. In GM, it already had a perfectly functional tiling engine, so you don't have to code it. If you coded a tiling engine in GML it'd be just as hard as coding it in C++, but the point is that if GM's tiling engine works fine, you don't need to spend 2 months coding the tiling engine (and more months for all the other things you'd need) before you could get to work on the game.

So don't think of it in terms of the difficulty of the languages, think of it in terms of whether you really want to code all that low-level stuff from scratch, perhaps spending a year coding before you get to the actual coding of the game itself and its gameplay, or do you not mind usable but less customizable pre-made low-level stuff.
I dunno, languages can sometimes simply have different relavent difficulties. C++ has a lot of signs and rules and classes that do not exist in GML (or a lot of other languages). Also, I cannot even remember how many times I've been stuck on an error in a non-GML language because I used = instead of == to compare (= makes perfect sense, dammit!). Okay, it really does not. BUT IT SHOULD, DAMMIT!
Logged

If you wish to make a video game from scratch, you must first invent the universe.
ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #161 on: November 11, 2008, 02:40:45 AM »

I dunno, languages can sometimes simply have different relavent difficulties. C++ has a lot of signs and rules and classes that do not exist in GML (or a lot of other languages). Also, I cannot even remember how many times I've been stuck on an error in a non-GML language because I used = instead of == to compare (= makes perfect sense, dammit!). Okay, it really does not. BUT IT SHOULD, DAMMIT!

Sure, but GML has a lot of them that C++ doesn't have either, for example the brilliant with() construction. Also, GML does have classes of sorts; every object is technically its own class. You can't assign scripts to particular objects the way you assign functions to classes in C++, but practically speaking a class in C++ *is* an object in GML. Objects don't have to be physical game entities, you can use objects for anything, even data types. And in GML, you can use either = or == in conditionals, it accepts both, which I think is actually a bad idea because it encourages coding that wouldn't work in C++, but you can use either one in GML.
Logged

Skofo
Level 10
*****



View Profile
« Reply #162 on: November 11, 2008, 03:01:12 AM »

I dunno, languages can sometimes simply have different relavent difficulties. C++ has a lot of signs and rules and classes that do not exist in GML (or a lot of other languages). Also, I cannot even remember how many times I've been stuck on an error in a non-GML language because I used = instead of == to compare (= makes perfect sense, dammit!). Okay, it really does not. BUT IT SHOULD, DAMMIT!

Sure, but GML has a lot of them that C++ doesn't have either, for example the brilliant with() construction. Also, GML does have classes of sorts; every object is technically its own class. You can't assign scripts to particular objects the way you assign functions to classes in C++, but practically speaking a class in C++ *is* an object in GML. Objects don't have to be physical game entities, you can use objects for anything, even data types. And in GML, you can use either = or == in conditionals, it accepts both, which I think is actually a bad idea because it encourages coding that wouldn't work in C++, but you can use either one in GML.

I realize that objects are sort of like classes, but I mentioned that C++ is harder than GML because of classes because GML doesn't have to program them like C++ does. And I do know that you can use either = or == in GML, that is what I said. Also, with() isn't an oft required construction.

I'm sorry, I should have made a bigger point out of all of the signs and rules that C++ has and GML does not. GML is easier because it has looser rules (which I think is bad programming practice, but it is easier). GML does not require you to do and call all the things that C++ requires you to do and call, and GML does a lot of that stuff for you in the background. I know that the general difficulty of programming languages is arbitrary and cannot be measured, but I really think that it's wrong to say that they're the exact same difficulty, or that C++ is generally less hard to learn and program in than GML. I don't think that many people would disagree that GML is easier and faster to learn and program in than in C++ for most people, especially among new programmers.
Logged

If you wish to make a video game from scratch, you must first invent the universe.
ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #163 on: November 11, 2008, 03:09:18 AM »

I actually use with() quite a bit, and nestled with()'s very often. I probably use it hundreds of times in Immortal Defense. It's quite useful and I think even most people who regularly use GML underestimate how useful it is.

I also am not sure "more complex" necessarily means "harder". Is Calculus more complex than Trigonometry? Yes, but is it harder? That's not as easy to discern. I had a lot more difficulty learning Trig than learning Calculus, even though it's less complex. I didn't mean that it was the exact same difficulty, just that it's not as simple as saying one is harder than the other. I've used a variety of languages and I find no real difference in difficulty between any of them (except for assembly, which is ridiculously hard, almost unusable).

Also, what in particular do you mean by "signs"? Offhand I can't think of any "signs" that C++ has that GML does not, except for the pointer asterisk. And, as I said earlier, memorization of functions and signs and all that is a very easy part of programming, compared to figuring out algorithms and such.
Logged

increpare
Guest
« Reply #164 on: November 11, 2008, 04:13:38 AM »

Could you explain what 'with()' does or link to somewhere that does?  I'm quite curious, and can't find any description on the web (or, indeed, in the game-maker manual  Roll Eyes ).
Logged
ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #165 on: November 11, 2008, 04:27:58 AM »

It lets you execute code *as if* you're in a class of objects (or parent class) from inside other objects. That sounds simple, but it leads to a lot of nice uses.

As a simple use for it, imagine you want to draw reflections of every object in the game on the water, the way I do in Saturated Dreamers here:



But you don't want each object to draw its own reflection, because you want them all on the water, on the same layer.

So what you could do is, in the water object's draw event, do

with(obj_map)
{
   (code to draw the reflection)
}

'obj_map' there would be a parent object of all objects that you want to reflect. Now that might not seem like much, because you can accomplish the same thing in other ways in C++, such as having an array of every object, but it's the simplest way to accomplish it in GML.

There are more sophisticated uses of it of course, but I wanted to show an easy example. You can use the word "other" within the code to refer back to the object that created the with() construction, so for instance if you want to draw a line between an object and every other object, you could do

with(obj_map) draw_line(x, y, other.x, other.y);

You can also nestle them, which is occasionally useful. I can't think of any clear examples to explain that right now, but that's because I'm tired; but I've used nestled with()'s many times.

You can even backtrack and do with(other) to create a section of code within that section of code which refers to the original object.

You can also use with() for individual instances rather than types of object, if you use the instance id rather than the object id.

An interesting thing is that using with() statements is kind of analogous to calling functions for classes in C++, because the code is called from that particular GM object. Though I think with() is even more flexible.
« Last Edit: November 11, 2008, 04:38:15 AM by rinkuhero » Logged

increpare
Guest
« Reply #166 on: November 11, 2008, 05:16:02 AM »

ah okay, so it acts like a for-loop running through one's array of entities, and to use their member-variables without having to prefix them with "entityarray[ i ].".  (though in C++ you'd probably be better off making 'draw_reflection' a member function of entity).  Anyway.  yep, I can see the niceness of that.

cheers.
« Last Edit: November 11, 2008, 05:19:11 AM by increpare » Logged
Corpus
Guest
« Reply #167 on: November 11, 2008, 08:34:59 AM »

As I discovered to my horror and mild frustration at the jam, GML has no means of defining initialiser lists for arrays.

WHAT IS UP WITH THAT
Logged
ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #168 on: November 11, 2008, 09:46:29 AM »

You can probably code your own method for initiailizing arrays, something like:

init_1Darray(arrayname, value1, value2, value3, value4, ...);

But GM's arrays are horrible in general: you can only have double arrays, and you can't use array indexes more than 32000 (and if you use a double array, the two array indexes combined can't exceed 32000). Its arrays are also very slow. Yes, using arrays can slow down your game, especially if you use them in long loops. Its data structures are much better in pretty much every way, so you can just use a data structure for an array.

People familiar with GM quickly learn a few things about it: never use execute_string(), never stretch the game to full screen, never use the GM's built-in sound functions for anything (use a dll), and never use arrays.
Logged

Pishtaco
Level 10
*****


View Profile WWW
« Reply #169 on: November 11, 2008, 11:12:07 PM »

People familiar with GM quickly learn a few things about it: never use execute_string(), never stretch the game to full screen, never use the GM's built-in sound functions for anything (use a dll), and never use arrays.
Thanks for the helpful posts. What do you mean about full screen - I found that pressing f4 in game to switch to full-screen seems to work fine - and what's wrong with the sound functions and a good dll to use instead? And, if you do use arrays, is there a way to initialize their size? I couldn't work this out from the manual.
Logged

Mir@k
Level 1
*


Pffffffft


View Profile WWW
« Reply #170 on: November 11, 2008, 11:23:13 PM »

I'd like to hear reccomendations for said .dll's. :|
Logged

Skofo
Level 10
*****



View Profile
« Reply #171 on: November 12, 2008, 06:07:39 AM »

People familiar with GM quickly learn a few things about it: never use execute_string(), never stretch the game to full screen, never use the GM's built-in sound functions for anything (use a dll), and never use arrays.
Thanks for the helpful posts. What do you mean about full screen - I found that pressing f4 in game to switch to full-screen seems to work fine - and what's wrong with the sound functions and a good dll to use instead? And, if you do use arrays, is there a way to initialize their size? I couldn't work this out from the manual.

Resizing to full screen in Game Maker is usually pretty ugly. Game Maker decides to assblur everything.

Also, I don't know what rinku means about the sound, I've never had any problems. I guess he means this? If there's anything in Game Maker that you shouldn't use, it's its built-in multiplayer functionality. Absolutely horrible.
Logged

If you wish to make a video game from scratch, you must first invent the universe.
ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #172 on: November 12, 2008, 11:20:51 AM »

Skofo is right about the full screen stretching mode. Either switch the resolution to a dedicated resolution or use windowed mode, never stretch to full screen mode. Not only does it make it terribly blurry, but it also reduces the fps and slows the game drastically. They really should not include that option in GM, and if I were Overmars I'd remove it immediately, since as a result of it most GM games look horribly blurry and it gives a bad impression of GM for people who play those games. Even some of the "100 GM games in 10 minutes" games used that stretching thing, although thankfully most didn't.

As for the sound engine, use fmod, bass, or supersound dll's. Any works fine. GM's own sound ability is severely lacking:

- there are huge delays between when you tell a sound to play and when it plays, due to it uses windows media player as its output
- when playing midi's, there's often a horrible scratchy sound that you get
- when playing mp3's, it re-loads the mp3 each time it loops, causing a delay in the looping rather than a smooth loop
- it can't play mod's, ogg's, or any other format other than wav, midi, and mp3, which are (except for wav) not formats you should ever use in a polished game
Logged

Pishtaco
Level 10
*****


View Profile WWW
« Reply #173 on: November 13, 2008, 11:39:17 PM »

Skofo is right about the full screen stretching mode. Either switch the resolution to a dedicated resolution or use windowed mode, never stretch to full screen mode. Not only does it make it terribly blurry, but it also reduces the fps and slows the game drastically. They really should not include that option in GM, and if I were Overmars I'd remove it immediately, since as a result of it most GM games look horribly blurry and it gives a bad impression of GM for people who play those games. Even some of the "100 GM games in 10 minutes" games used that stretching thing, although thankfully most didn't.

As for the sound engine, use fmod, bass, or supersound dll's. Any works fine. GM's own sound ability is severely lacking:

- there are huge delays between when you tell a sound to play and when it plays, due to it uses windows media player as its output
- when playing midi's, there's often a horrible scratchy sound that you get
- when playing mp3's, it re-loads the mp3 each time it loops, causing a delay in the looping rather than a smooth loop
- it can't play mod's, ogg's, or any other format other than wav, midi, and mp3, which are (except for wav) not formats you should ever use in a polished game
Thanks! I've been playing games that are deliberately a bit blurry, so that hasn't registered as a problem yet. I'm interested in the sound problems, because the game I'm hoping to find time for for the competition needs carefully timed sounds. But these will be small .wavs, so does this delay problem still turn up there? I thought that gamemaker only used the media player for things like mp3s.
Logged

ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #174 on: November 13, 2008, 11:42:40 PM »

Personally I don't trust it enough to even use it for wav's, but do your own experiments and be your own judge, I'd say. Using a dll is fairly simple, so I don't see any real reason not to use one, unless you just never used a dll before or something.
Logged

GregWS
Level 10
*****


a module, repeatable in any direction and rotation


View Profile
« Reply #175 on: November 14, 2008, 09:06:08 PM »

So rinku, would you mind throwing together a crash course "dlls in GM" tutorial in the Tutorials forum?  That would rock!  Grin

(The alternative being lots of time spent in the help file, and I'm getting really sick of that as a primary method of learning the higher functions of GM.)
Logged
ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #176 on: November 14, 2008, 09:15:54 PM »

It's not really lengthy enough to even require a tutorial; I can explain it all in one paragraph.

Here's an example, using supersound.dll. Download. Extract all files in a folder. If you're using GM7, open the .gmd file in Game Maker (you may need to select "load older Game Maker files" in the file menu, since that one's saved in an older version of GM). Run it and test it out to make sure it works. Look at the scripts if you like. Save the game, just to have it in the newer format for newer versions of GM. Load your own game. Choose "merge game" and merge the two games together. You can now use the functions from SuperSound dll, as long as that .dll is in your game's directory. Each function's name is self-explanatory (and usually has comments explaining how to use it) and works just like a normal GML function, it's basically like adding a new set of GML functions to your game.
Logged

GregWS
Level 10
*****


a module, repeatable in any direction and rotation


View Profile
« Reply #177 on: November 14, 2008, 09:23:13 PM »

Thanks rinku!  I'm going to need to use one for sound in my sketched shmup, probably to play mods.  I'm thinking of recording some samples of me sketching lines (eg. a straight line, a curvy line, a circle) and then using these samples to make some music (or begging someone on TIGS to make music for me; wouldn't do that until I have a playable game I'm happy with to though).
Logged
Tanner
Level 10
*****


MMPHM *GULP*


View Profile WWW
« Reply #178 on: November 15, 2008, 11:14:07 PM »

there's a pxtone dll somewhere.
you should use that.
pxtone needs some lovin'.
Logged

GregWS
Level 10
*****


a module, repeatable in any direction and rotation


View Profile
« Reply #179 on: November 16, 2008, 09:51:44 PM »

I'd thought of that actually; I've messed around with PXTone a little bit, and it seemed pretty good.  That's what YMM now uses unless I'm mistaken.
Logged
Pages: 1 ... 7 8 [9] 10 11
Print
Jump to:  

Theme orange-lt created by panic