Sonic and Sega Retro Message Board: Beginners Tutorials - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
  • 2 Pages +
  • 1
  • 2
    Locked
    Locked Forum

Beginners Tutorials For newbs in distress.

#16 User is offline Quickman 

Posted 12 September 2004 - 08:20 PM

  • Posts: 5584
  • Joined: 03-December 03
  • Gender:Male
  • Location::x
  • Project:omg porjcet
  • Wiki edits:10
There is no "right way" to convert. That format IS.

#17 User is offline Drakmyth 

Posted 12 September 2004 - 11:03 PM

  • Inspector Drakmyth Master at your service.
  • Posts: 420
  • Joined: 16-January 03
  • Location:In the void beneath the ancient maze...
  • Project:Sonic Eclipse 2, Return of the Hidden Palace, Unnamed Sonic 2 Hack

8-Bit Dragon, on Sep 12 2004, 07:40 PM, said:

turd talk? You mean newb talk right? Because if I go anywhere talking like a turd, I'll ether get teh ban or flamed ><.

No I meant turd. Like I said, I'm kinda messed up today so just pick out the parts that might work. I should be better tomorrow.

#18 User is offline Syren 

Posted 13 September 2004 - 02:14 PM

  • Posts: 4331
  • Joined: 20-March 04
  • Gender:Male
  • Location:Teesside, UK
  • Project:Reintergration
8-Bit dragon's been here longer than I have, so I doubt he's that bad.

Anyhow, on topic por favor.

Quote

Thank you Soil! Now hex doesn't look like a bunch of random numbers and letters to me! :)


Aah, satisfying thank you's.

What should I move onto next? Pallet hacking is one of the most basic things people do, yet they choose not to learn further and do it in hex. Maybe I could do Music hacking. What do you guys think?

The reason I ask is because I'm learning too. I wouldn't actualy know myself what offsets are in Sonic's pallet, the main pallet colours, etc, if it weren't for reaserch. And ESE.
This post has been edited by Soil: 13 September 2004 - 03:28 PM

#19 User is offline Kles 

Posted 13 September 2004 - 04:25 PM

  • Posts: 2460
  • Joined: 14-March 04
  • Gender:Male
  • Location:Ontario
  • Wiki edits:5
Do Sonic 2 music hacking. It'd be fun trying to mess around in it, and I don't know how, I'm too lazy to read up or use Sonic QX (I don't like the program, too many bells and whistles that I don't recognize.. sure, it'd probably be great if I understood. Anyways.. /tangent), so go for it :P

I wanna be able to mod it like I can (could) in Sonic 1.. if that's possible (I'm pretty sure it is.)

#20 User is offline Korama 

Posted 13 September 2004 - 04:33 PM

  • Posts: 272
  • Joined: 18-May 04

8-Bit Dragon, on Sep 12 2004, 07:06 PM, said:

Umm, this may be a dumb question, but how do you convert the rom's palette RGB values to real values. I'll explain why I am asking...

When I was trying to correct a palette for a sprite sheet, I originaly made the sheet using Gens' colors, but later I use Megasis to get cirtain sprites I couldn't in Gens and they were darker.

Okay, so maybe Gens' engine reads colors differently than Megasis, so I use SonED to sample colors...  o_O Different again! Okay, lets try ESEII, OMFG!!! The same color on all 4 was a different shade/hue/brightness ><

So then, to get a genuine palette, I began using the values in the rom, thank god they show a pattern! Now, I began constucting a palette in PSP using the values as values for html colors. For example, I would turn 0E44 into #4040E0 in html values. This is the way Megasis does it, but another program wrote these same values as #4444EE *head explodes*. WHICH IS THE RIGHT WAY TO CONVERT!?


That's no dumb question but a good one.

First, let's look at the format of a Mega Drive color value:
Hexadecimal: $0BGR
Binary (16 bits): %0000bbb0ggg0rrr0
There are 3 bits per RGB component, meaning that each component can have 8 values: 0..7.
But PCs normally use 8 bits per component (values 0..255).

So, in order to convert an MD color to a PC color, you have to scale each component from 3 to 8 bits, and that can be done in several ways.

1) The accurate mathematical conversion which uses the full target range is "PCValue := MDValue * 255 / 7", with MDValue being a number from 0 to 7. To avoid having to do that calculation every time, you could also initialise a small lookup table with the converted values, rounded to the nearest integer.
MDValue --> PCValue
0 --> 0
1 --> 36
2 --> 73
3 --> 109
4 --> 146
5 --> 182
6 --> 219
7 --> 255



2) Separate the three components into individual bytes and shift each byte 4 bits to the left. That way, $0EEE would become $E0E0E0. This method is very fast because you only need bit shifts, no multiplications or divisions. But it has the disadvantage that the full dynamic range isn't used. $E0E0E0 is no perfect white, $FFFFFF would be it. This list shows the results of the conversion:
MDValue --> PCValue
0 --> 0
1 --> 32
2 --> 64
3 --> 96
4 --> 128
5 --> 160
6 --> 192
7 --> 224


3) There is a method that combines the benefits of the first (full range) and second (only bit operations required, no other arithmetics) ways. It works in all situations where you have to expand a certain number of bits.
The formula for our case here is "PCValue := (MDValue shl 5) or (MDValue shl 2) or (MDValue shr 1)", with "shl" being binary left shift, "shr" binary right shift and "or" binary OR. MDValue is a number from 0 to 7 again.
I'll try to illustrate what this does:
MDValue = %xyz (three bits)
%xyz00000 (MDValue shifted 5 to the left)
%000xyz00 (MDValue shifted 2 to the left)
%000000xy (MDValue shifted 1 to the right)
---------- combine with OR
%xyzxyzxy (resulting PCValue, using the full range of 8 bits)

The results of this function are the same as those of method 1. Neat, eh?


Finally, to convert an 8 bit PC component back into a 3 bit MD component, you just shift it 5 to the right (that is, you take the 3 most significant bits of the PC component and discard the rest).
This post has been edited by Korama: 13 September 2004 - 04:35 PM

#21 User is offline 8-Bit Dragon 

Posted 13 September 2004 - 04:38 PM

  • Posts: 839
  • Joined: 12-February 04
  • Gender:Male
  • Location:Gainesville, Florida
  • Project:Too many!
  • Wiki edits:2

Drakmyth, on Sep 12 2004, 11:03 PM, said:

8-Bit Dragon, on Sep 12 2004, 07:40 PM, said:

turd talk? You mean newb talk right? Because if I go anywhere talking like a turd, I'll ether get teh ban or flamed ><.

No I meant turd. Like I said, I'm kinda messed up today so just pick out the parts that might work. I should be better tomorrow.

Actually, there is a difference between a turd and a newb. <_< But I am nether, I don't talk like a turd "I m4de aN c0ol h4cK!!!111" and I am not newb (new) to Sonic games/hacking. I merely have a few unresolved issues with image editing.

#22 User is offline Syren 

Posted 13 September 2004 - 04:49 PM

  • Posts: 4331
  • Joined: 20-March 04
  • Gender:Male
  • Location:Teesside, UK
  • Project:Reintergration

Kles, on Sep 13 2004, 04:25 PM, said:

Do Sonic 2 music hacking. It'd be fun trying to mess around in it, and I don't know how, I'm too lazy to read up or use Sonic QX (I don't like the program, too many bells and whistles that I don't recognize.. sure, it'd probably be great if I understood. Anyways.. /tangent), so go for it :P

I wanna be able to mod it like I can (could) in Sonic 1.. if that's possible (I'm pretty sure it is.)

I advise you to read the Sonic QX manual, it's not that hard to understand, the program gets is easier to understand, and you can produce some severely kick ass sounds with it (like .hack//zero's CNZ music).

Thanks for the suggestion though, I had a feeling I might be doing that next.

Any more suggestions are welcomed with open arms.

Note to self: Read what you type in future.
This post has been edited by Soil: 13 September 2004 - 04:50 PM

#23 User is offline Drakmyth 

Posted 13 September 2004 - 07:26 PM

  • Inspector Drakmyth Master at your service.
  • Posts: 420
  • Joined: 16-January 03
  • Location:In the void beneath the ancient maze...
  • Project:Sonic Eclipse 2, Return of the Hidden Palace, Unnamed Sonic 2 Hack

8-Bit Dragon, on Sep 13 2004, 04:38 PM, said:

Actually, there is a difference between a turd and a newb. <_< But I am nether, I don't talk like a turd "I m4de aN c0ol h4cK!!!111" and I am not newb (new) to Sonic games/hacking. I merely have a few unresolved issues with image editing.

Yeah, I know the difference and I'm feeling much more myself today. But it seems the problems here have been solved so I'll turn my attention elsewhere.

#24 User is offline Quickman 

Posted 14 September 2004 - 11:41 AM

  • Posts: 5584
  • Joined: 03-December 03
  • Gender:Male
  • Location::x
  • Project:omg porjcet
  • Wiki edits:10
Shit, nevermind. I'm a fucktard.
This post has been edited by Quick Man: 14 September 2004 - 11:42 AM

#25 User is offline Syren 

Posted 15 September 2004 - 12:35 PM

  • Posts: 4331
  • Joined: 20-March 04
  • Gender:Male
  • Location:Teesside, UK
  • Project:Reintergration
I'll write a few more things in a few weeks. I might not be working on them ASAP nor posting them soon, because it's my last year of highschool and that's definately my priority. Topic name changed to Beginners Tutorials, just so that I don't have to keep making topics.

Note: :D YEY ARCHIVE MATERIAL FROM MOI :D
This post has been edited by Soil: 18 September 2004 - 02:06 PM

#26 User is offline steel 

Posted 19 September 2004 - 02:26 PM

  • Posts: 1
  • Joined: 10-September 04
  • Location:Pudsey, Leeds
Soil, just want to say thanks for this tutorial! :D
It has really helped me out! When I first opened up Hex Workshop, and the Sonic 2 ROM, I was like :shocked: I almost cried myself to sleep it has that hard to understand. Now that I've read your tutorial, I have grasped a firm understanding of the basics!
Thanks!! :)

#27 User is offline Syren 

Posted 19 September 2004 - 02:44 PM

  • Posts: 4331
  • Joined: 20-March 04
  • Gender:Male
  • Location:Teesside, UK
  • Project:Reintergration
Glad I helped. I'm working on a next tutorial, but due to higher priorities, it won't be posted soon.

#28 User is offline Syren 

Posted 28 October 2004 - 07:44 AM

  • Posts: 4331
  • Joined: 20-March 04
  • Gender:Male
  • Location:Teesside, UK
  • Project:Reintergration
I've left this topic too long, so I'm going to update it with a mini update.

Begginers guide to Hex - What does it do, anyway?

Some people could say that hex is just numbers and letters. It is. But it also represents the binary code and the ASM code.

Binary code is basically 1's and 0's. The reason why nobody uses binary code in hacking is because it is so inconvenient to work with. The binary counting system works like this:

HEX --- BINARY
01 -----0001
02 -----0010
03 -----0011
04 -----0100
05 -----0101
06 -----0110
07 -----0111
08 -----1000
09 -----1001
0A -----1010

As you can already see, it's very tedious to work out what something like 4E75 would be in binary.

So what can one do with hex? Simple. Lots.

Since hex is basically a representation of binary (and stuff in ASM), and you can change what it represents, you can almost change anything. There are limitations though.

For example, in the pallet hacking tutorial (see page one, post one in this topic), you change the numbers and letters in hex so that the hex code changes what it represents. Pallets are only the start. With hex, you can change music, level layouts, pallets, and how things act. Of course, without a guide of some sort, it would be very frustrating to work out what piece of hex in the entire ROM does what. But I'll save that tutorial for a rainy day.

I hope this clears some things up for some people. And please, I'm still new to this, so if there are any mistakes tell me immediately.

EDIT: If anyone wants to red further on the hex system, there is a topic that has links to stuff about hex and 68kASM (which I won't go into.)

The topic with links. (Linky)
This post has been edited by Soil: 28 October 2004 - 08:35 AM

  • 2 Pages +
  • 1
  • 2
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users