DKC Fangames: Programming Q and A's

Working on your own project related to the Donkey Kong Country series?
This forum is your place to discuss fangames, artwork, stories and so forth which are DKC relevant.

DKC Fangames: Programming Q and A's

Postby sonosublime » May 14th, 2013, 3:53 am





Hi everyone. Firstly, I'd just like to say it's wonderful to find so many people who are as passionate about DKC as myself. Why did I not find this site sooner? Also, it's very inspiring seeing all the little projects and stuff going on.

I've noticed a lot of fangames being made. I'm actually also going to try my hand at one in Game Maker - properly this time. However, I thought that perhaps I would make this topic to pose simple questions to the DKC Atlas community in order to help others like myself who also wish to try making a DKC game. Basically, I would like to compile in here all the information anyone would need in order to make a simple DKC engine.

My first attempt in 2009 was an utter failure. The second attempt in 2011 was a lot better, but still very messy. I like to think I've improved in programming somewhat since then. This time I'm using a movement engine which I know works very smoothly (for the most part). Anyways, enough about me, onto the questions.

1. How should I go about programming Diddy's cartwheel attack? The way I have it at the moment, I activate a variable 'attacking' to 1 when his sprite is the cartwheel, and then change it back to 0 when the animation ends. If he touches an enemy when he is attacking, the enemy gets killed. However, is this the best way of doing things? And how could I go about adding in the feature to have Diddy continuously cartwheel over consecutive enemies in a row?

2. Vertical rope climbing: How should I go about having Diddy being able to climb up either the left or right side of a rope? Should I make an entirely new object? Basically, what tips can people provide here?

That's all for now, but I will update this topic as I think of more questions. Thanks in advance! :)
Treasure Hunter
Bananas received 228
Posts: 341
Joined: 2013

Re: DKC Fangames: Programming Q and A's

Postby Simion32 » May 14th, 2013, 1:51 pm

For the cartwheel you'd basically restart the roll animation and make him go faster (you might need to play the game and look at it in detail to see this happening). If the animation ends, he is forced to stop.

For the ropes you'd probably have a variable that represents the direction Diddy is facing (which, in fact, should be a part of your Diddy object anyway for scenarios other than climbing ropes).

I did a detailed post on GM-based DKC physics (http://gmc.yoyogames.com/index.php?show ... try3448641), though I don't have values for Diddy Kong yet:
Sage of Discovery
Bananas received 332
Posts: 2738
Joined: 2008

Re: DKC Fangames: Programming Q and A's

Postby sonosublime » May 15th, 2013, 2:33 am

Oh wow, I never knew that the cartwheel sprite gets reset every time. That's cool to know, thanks!

I do have a directional variable for Diddy. However, I was thinking more about the rope climbing movement. ie. When on a rope, Diddy cannot physically move in any horizontal direction, he can only change which side of the rope he is on.
So to go about this, I was going to make an entirely new object for Diddy rope climbing, with the origin set at where the rope would be. And when he jumps off the rope, I would destroy the object and create the normal Diddy object. However, this method seems a bit messy.
Treasure Hunter
Bananas received 228
Posts: 341
Joined: 2013

Re: DKC Fangames: Programming Q and A's

Postby Simion32 » May 15th, 2013, 12:53 pm

That's one of those things that GM makes unnecessarily difficult. Basically you want to lock Diddy's X position to that of the rope.
Sage of Discovery
Bananas received 332
Posts: 2738
Joined: 2008

Re: DKC Fangames: Programming Q and A's

Postby sonosublime » May 15th, 2013, 9:28 pm

Oh I see. Locking Diddy's position shouldn't be too hard to do. However, can you suggest other game making programs which would be good to use and easy to find? I'm not a master programmer or anything, I just know basic C++ (from MATLAB) and a fair bit of GML (although I'm not sure that counts as a real programming language).

EDIT: I got the cartwheeling and roll-jumping working perfectly thanks to you :D
Treasure Hunter
Bananas received 228
Posts: 341
Joined: 2013

Re: DKC Fangames: Programming Q and A's

Postby sonosublime » May 18th, 2013, 7:40 pm

A new question (and it's a big one): the graphics. Namely tiles.

Now, I know that most of the levels have been ripped, and are available on Spriters' Resource. But how can I turn those level rips into usable tiles in GM? Ideally, I would like to have a sheet with a bunch of loopable tiles (ie. jungle floor, jungle wall, castle floor, castle wall, ship deck, etc), which I can just select and place into the room editor when needed.

Something like this:

Image

Also, another issue is backgrounds. How can I eliminate continuity issues which will arise from using ripped background from the game? ie. something like this:

Image



For anyone who needs help with rope climbing, the way I did it was setting a variable 'climbing' to 1 upon collision with the rope. You can then use the variable to control gravity, set sprites, etc. Simple stuff, but it works.
Treasure Hunter
Bananas received 228
Posts: 341
Joined: 2013

Re: DKC Fangames: Programming Q and A's

Postby Simion32 » May 19th, 2013, 1:23 am

A lot of the backgrounds are dynamic and cannot easily be done in GM.you might be able to get it to follow the screen, but doing multi-line parallax scrolling is HARD in GM.

For the tiles, you can use this old version of DKCRE to extract DKC1 and DKC2: viewtopic.php?f=57&t=1531#p28985

I haven't gotten to DKC3 yet.
Sage of Discovery
Bananas received 332
Posts: 2738
Joined: 2008

Re: DKC Fangames: Programming Q and A's

Postby sonosublime » June 1st, 2013, 9:02 pm

Hi all,

This is what I've managed to whip up in GM (excuse the bandicam watermark at the top of the video).



Thanks for watching! Please let me know what you think so far. The way I've made the engine, it is quite easy for me to add new barrels, enemies, Kongs, etc.

Simion32, I'm not sure if you got the PM I sent you, but I don't really understand how to use the DKC Resource Editor. Is there an instruction manual or something? And will I be able to use it to create tilesets, like the one shown in an above post?

The next question I have is maps. How would one go about making maps, map screens, and saving the status of levels (ie. completed, DK coins found, bonus levels found, who completed the level, etc)? Global variables? Arrays?
Treasure Hunter
Bananas received 228
Posts: 341
Joined: 2013

Re: DKC Fangames: Programming Q and A's

Postby Qyzbud » June 1st, 2013, 10:52 pm

I've gotta say, sono; that's a pretty decent start.

You've got a lot of DKC's mechanics worked out, and with a bit of fine-tuning of the physics — especially regarding the floaty nature of Diddy's bounce after hitting baddies, and when fired from barrel cannons... and his lack of 'momentum' (acceleration/deceleration) — you could have a really nice little engine on your hands. :)
Atlas Author
Bananas received 682
Posts: 3228
Joined: 2008

Re: DKC Fangames: Programming Q and A's

Postby sonosublime » June 6th, 2013, 2:44 am

Thanks Qyzbud :)

I'm not sure why it appears "floaty", but I programmed it such that if you hold down the jump key after hitting an enemy, you bounce higher, just like in the games. The barrel cannons shoot out a Kong with no gravity, but then applies it when a certain time limit has been reached, which can be defined in each barrel cannon.

As for acceleration/deceleration, I don't used hspeed, but change the x values immediately depending on whether the directional keys are held.

ie.
if keyboard_check(vk_left)
{x-=5}

Do you have any suggestions to give as to how I could achieve momentum with this style of movement programming?
Treasure Hunter
Bananas received 228
Posts: 341
Joined: 2013

Re: DKC Fangames: Programming Q and A's

Postby Qyzbud » June 6th, 2013, 9:38 am

sonosublime wrote:if keyboard_check(vk_left)
{x-=5}

Do you have any suggestions to give as to how I could achieve momentum with this style of movement programming?


I would suggest that you increment the value of 'x-' each time (vk_left) is pressed/held.

Start it at 1, and until it hits 5, have it incremented every 10ms or so... of course you'll have to tweak these values until it looks and feels right.

To simulate deceleration, obviously just reverse the process; subtract 1 from 'x-' every 10ms until 0.

Sorry for the brief response — hope this helps!
Atlas Author
Bananas received 682
Posts: 3228
Joined: 2008

Re: DKC Fangames: Programming Q and A's

Postby Simion32 » June 6th, 2013, 9:46 am

To get smooth movement you absolutely must use velocity and speed values. You cannot simply add to the position every time a key is still pressed. That won't get you where you want to go.

EDIT: DKC's algorithm is made to smooth the velocity values so that the increases in speed gradually go towards 0 - the speed value will approach some defined target speed. The speed value itself is added to the position every frame.

From there, you simply have different target speeds depending on what directions are pressed (0, 2, 3, -2, -3, etc...) and these change immediately based on those keys (there's no delay in the change of a target speed).

The target speed method CAN be used for the gravity too, but that's not what DKC does. DKC actually just adds a constant value to the speed depending upon whether the B button is pressed. As for jumping, speed is set to -7 and then it still follows the B button rule at every frame past the jump start (72/256ths per frame when button held, and 144/256ths when not holding it. the value matters on every frame and is exactly based on the current B button state!).
Sage of Discovery
Bananas received 332
Posts: 2738
Joined: 2008

Re: DKC Fangames: Programming Q and A's

Postby sonosublime » June 21st, 2013, 9:53 pm



A new video which shows off a lot of new features. Please let me know how it's looking and any suggestions you may have.

I'll have to work on implementing momentum and improving the physics. Thanks for the tips Qyzbud and Simion32.

Also, tag-team has been added, which brings me to another question: how could I go about coding the Team-up and throw feature? Anyone have any suggestions? I was thinking of freezing the player object while activating a 'thrown' variable in the partner object that would define a 'normal' or 'thrown upward' trajectory.
Treasure Hunter
Bananas received 228
Posts: 341
Joined: 2013

Re: DKC Fangames: Programming Q and A's

Postby Super Luigi! » June 22nd, 2013, 2:37 am

I'm not sure what to tell you about the tag-team throwing, but you could make your jump landings and Enguarde mounts smoother. The Arrow Barrels also seem to shoot too high. Besides these problems, however, I have a hard time placing what bugs are in the system. Good job on getting this far, by the way.
Sage of Discovery
Bananas received 302
Posts: 3699
Joined: 2012

Re: DKC Fangames: Programming Q and A's

Postby sonosublime » June 24th, 2013, 8:59 pm

Thanks. I plan on building a solid engine, and then hopefully get around to making everything smoother (ie. momentum, turning animations, etc).
Treasure Hunter
Bananas received 228
Posts: 341
Joined: 2013


Return to DKC Projects/Fanworks

Who is online

Users browsing this forum: No registered users and 29 guests