Author [EN] [PL] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [ID] Topic: NES-Style Castlevania Belmont Engine for GameMaker! (Version 0.3 UPDATE!)  (Read 212657 times)

0 Members and 1 Guest are viewing this topic.

Offline Inccubus

  • Wannabe Great Old One
  • Master Hunter
  • *****
  • Posts: 3287
  • Gender: Male
  • Warrior
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. SuperOld Dungeonite: Members who have been around since the oldOLD days. Permanent Resident: Seems to always be around to post/reply.
    • Awards
  • Favorite Game: Vampire Killer (MSX)
  • Likes:
Re: NES-Style Castlevania Belmont Engine for GameMaker! (Version 0.3 UPDATE!)
« Reply #315 on: August 08, 2012, 02:50:47 AM »
0
Hey. All this talk of CV3's code got me started. Think I might just do a small project.
« Last Edit: August 09, 2012, 08:39:05 PM by Inccubus »
"Stuff and things."

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1861
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Palette Swap code for Game Maker
« Reply #316 on: September 18, 2012, 12:16:53 AM »
0
Simple palette swap code I wrote up tonight. GIF file needs to be 4-color, preferable 87a format, or at least that's what works for me. This kind of script has been done before, but I'll share my version to you, my Wallachian brethren. What you do with it is up to you. As for me, I have no flippin' idea where to go from here. Damn attribute tables.

Edit/Update: My GIF files were created in Paintshop Pro, saved in 4-bit color with GIF format 87a. Figured I should throw that out there since some programs save GIF files differently.

Code: [Select]
/*
This script simply modifies the higher three palette entries of a 4-color GIF.
The script looks for the specified file in the Temp directory and rewrites it.

argument0: GIF file (string, sans extension)
argument1: Color 1 (real)
argument2: Color 2 (real)
argument3: Color3 (real)
*/

var i,chr,col,pal;
chr =   file_bin_open(temp_directory+'\'+argument0+".gif",1);
for(i=$10;i<$19;i+=3)
{
    col =   (i-$10) mod 3;
    switch (i-$10)div 3
    {
        case 0:
                pal =   argument1;
                break;
        case 1:
                pal =   argument2;
                break;
        case 3:
                pal =   argument3;
                break;
    }
    file_bin_seek(chr,i);
    switch col
    {
        case 0:
                file_bin_write_byte(chr,color_get_red(pal));
                break;
        case 1:
                file_bin_write_byte(chr,color_get_green(pal));
                break;
        case 2:
                file_bin_write_byte(chr,color_get_blue(pal));
                break;
    }
}
file_bin_close(chr);

Edit/Update #2: Here's a sample of the code modifying a GIF. Top half is the original file, bottom half is the file after using this code:
pal_swap("chr73",make_color_rgb(24,88,88),make_color_rgb(32,120,120),make_color_rgb(64,192,192));


Q&A
Q: How does it work?
A: GIF files are very simple image formats. The palette is stored near the beginning of the file starting at byte $0D. The first color in the file is $0D-$0F, each subsequent palette entry takes up three bytes in typical RGB order. This code simply opens a GIF file and rewrites those bytes.

Q: Is it only for NES-style quadrachromatic images?
A: No. Although this script was written with quadrachromatic images in mind, the beauty of my script is it should be able to handle 16-bit graphics. The switch statement that sets pal can easily be expanded to allow fifteen editable colors, more than enough.

Q: What makes your code different from the others?
A: For starters, you don't need to specify the color to change, which most of the scripts I've seen require. With a simple edit, I could make this code usable with a specific palette index whereby you'd just use 0 for all the other corresponding arguments. That's a simple enough edit that anyone could do it.

Q: Why use the temporary directory?
A: You wouldn't want the player to easily mess with those files now, would you? If they know anything about GM, they'll know where to find your graphics, but at least the newbs won't know.

Q: How fast is this code?
A: I haven't tested. Sorry.

Q: How do I use this in my game?
A: That's up to you to figure out. I'm still trying to figure out how I'll incorporate it into my tile maps.
« Last Edit: September 18, 2012, 01:04:38 AM by TheouAegis »
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline Inccubus

  • Wannabe Great Old One
  • Master Hunter
  • *****
  • Posts: 3287
  • Gender: Male
  • Warrior
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. SuperOld Dungeonite: Members who have been around since the oldOLD days. Permanent Resident: Seems to always be around to post/reply.
    • Awards
  • Favorite Game: Vampire Killer (MSX)
  • Likes:
Re: NES-Style Castlevania Belmont Engine for GameMaker! (Version 0.3 UPDATE!)
« Reply #317 on: September 18, 2012, 05:28:13 AM »
0
Neat. This will make short work of NES, GBC, etc graphic simulations. Thanks for this.
"Stuff and things."

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1861
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Re: NES-Style Castlevania Belmont Engine for GameMaker! (Version 0.3 UPDATE!)
« Reply #318 on: September 21, 2012, 12:22:06 AM »
0
I just found out GM will only allow multi-frame sprites from a GIF file if the GIF file is multi-frame as well. Since I haven't tested the above code with such a GIF yet (although maybe there's no difference), I decided to rewrite the code for use with a PNG file.

Here's a modified code for a PNG (again, byte locations may vary from program to program), allowing for 4 colors changed. One of the colors should never need to be changed -- the transparent one, but I added a 5th argument anyway. I recommend using the following neutral grayscale palette:

00 00 00 Solid Black
7C 7C 7C Dark Grey
F8 F8 F8 Light Grey
BC BC BC Whitish

When you save to a PNG or GIF file, it should (... I have no idea if this is true or not) organize the palette from lowest to highest. Or it might organize in a radial pattern, kinda like how GM reads the pixel in the bottom-left before writing. It seemed like with a GIF file it wrote in order of the palette shown in Paintshop Pro for me, but when I saved a PNG the colors were in different places in the file.

Code: [Select]
var i,chr,col,pal;
chr =   file_bin_open(temp_directory+"\"+argument0+".png",1);
if chr show_message("File Open!");
for(i=$61;i<$6D;i+=3)
{
    col =   (i-$61) mod 3;
    switch (i-$61)div 3
    {
        case 0:
                pal =   argument1;
                break;
        case 1:
                pal =   argument2;
                break;
        case 3:
                pal =   argument3;
                break;
        case 4:
                pal =   argument4;
                break;
    }
    file_bin_seek(chr,i);
    switch col
    {
        case 0:
                file_bin_write_byte(chr,color_get_red(pal));
                break;
        case 1:
                file_bin_write_byte(chr,color_get_green(pal));
                break;
        case 2:
                file_bin_write_byte(chr,color_get_blue(pal));
                break;
    }
}
file_bin_close(chr);
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1861
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
What...the... ffff------ ... Weird glitch in CV3!
« Reply #319 on: October 29, 2012, 04:58:02 AM »
0
Ok, so I discovered the glitch in the coding for Winged Demons that made them spaz out in horizontal stages, but that wasn't really a glitch because it was never supposed to be in horizontal stages. But now I found a glitch that not only doesn't matter what kind of stage it's in, it seems to have actually been programmed in!

First, here is what is supposed to happen: When a bone skeleton leaps over a cliff or block and bumps into a wall, it drops straight down. THIS WORKS.

Here's where things get wonky: When a whip skeleton leaps over a cliff or block and bumps into a wall, it not only drops straight down, it changes palette, changes CHR (sprite), and alternates between two or three single-tile sprites even though it's flagged to not animate at all.

The error starts at 0Bx938F, which loads an indexed value into byte $0606,X to be used to jump to the phase index for dropping straight down. For a bone skeleton, this is $0B (11), which makes sense since at $0A (10) the code loops back to phase 0. However a whip skeleton will loop back to phase 0 at $0C (12), but $606,X gets set to $12 (18).

I haven't been able to find any way of loading phases 13 through 17, and phase 18 onward doesn't even seem like the correct indexing. For starters, it lets the whip skeleton pass below the ground then POOF! reappear above the ground. Bone skeletons check for collisions with the ground while dropping, but is for whip skeletons it's just an image cycling code.


If any of you have time, especially if you have reVamp, try to recreate the glitch (preferably without using reVamp).


UPDATE: Changing the $12 to $0D (the logical alternative) seemed to fix the bug, as it mapped to the same code used by the bone skeleton. But I would expect $13 if it was a typo, as $0D=13.

Man, am I really debugging more thoroughly than Konami's employees?
« Last Edit: October 29, 2012, 05:06:47 AM by TheouAegis »
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline Inccubus

  • Wannabe Great Old One
  • Master Hunter
  • *****
  • Posts: 3287
  • Gender: Male
  • Warrior
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. SuperOld Dungeonite: Members who have been around since the oldOLD days. Permanent Resident: Seems to always be around to post/reply.
    • Awards
  • Favorite Game: Vampire Killer (MSX)
  • Likes:
Re: NES-Style Castlevania Belmont Engine for GameMaker! (Version 0.3 UPDATE!)
« Reply #320 on: October 29, 2012, 05:50:35 AM »
0
Nice catch there. I should add this to the title hack I'm making.
"Stuff and things."

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1861
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Sometimes the simplest things aren't so simple
« Reply #321 on: November 06, 2012, 03:28:06 AM »
0
I wasn't planning on including bone dragons in my game because I knew coding them would be a bitch, but it didn't seem right to code all the enemies from CV3 except the bone dragons, since people would want to use them in their own games, y'know. Oh god, it was even worse than I expected.

Three arrays needed so far (mild compared to owls, which I think I created 4 or 5 arrays for). There's an array for x, an array for y, and an array for the image_index. I think my x and y arrays are too big, since it looks like the same values were used and extended for the Bone Dragon King. Anyway, the x and y arrays are the offsets from the adjoined rib's x and y. So you have rib[i+1]=rib[ i ].x+bonedrac_x[rib[ i ].current_offset]. Although in my code, it basically looks like x=other.x+bonedrac_x[other.current_offset]. Much cleaner, huh?

But it's how it calculates the current offset. The step's code is so short but my mind is boggled. :( So much math to just lead to a boolean check to lead to more math to lead to a boolean check. Fucking boolean checks.
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline Inccubus

  • Wannabe Great Old One
  • Master Hunter
  • *****
  • Posts: 3287
  • Gender: Male
  • Warrior
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. SuperOld Dungeonite: Members who have been around since the oldOLD days. Permanent Resident: Seems to always be around to post/reply.
    • Awards
  • Favorite Game: Vampire Killer (MSX)
  • Likes:
Re: NES-Style Castlevania Belmont Engine for GameMaker! (Version 0.3 UPDATE!)
« Reply #322 on: November 07, 2012, 03:03:01 AM »
0
God that sound like a nightmare, but yeah, it would almost be blasphemy not to have the white dragons.
"Stuff and things."

kayttaja12

  • Guest
Re: NES-Style Castlevania Belmont Engine for GameMaker! (Version 0.3 UPDATE!)
« Reply #323 on: November 21, 2012, 08:16:00 AM »
0
I really would like to make NES style Castlevania game with game maker, since I'm huge fan of the series, but I really cant manage to make movement like in the original series. I only have game maker 7 and I dont really like game maker 8, so could you make this for GM7 too? GM7 and GM8 codes are pretty similiar so I dont think it could be too hard.

Offline Inccubus

  • Wannabe Great Old One
  • Master Hunter
  • *****
  • Posts: 3287
  • Gender: Male
  • Warrior
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. SuperOld Dungeonite: Members who have been around since the oldOLD days. Permanent Resident: Seems to always be around to post/reply.
    • Awards
  • Favorite Game: Vampire Killer (MSX)
  • Likes:
Re: NES-Style Castlevania Belmont Engine for GameMaker! (Version 0.3 UPDATE!)
« Reply #324 on: November 21, 2012, 07:38:16 PM »
0
What's not to line in GM8? They fixed a huge ton of bugs. It's far more fully featured too.
"Stuff and things."

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1861
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Re: NES-Style Castlevania Belmont Engine for GameMaker! (Version 0.3 UPDATE!)
« Reply #325 on: November 22, 2012, 12:57:41 AM »
0
Most of what I'm rescripting will be useable in GM7 I think, but that's a ways off, seeing as how I'm rescripting as I hack and learn to read the code. As I've been telling Inccubus through messages, you pretty much need to focus all your effort on hacking ONE GAME because every game is coded differently and it's hard enough reading CV's code since it had numerous programmers with their own styles. Consequently, it's taking me a while. Right now I'm working on hacking the giant bat in CV3 which is troubling because the programmer for the bat uses multiple objects and each object has a different set of codes, so I have to track multiple objects just to track a single enemy. The other programmers for enemies used strictly one object per enemy in a majority of cases. Spawners typically were the only things that had more than one object each.
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline Las

  • Vampire Hunter
  • ***
  • Posts: 475
  • Gender: Male
  • Whoa dude!what a horrible night for no beer.....
  • Awards 2016-02 Sprite Contest 1st Place
    • Awards
  • Likes:
Re: NES-Style Castlevania Belmont Engine for GameMaker! (Version 0.3 UPDATE!)
« Reply #326 on: November 24, 2012, 05:54:46 AM »
0
That's ironic you are mention the big bat boss. I was going to try taking what knowledge of coding i have and try and code him in. I"m not their yet clearly. I know i coudl make him fight in his normal big bat boss form. I can even add multiple instances when he dies for the other bats.

The biggest problem i'm having atm with him and the skeleton dragon(WIP) is that the health bars have to somewhat part of the whole for each bat getting hit(and yes i'm using game maker 8pro). I actually got the skelton dragons' second form to go from halflife to none. So he starts with a half a bar of health. The thing that is their lifebar is called Mr.Dbosshealth. I set it too Mr.Dbosshealth-=160. And it's at half. 320 is full life.

Now that's a little differnt and i still have to get the first version of the skeleton dragon to start at full and end at half(not sure how to write that yet). But the smaller bats seem to pose a problem. I have no idea how to go about making them A) connect to one bar and B) drain to only a couple hits each on the bar. That seems to be a little bit past me. If you have any ideas Theo on yours, please do let me know if you could. It would be a major help.

Also i figured i'd throw it out their if their are any takers we are very much in need of skilled code help on the SCV3 project. I've recenetly did a revamp on Mad forest and already it seems 10 times better than that hack of  level i made in the day.Well cool discusssion here guys, i'll stop back on soon!

Taking Edward Scissorhands to a whole new level!

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1861
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Re: NES-Style Castlevania Belmont Engine for GameMaker! (Version 0.3 UPDATE!)
« Reply #327 on: November 24, 2012, 10:08:52 PM »
0
This morning I started tracing that HP-connectivity. I rolled over and went back to sleep.

Good luck with bone dragons. The bats are a lot easier than dragons. THe main bat only has 3 phases and I think with each smaller bat it still has the same phases, since I didn't notice any difference between its code for full-sized bat and hit-once bat. The bat has two objects for the main bat as far as I can see: When it's hanging upside down, that's one object; when it flies around the room, that's another object. Now when it splits off into two, the new bat appears to be a different object, hence different code. I haven't looked through it.

Note that a "phase" is simply a set of code executed every step. If you change the phase, you change which code is executed that step. Phase 0 for the bat's second object (the main object) sets some variables. Phase 1 sets a timer and the movement speeds (vertical and horizontal) for the bat. Phase 2 counts down the timer to 0 before moving to Phase 3, which resets the Phase counter back to 0.

The health isn't a problem at all: Castlevania uses a global health variable for the bosses. In GM, you can use the variable "health" for Trevor's health. For the boss, just make a new global variable "boss_health". When a baby bat gets hit, you subtract from boss_health. That's all there is to it. And yes, that's based on Konami's coding.
« Last Edit: November 24, 2012, 10:11:43 PM by TheouAegis »
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline Las

  • Vampire Hunter
  • ***
  • Posts: 475
  • Gender: Male
  • Whoa dude!what a horrible night for no beer.....
  • Awards 2016-02 Sprite Contest 1st Place
    • Awards
  • Likes:
Re: NES-Style Castlevania Belmont Engine for GameMaker! (Version 0.3 UPDATE!)
« Reply #328 on: November 25, 2012, 03:47:31 PM »
0
Oh wow that's cool on the bats. Yeah i'll have to try to just subtract like i did on the MrDbosshealth-=160 or soemthing. I'll play around with it. One thing i was going to do when coding them is put them on paths. I know how to do that at least. And i figure if all i ahve to do is make it so they subtract a certain amount then split off again then i should be ok. I mean they will continously loop on their paths anyways. Thanfkully the bat is a very easy boss to code in, nothing too complex like drac or some of the others.

Cool and thanks. I'll letcha know if i make progress. As for the bone dragon, i've already got him fully working, it's just a matter of figureing out how to turn his head one way while he moves that way on the path like image_xscale=-1 or something. I dunno i think it's with tranformign the sprite. It turns upside down and the otehr way and i dont have it mirrored or vertically flipped. As for the body pieces, they are all in play working just fine as they should be. And of course theirs the getting the other version to start at full health and go down to half health.

Taking Edward Scissorhands to a whole new level!

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1861
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Re: NES-Style Castlevania Belmont Engine for GameMaker! (Version 0.3 UPDATE!)
« Reply #329 on: November 25, 2012, 09:23:00 PM »
0
Well, you can go the way of using paths, but the bats were semi-random and didn't actually use paths. They just flew in one direction for a few steps then flew in another for a few steps then flew in another and so on and so on. Testing in-game, they obviously base this on Trevor's coordinates but I didn't see it in my code, so either I just overlooked it in my code or I missed something my first few times looking over it.

Bosses are a pain in the ass to code. Their movement's not only set in the Step event (well, CV3's equivalent of the Step event), but also the Begin Step and End Step. I have a llllloooootttt of code to read through with multiple branches, so it's taking me a long time just to get through the bats.
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Tags: