don't click here

GML vs. C++

Discussion in 'Technical Discussion' started by RetroKoH, Mar 29, 2013.

  1. RetroKoH

    RetroKoH

    Member
    1,662
    22
    18
    Project Sonic 8x16
    Pretty much complications with Triad are the reason why I am asking the question. Triad can run well enough on Game Maker, and I think that one of the things that makes Triad stand out is that its a multi-purpose editor (which in its final form WILL be Open Source) written in GML.

    However, I find GM to be primitive and restricting in some respects. One glaring example is its capabilities with using .DLLs. These problems tend to hold back Triad's capabilities a little bit. I've recently picked up a free copy of the new GM: Studio MIPS and tried porting everything to Studio, ONLY to find myself with MORE problems... and this is the permanent direction they are going in with Game Maker. So... seeing as how I'm not liking Game Maker Studio (and am NOT paying hundreds of dollars to upgrade it...) Should I stick with using GameMaker 8.1 for Triad? (And other projects???) Or should I make the heavily considered jump to C++?

    I have almost 11 years of experience with using GML, and know it very well, and there are some similarities with C++... and I feel very confident I can pick up and learn C++ without too much trouble...
    What does the community think? (I can only imagine that I will get a shitstream of GML sucks... so lets try to give productive, well thought out answers, with concrete reasoning, shall we?)
     
  2. winterhell

    winterhell

    Member
    1,165
    7
    18
    First I'm going to say that I haven't used GML. However I've heard that in order to save render time on objects that are outside the screen you have to constantly destroy them and create them. I've seen some horrors with the Dash Engine in higher resolutions like 720p where the fps was literally a 5th of what you'd have if you are normally sending sprite calls with a "real" language like C++. That was on GeForce 8400GS and Radeon 4350 so it might not be an issue if the video card is stronger like 9600GT or having an SD resolution. Now, the problem might be with the programmers behind the game, but I've seen lower fps on other non-Sonc 720p games..
    Also the texture loading takes forever(20 times slower than XNA/C#(single threaded) in the case I was comparing with). Probably Mercury would be able to tell you more if and how you can speed up those things.

    As for C++, its great. You'll have to pick up a framework or an API with which to do the rendering, like Allegro/SDL or DirectX/OpenGL.

    Bottom line- if you feel restricted by GML itself or the fact Game Maker is hiding things from you like the game loop, move away. Performance reasons would probably be overrated unless you are targeting really old hardware.

    Edit: I'd suggest that you try making a simple game in C++ like Pong and render the paddles as sprites. It may take you like an hour or less but you'll be able to decide much easily if C++ is for you.
     
  3. Black Squirrel

    Black Squirrel

    no reverse gear Wiki Sysop
    8,543
    2,465
    93
    Northumberland, UK
    steamboat wiki
    Don't underestimate the amount of stuff Game Maker will be doing for you - stuff you'll have to implement from scratch in C++.

    I don't really know what 11 years of GML experience looks like so I couldn't really tell you if the jump will be easy, but there'll be lots of things to read up on, such as static/strong typing, passing by value/reference/pointer, garbage collection, fun times with classes, finding and working with APIs etc.


    I've been working with Python recently (which I imagine, along with Pygame, isn't too dissimilar from GML (ignoring the differing ideas on syntax)) - scripting languages like these are a dramatic simplification of what you'd need to do in C++ to achieve similar results (or even things like Java/C#). You'll probably find yourself re-learning things and it would be foolish to assume this stuff will be cracked instantly... but the rewards can be significant
     
  4. Metal Man88

    Metal Man88

    Time Traveller Oldbie
    2,137
    0
    0
    Use Python to learn, C++ to implement final product. C++ can completely mop the floor with GML, but requires so much more knowledge that unless you're in it all the way, you'll never get anywhere.

    Indeed. It can take many years before you can learn the ins and outs of building a software application. If this sounds too daunting to you... stick with GML.
     
  5. stormislandgal

    stormislandgal

    It's not a phase! Tech Member
    4,534
    10
    18
    Married life <3
    Not really, you just need to pull a few rabbits out of the hat in order to save on processing power.

    I was trying to create a Terraria-esque 2D sandbox kinda thing, where each block was individually drawn. When I had more than one 128x128 chunk (built from 16x16 tiles) on screen, my framerate crashed using GML's default rendering methods. So a friend of mine pulled a rabbit out of the hat and cooked up some very weird rendering method that blanked the screen and redrew the chunk every time it was updated rather than every frame. FPS went from 3 to the 60 cap I had set.

    As far as switching to C++... I can't really offer that advice. I've tried C++ but couldn't get anywhere with it aside from a trip to the hospital when I banged my head on my desk in frustration. GML can teach you the basics of C++ code structure, but... ugh, C++ feels so needlessly complex compared to GML.

    Keep going with GML, I'd say, since you've already got it established. If you run into a brick wall, think and think hard about what weird tricks you can use to get around that wall. You'd be surprised what a little ingenuity can do with such a limited engine.
     
  6. GerbilSoft

    GerbilSoft

    RickRotate'd. Administrator
    2,971
    76
    28
    USA
    rom-properties
    For GUI-based applications in C++, I highly recommend the Qt toolkit: http://qt-project.org/

    It's cross-platform and has lots of nice functionality, including signals/slots, QActions, the Qt Designer for designing windows, and other stuff. I'm currently still using Qt 4.8, but will probably be trying out Qt 5.x sometime in the near future.

    EDIT: Not just C++ - There's Qt bindings for Java, Lisp, Lua, Perl, PHP, Python, Ruby, and other languages.
     
  7. Harmony Friends

    Harmony Friends

    it's the whole gang Oldbie
    I actually have an exactly pertinent scenario. About a year and a half ago, after several years of using Game Maker entirely for making games, I've gone full-on C++.

    I'll be honest, it's been a rough road. While initial progress was surprisingly quick, my lack of experience with C++ made me make a horrible nightmare polyglot of a codebase because I didn't know how to organize C++ code, I didn't know good C++ practices, I didn't know how to take advantage of the C++ features (classes, pointers, STL... the list goes on)... and I've had to basically drop it all and re-code from scratch.

    Now, I probably wouldn't have learned anything otherwise, and the performance issues and other things wrong with Game Maker mean that as someone trying to produce a relatively professional video game that is not freeware that it's really not a good idea, despite what they'd like to have you think with the GM:Studio stuff.

    I'm just saying if you make the decision to start trying to make a game in C++, know that you're going to spend a large chunk of time at first being not so productive. And remember, you have to basically do EVERYTHING from scratch. It's daunting, for good reason, even with 11 years of GML experience. The syntax is the easy part, that's what prior programming/scripting experience is good for. But actually using it productively is another beast. Take learning C++ very seriously, if you go that route.

    But it's rewarding when you get it right. Unlike GM:Studio, what you make in C++ is YOUR engine. You can fucking do whatever with it! I don't need to pay $100 for a proprietary Ubuntu exporter, I can compile directly to Linux. In a month's time or so, I'll have one codebase that compiles to 5 platforms at once, without any of GM:S's proprietary bullshit.
     
  8. RetroKoH

    RetroKoH

    Member
    1,662
    22
    18
    Project Sonic 8x16
    I thought about that a bit... I actually had a discussion with Mercury not too long ago regarding this similar topic of GML vs. C++. My takeaway from that discussion, and this reply (as well as the others above.) is that I will try to get as much as I can into Triad... (with as much of all of the planned editors & features as possible... yada yada yada) meanwhile learning the ropes of C++... baby steps. When I feel confident enough to make a start, I will port the Palette Editor from Triad over to C++ and see how it goes from there.

    Thanks for the tips guys! :D
     
  9. Billy

    Billy

    RIP Oderus Urungus Member
    2,118
    178
    43
    Colorado, USA
    Indie games
    C++ is much more involved than GML, but it's definitely not impossible to learn. Once you've got a basic knowledge of C++ down, for gaming stuff I'd recommend you learn how to use SDL with it. Lazyfoo.net has some good tutorials for SDL, but there might be better ones out there. I mainly recommend SDL because it's multiplatform, but also not too complicated. (I've done some DirectX stuff, which is more difficult but not impossible)

    C++ is a very powerful language, and I'd recommend learning it even if you have no real interest in using it; My PHP coding got much better once I learned my way around C++.
     
  10. Ultima

    Ultima

    Games Publisher Tech Member
    2,398
    1
    18
    London, England
    Publishing mobile games!
    You could always consider AS3 or Haxe. Great for making web/mobile/desktop games easily.
     
  11. Lilly

    Lilly

    Member
    2,418
    234
    43
    United States
    Shang Mu Architect
    I don't know much about the latest version of Game Maker, but it was already getting more bloated than I would have liked around 7.0. (Either that, or I was jaded by the lack of even Win2k support, limiting how many machines I could target.) For 2D stuff I've pretty much stuck to my guns with Game Maker 5.3a; it's still very fast and doesn't require hardware acceleration; perfect for running the games in VMs or older video hardware/earlier versions of Windows. Game Maker's still not very optimal for targeting much older systems, though; I doubt the Sonic fan game engine I have now would run on any Intel CPU clocked below 700mhz, and if I don't optimize terrain building times for my external levels, loading stages will take so much longer than several seconds on weaker CPUs.

    Regardless, I'm glad you already know what direction to take. Baby steps should be a nice way to transition to C++. ^^ Good luck, man.

    That's a really cool rendering method. I should probably take a crack at a similar approach, I'm always looking for new ways to speed things up.

    Yeah, Game Maker out-of-the-box isn't very good at optimizing things; even the help manual tells you to keep tabs on that. I had to find ways of keeping my Sonic fan game engine running properly as well, disabling instances outside the view, and with the reversed method I implemented, it allowed that to work for split-screen as well. (Which runs a lot faster than I would have expected because of that.) It has a few weird drawbacks, but it's the fastest I can get an engine banged out in GML to run so far.
     
  12. Ultima

    Ultima

    Games Publisher Tech Member
    2,398
    1
    18
    London, England
    Publishing mobile games!
    Most VMs these days support hardware acceleration. At least, Parallels and VMWare do (plus VMWare Player, which is free). Game Maker 6 was the best version I thought.

    Also, optimising for systems that poor is not worth it these days. Even the casual player will almost certainly have a dual core 1.2ghz+ CPU and at least an Intel GMA with some hardware acceleration support - the demographic you'd be targeting at with sonic fangames is highly likely to be gamers with powerful PCs. Worth thinking about the fact that probably less than 1% of users of computers in general these days have a computer as slow as 700mhz... how likely are they to be in the crossover with your demographic?

    It's no longer worth optimising for hardware that was uncommon 10 years ago and is now practically extinct.
     
  13. Lilly

    Lilly

    Member
    2,418
    234
    43
    United States
    Shang Mu Architect
    Ah, yeah, Virtual Machines have been implementing hardware-acceleration for some time now, but it's been a while since I checked VirtualBox's progress, and support was a bit on the sketchy side. I'll have to check it out again, though, it's been a couple years. :specialed:

    As for using a dated version of Game Maker, that's very true, so lately it's been more of a compatibility-related move. (Although if I can get it to run on slower machines, that'd just tickle the geek in me who loves dusting off that good ol' 40lb white tower every once and a while!) Game Maker 6 was the best, but it doesn't like Vista or Windows 7. (I know there is a program to patch games compiled with GM6 by Mark Overmars himself, but seeing as I'm dependent on versions of Windows beyond XP, I'd have to run the program every time I compile a test build.) And while Game Maker 7.0 was a step in the right direction, it axed support of Win2000 and all derivatives of Win98.

    Game Maker 5.3a, however, is a great in-between for all of that. It's still very fast for something mostly software-based for rendering, (Much more so than GM5.0.) and will run on all versions of Windows from 98 to Win7, and maybe Win8 too. Since I don't need real-time sprite-rotation, (I have all the hand-rotated sprites properly organized without using too much memory.) or 3D effects for my project, I'm missing virtually nothing of importance from newer versions of the program, and syntax-wise it's almost the same. I'm continuing on GM5.3a without a problem, and I can literally guarantee it will run on Windows 98 and above, just like all those game commercials in the 90's. =P

    So really, it's more of a "Do I actually need all of those extra bells and whistles from newer versions?" than "I want this game to run on that dirt old PC in my closet too!". Just cutting the bloat, pretty much, and hopefully that will make the game run more easily on newer computers too; I'm trying to optimize it as much as I can so split-screen multi-player will actually be viable for my game, and so far I'm getting a solid 60FPS on my machine in split-screen mode. (Which is much better than my last fan game!) Assuming GM5.3a's limitations become a problem in the future, I can always convert it over to GM7.0 and call it a day, no sweat.
     
  14. TheKazeblade

    TheKazeblade

    "Our Life is More than a Side-Effect" Member
    Sorry to resurrect this thread like this, but I also am looking into learning C++, and am looking for some good tutorials. I'm ordering an intro to C++ book next week, but I want to gain as much of a foot-hold as possible before-hand. I'm having a really hard time finding lengthy, informative tutorials, though, and even less so that utilizes the X Code (v. 3.1.4) compiler since that's what I'm stuck with until I have a better computer for this stuff. Anybody know of some strong online C++ tutorials I can get started with?
     
  15. Azu

    Azu

    I must be stupid. Member
  16. TheKazeblade

    TheKazeblade

    "Our Life is More than a Side-Effect" Member
    Thanks a lot! I'll check them out after work :)
     
  17. Why not simple C? One dude made a full Hlaf-Life engine clone with C. And he coded in Notepad.
     
  18. Black Squirrel

    Black Squirrel

    no reverse gear Wiki Sysop
    8,543
    2,465
    93
    Northumberland, UK
    steamboat wiki
    If you're starting from scratch the best way to learn is to go through official channels, I.e. university or a course or whatever.

    The internet is not really equipped to teach C++ (although it will be quick to tell you otherwise!). Written programming tutorials can be flimsy at best regardless of language, but with C++ people have wacky coding conventions and crazy mindsets which you have to deal with. It can be a headache for all the wrong reasons - online stuff is best served for programmers wishing to switch language I find.
     
  19. winterhell

    winterhell

    Member
    1,165
    7
    18
    John Carmack did WHAT? :v: He is about the only guy that prefers pure C to C++. Afaik he didnt get into OOP until after Doom 3, even though some of the game's code is object-oriented.

    But seriously, you have to think why are you choosing a particular language over another.
    C++ may be fun when you start, but it gets tedious when you get to classes, header files and pointers.
    The industry is progressively moving away from C++ and there are more and more job offerings for either managed or web scripting languages.

    Also if you are thinking C++ is faster than C# or Java in games, well... no. If you spend the same amount of time working on both native and managed version, the managed version is going to perform faster because you spent more time actually working on your algorithms. And the games are never going to be CPU bound unless there is something fundamentally wrong with your code.
    Of course if you want to go hardcore and write drivers/emulators/heavy math stuff C++ still excels there.
     
  20. GerbilSoft

    GerbilSoft

    RickRotate'd. Administrator
    2,971
    76
    28
    USA
    rom-properties
    And then you realize that both C# and Java end up wasting at least twice as much memory as an equivalent C++ program. Also, good luck using C# on anything that isn't Windows. (Mono doesn't cut it for most things.) Not to mention that neither C# nor Java use the system's native UI. (Java has a poor emulation of Win32 and GTK+ themes. C# uses WinForms, which also attempts to approximate the Win32 theme, though it uses non-native Office 2003-style menus,)