Showing posts with label gamemaker. Show all posts
Showing posts with label gamemaker. Show all posts

Sunday, May 27, 2007

Headache


If you ever want
a serious headache, try to make a videogame.

I scrapped my original prototype because Gamemaker's collision code is just too buggy.

At this point I think I had three weeks. Not good.

I spent a week prototyping new ideas. I got some pretty complex behavior going using the built-in pathfinding/avoidance code.

Unfortunately, I neglected to do one thing: find the core gameplay element.

I had backstory. I developed very messy code that would activate quests and show conversations with NPCs. But every conversation had to be created as its own object, which meant opening my paint program, making a .bmp, creating a sprite, turning that sprite into an object, and then altering custom code to display the object under specific conditions and destroy it otherwise.

Two weeks down. I was creating almost all the assets by hand because I wasn't happy with what I found online. This was very, very tedious.

In the end I hacked together what I could, tacking on a lame end boss. It was awful. Boring.

After the class tried it out, almost all my feedback said one thing, "Too complicated." Nobody could figure out what to do or where to go, even with the controls written out.

Failure.

It was pretty sweet.

Wednesday, April 11, 2007

Prototype Problems


If anyone would care to play
around with my game prototype and clue me in as to why an object that is collided with from the top will sometimes pop through the floor? This can also occur when two or more objects are being pushed by the main character - as they bounce one will just 'foop' and be gone.

I've tried all sorts of tricks with gravity, vspeed, move_contact_solid, etc.

So try it out if you wish. I will provide a link to an .exe and, if you don't trust that, one to a .gmk. You should be able to execute the .gmk from an unregistered version of GM7, you just won't be able to access some of the functionality. If you do this, wherever you see a blank action is where I used custom libraries, either a kinetic bounce or a treat as solid.

The graphics are temped in from the original Gamemaker resource packs. It is my understanding that these are free to use.

The controls are the arrow keys (left moves left, right moves right, up jumps, down does nothing). If you press the spacebar you will shoot out a beam that, when the spacebar is released, will push the movable objects away. This is also an error - I've been trying to get it so that the pushing occurs until the object is free from the beam's collision, but I think it's having trouble - I probably have a set vspeed to 0 for all objects in one of my collision events.

Anyway, here it is, help is not expected but would be appreciated. I've thrown up questions twice on the Gamemaker forums and gotten some views but no replies.

Link to .exe file.

Link to .gmk file.

And once again I found myself saying, "Rigid body physics can't be too hard, dammit!" only to walk away frustrated hours later.

Monday, April 09, 2007

Reversal


I may have
this thing cracked. I finally got at least a very rough prototype worked out.

The trick was something very simple (naturally). I was trying to just work with the hspeed of my player object and pass that to the movable objects. It didn't seem to pass hspeed as a negative, though (for "left" direction). I could move it to the right, fine - no matter how I collided with the object.

The key was, in a collision event, to pass the direction of my player object to the movables. And this is done by calling other.direction (simple, I know).

I also use two .libs, Ultima Actions v3 and Platform Basic 2.0 - one of them has a decent solids code and the other a rough kinetic collision event (probably just a bounce event with some kind of damping, but saves me a headache).

There are two major errors, and I may end up going to the community for help:

1. If you push a movable object against a wall, when it bounces off the wall it will penetrate the main character's collision. They're both solids, so this shouldn't happen, but I think it has to do with using the jump to position command - I may have to try and find another way to move the objects.

2. If one movable object falls on top of another (or sometimes while pushing several of them together) one of them will pop through the floor. Again, probably something to do with jumping to position. I can fix some of that by playing with the vspeed, but this won't work if the object is in the air (setting the vspeed to 0 in those cases makes the object hang, of course).

I'm also not happy with the way my wall collisions function right now (a simple bounce, but then the character shakes if you keep pressing into it), but that's not rightly a bug.

Hopefully people aren't getting bored with my worklogs. This is a good way to keep track of my progress and the various things I've tried. I hope it might also help other people using gamemaker.

Get used to it, though. I haven't even begun to incorporate the graphics or sound or menu functionality.

---

And while I'm on the subject, I wanted to talk directly about Gamemaker itself.

Go to Yoyogames' site.

Look around a bit.

It sucks. They barely tell you about the software. It looks like a generic spam or placeholder site.

The original Gamemaker site is still up, but isn't being updated. The tutorials absolutely suck. There is a message about v7 and a whole bunch of new developments for March. Version 7 came out at the end of February.

And here we are in April and the Yoyogames site hasn't changed. They haven't migrated the forums or released new extensions or done much of anything. They don't even have a news feed to tell people what's coming or if they're doing any work.

The creator explained his decision to sell as a way to keep development going since he no longer had the time. That's reasonable. But now there's not even a peep from the new guys.

Not the way to build a community.

---

64digits is a good way to organize a community, if you can wade through the endless Naruto references and adolescent depression.

---

Don't forget about April's Round Table.

Saturday, April 07, 2007

Half-A-Yard Stare


Something I do not recommend:


Becoming so obsessed with your imagined game that you spend all your time trying to find some way to make the core functionality of the game actually work.

Especially after the original solution seemed so promising but turned out to be incompatible.

Then downloading some kind of Tokamak .dll and fiddling with that until you realize that you can't just call the Scripts, you have to call functions and pass the correct parameters, which you will only figure out through excessive trial and error. And for some reason every time you change the slightest thing the simulation stops working.

So you look for another solution and come upon ODE.

For god's sake, do not spend hours coding in movement and gravity and pondering how to properly use external_calls and even more nebulous parameters. It just isn't worth it. You will never figure out how to stop your player from bouncing and spinning (maybe something to do with torque or angular velocity but there's no way your code will be correct).

And why is it so damn hard to include a simple way to make static bodies?

What you should do is basically lament that 1)The new version of GMPhysics isn't ready, 2)Gamemaker doesn't have a built-in physics simulation, 3)You have to use Gamemaker, 4)There don't seem to be any other physics add-ins that do not require the same amount of knowledge to use as creating one from scratch, and 5)You ever thought that getting a little ghost to push a bunch of blocks around would be an easy thing.

---

I'm not yet ready to scrap my game idea.

But I'm getting there.

Friday, April 06, 2007

The First Brick Wall


I've apparently reached
the first major obstacle for my project.

Turns out that GMPhysics isn't fully compatible with Gamemaker 7. There is a limit on the number of physics object you can have - too many and the game won't load. So I can get an 800x600 map working with about 30 static objects and 6 physics objects, but more than that and . . . error.

They no longer allow you to buy version 6.1.

No word on a newer version of GMPhysics anytime soon.

So I'm going to look for some other solution to getting the physics in my game.

Here's hoping.

Wednesday, April 04, 2007

Trouble Sleeping 2


Patrick, were
you referring to Unity 3d?

Thanks for the tip, but I'm kind of stuck using Gamemaker as part of my class.

More fiddling last night.

After many fruitless hours I finally discovered how to get GMPhysics working. I'm convinced at this point that part of the reason programming isn't as accessible as it could be is because programmers take so much basic knowledge for granted.

The .dll thing, for example. Gamemaker's help file says almost nothing, only some cryptic stuff about making one and that you have to initialize it . . . somehow. Good luck.

There were three things I managed to crack last night:

1. Installing GMPhysics.

The easiest thing to do would be to open up one of the included example files (Platform, Polygons, or Water). Delete all the sprites. Delete all the objects EXCEPT for the one labeled "control."

Now save the file as BlankGMPhysics or something similar. There you go.

The other thing you can do takes more work but lets you import it into a work in progress without having to start over.

The good thing about Gamemaker is you can open up multiple versions of the program. So open up one of the GMPhysics examples (I'll refer to it as Platform) and simultaneously open up your project.

Look at the Platform project. Under the Scripts tab you should see a Group labeled "GMPhysics." If you open that Group you will see seven more Groups such as "Polygon" and "World." Those are the Scripts you need to import into your project.

Select the Polygon Group. On the top of the project you will see File, Edit, Resources, Scripts, etc. Click on Scripts. The second item in the list is Export Group of Scripts. Click on that now. Name it the same as its Group name and Save.

Do the same for all of the Groups.

Now, in your own project, click on the Scripts menu. Choose Import Scripts. You should see all the Scripts you saved with the extension ".gml." Import all of them. Then, just to clean everything up, Right-click on Scripts and Create Group. Call this new Group GMPhysics. Drag-and-Drop all your imported Scripts into the GMPhysics Group.

Easy enough, right?

Now comes the real annoying part.

In the Platform project, look to the left and find the Global Game Settings. Double-click to open them. Choose the tab that says "Constants."

Now open the Global Game Settings in your own project and navigate to the Constants page. It should be blank. Press "Append." Now type in the first item from the Platform project.

Press Append again. Type in the next item down the list. And so on. And so on. Make sure to put these values in exactly as you see them.

There. That's all it takes to get GMPhysics into a project.

But that won't get it to work.

2. Getting GMPhysics to actually work.

So I was happy when I figured out how to set up a project with GMPhysics. I was ready to start tinkering.

I put in my temp graphics and hacked together some objects.

Run the game.

Nothing but errors. Error in code line 1.

Bullshit. Impossible. What the hell was going on?

I tried it again. And again. And again.

I took one of the physics examples and put my stuff in and tried it out. Errors. So many errors!

Fuck it. I tried to go to bed. It's 4 AM by now. I toss and turn. 4:30. 5:00. I feel terrible, dizzy and tired and the arthritis in my back is radiating tremblors of pain.

And all this time I'm turning over and over in my head my complete failure to get the goddamn program working. It should work, dammit!

Then it hits me. I'm House, that faraway look, the moment of inspiration, the puzzle solved.

I got up. Turned on the monitor. With all the lights out the monitor's brightness caused sharp pain in my eyes. It took a few minutes of blinking to adjust.

Here's the trick, then, for those who have lasted this long:

Remember the object labeled "control" that just seemed to sit there? It's in all the GMPhysics examples. There's a good reason it's there. It's where the whole thing is initialized.

Which means you need one of those objects in your project. If you created a blank project from one of the examples then you should already have it. If not, here's what you do.

Create a new Object. Name it objControl or something similar. Don't give it a sprite. Set its Depth to a very high number. Make sure it isn't checked Solid. It can stay Visible, however.

-Add a Create Event. Drop in a code block (under the Control tab on the far right) that says "init_physics( );" This is also where you would initialize a ground plane depending on your game type.
-Add a Step Event. Drop in a code block that says "update_bodies( );"
-Add a Game End Event. Drop in a code block that says "release_physics( );"

Now that you have your Control object comes the part that I missed. The part that frustrated me for hours.

Make sure you place your Control object into every Room in your game. That's it.

So Create a new Room. In the Objects tab choose objControl and drop it somewhere in the room.
Done.

3. Working with GMPhysics.

The nice thing about this add-in is that you can put nearly all your object's properties in its Create Event and then just call object_update( ); in the Step Event.

Now, for a beginner it's best to stick with the Body Scripts. Double-click on a Script and you should see a pretty good description of what it does and what arguments it needs. Try to ignore the external_call information at the bottom.

Let's say you have an object. A cube 16 x 16.

Do the usual Gamemaker steps - create your sprite and then your object.

Now, in your object make a Create Event. You want this to be a floor, so it doesn't need to move and won't react to any physics. There is a specific argument for this in the create_body Script called "STATIC."

In your Create Event drop a code block and put "create_body(x, y, STATIC, SHAPE_BOX, 16, 16);" That's it. You could also assign that code to a variable using the equals sign.

Just be sure you update your objects in the Step Event and destroy them in the Destroy Event.

Have fun. Get frustrated.

---

The Problem:

For some reason my physics objects are encountering an invisible collision plane. I have a STATIC ground block. All objects are SHAPE_BOX types. The boxes start in the air and fall, but won't touch the STATIC block.

On the other hand, I created an ACTOR type, so I can move around a little. The ACTOR sits fine on the STATIC block.

Which makes me think the problem is with the physics boxes.

Still, it's a lot easier than trying to fake the physics using Drag & Drop items. Which means more time I can spend tweaking my gameplay.

Hopefully.

Tuesday, April 03, 2007

Trouble Sleeping


I've been having
trouble sleeping lately.

So Sunday night through early Monday morning I sat down and started fiddling with Gamemaker.

I had already come up with my main idea.

My method was simple: I wrote down some themes in which I was interested. Then I wrote down a list of all the verbs that I thought I might be able to do in Gamemaker. Which meant simple stuff - nothing like "God of War-style attack system". Things like "move," "jump," "push."

So I had the big idea. I had a list of interactions.

I managed to prototype my idea by fiddling. Which means that so far I approve of the software. It took maybe four hours using temp graphics.

It wasn't perfect, of course.

Actually, let me explain. The collision system is pretty terrible. I have read suggestions to use masks but no in-depth tutorial on getting them to work properly.

Which means the objects that I can push around sometimes collide with my main character and get him stuck. Or sometimes they clip right into the supposedly solid brick floor.

I also can't make it so that if the main character pushes objects in a line that all of them will move.

I was thinking that maybe a decent physics system could solve this much faster. But there's no help whatsoever for the Gmphysics lib. I have no idea where to even begin.

Ah, the joy of making games.

[beats head against wall]

Sunday, March 11, 2007

Try It, You'll Like It


If anyone has
any familiarity with Gamemaker, then you may be happy to know that version 7.0 is out. Also, development has been taken over by YoYoGames - hopefully with the result that there will be faster dev time and more resources devoted to the community.

We're going to use Gamemaker in the Game Design class I'm attending, so I went ahead and bought the Professional version (it's only 20 bucks). The Pro version basically makes certain things much easier - including a built-in particle system.

The community thus far seems a little more engaged than the one for Blitz3d (largely because the B3ders seemed to move over to BlitzMax, the Mac dev software). Though the comparison isn't quite fair since these are two very different programs.

Gamemaker's strengths are in the top-down and side-scroller realm. 3-d is possible, but you'll have to program a lot of functionality yourself and are better off with Darkbasic or Torque. The learning curve is pretty small, though I can't really recommend the tutorials on Gamemaker's own site - they, to put it mildly, suck.

I would stick with the help file and the Game Maker Community messageboard.

I've also ordered two of the books on the market specifically geared toward Gamemaker: The Game Maker's Apprentice and Basic Game Design & Creation for Fun & Learning. I may put up evaluations when those arrive.

As a test I sketched out a rough block, scanned it in, did some editing in GIMP and then exported to .gif. After that it took only a few button presses to get my hand-drawn art into a room. I threw in a snowman as a player, gave him movement functionality and tested the game. Voila! Big ugly penciled blocks and a snowman. Pretty cool.

The hardest thing is scaling everything properly and selecting the borders so that the player surface doesn't look awkward. That and trying to properly animate anything when your experience is close to zero.

Still, it's a great introduction. Some of the games coming out are great throwbacks and it's a great opportunity to learn the entire game development process on a small scale. It also gives me a greater appreciation for the complexity of those old school games, especially when I consider that they didn't have access to a handy little tool like Gamemaker.

When I finish something I'll be sure to post it.