Camen Design

© copyright

Kroc Camen Writes: #1

This is one of a series of personal letters written to / from Tanner Helland during 2003–2005. These letters cover—in immense detail—events in my life during that period, including many unfinished and aspiring designs and creations. As a person however, I have changed from the inexperienced, often immature person I was and my skills in programming and web-design have changed just as radically.

These letters have been republished to give deep insight into the way I tick, and to show a lot of background work that lead up to the concepts and skills needed to produce this website, which ultimately I failed to do so back then.

About the Letter

This, my first letter in reply to Tanner catches up on a few questions he had posed and mainly discusses Badly Drawn Adventure, a computer game programming project I had started creating earlier in the year and that Tanner had knowledge of via online exchanges before his offline excursion began.

Whilst you will be left lacking basic background knowledge about Badly Drawn Adventure at this stage, my later letters cover it in great detail and provide all the background design.

You can tell I’ve never written a letter before, it’s extremely idiotic. I was more used to IM. Note that throughout all my letters emoticons are used that were lifted from ezBoard, the forum system we all used on TGP and other sites (it was the GeoCities of forums at the time, before phpBB became popular).

Kroc Camen Writes

Whoa that’s a lot of questions! Obviously you’re eager to know every tiny detail of what’s been happening since leaving, and of course I’m here to inform. So let’s get down to business.

1. What up friend?*

The sky.

2. What’s new in England?

Nought, diddly-squat, nadda. Nothing ever happens here :P

3. Anything Cool?

Re-read answer two. :D

4. How’s CBUK?

The story here isn’t so good. The two friends helping me to build CBUK are currently very tied up at the moment so, so far this month no work has been done on it. I hope to get back to it soon since we only really need to finish off the web-design section.

Badly Drawn Map Editor:

When I sent it to you I had hurriedly zipped it up and forgotten to include the VBA hook control. You only needed to remove the reference and delete any code referencing it since all it controlled was the custom shortcuts. Since the HoTMeaL common DLL is stored elsewhere I had also forgotten to include that, the GUI would’ve looked better because the gradient command was used to spruce up the blue bars, but I’m sure you saw those in the screen-shot. Oh and about obscurity—because I have so much stuff on my hard disk the only way to get it tidy is to have b’zillions of folders :D Badly Drawn Map Editor is stored in “C:\Documents and Settings\Kroc Camen\My Documents\VBProjects\Games\Y\_Dev\Map”1 which is only 7 deep, I have some stuff 12 folders deep!

The background paper texture is completely digital, it’s created using the XenoFX ‘crumple’ plugin on a plain white background, the crumpled edges where done on a separate layer so that they can blend with the edge of the paper background. The only thing that is real is the tea-stain which I scanned in!2


Yes, I kinda got side tracked on this one, well actually DF got me side tracked on this one. He said he had some songs and I said that DS3 had MSP54 and I asked him to send me what he had. That thread was soon forgotten; but just recently he asked me where MSP5 was and that reminded me so I asked again for him to send me his stuff… :P

5. So how is everybody now that Clint is back?

Clint just walked back in and everybody was like he never left, he just gelled right back into the team as if had never left. Those who posted were glad to see him again. Problem is that his return was badly timed as the team has recently fallen into one of those periods where nobody is around and nothing happens at all, most likely due to everybody suddenly hitting a busy point in their lives.

6. Hear anything from Wuta or Interest since they left?

Zero, haven’t heard a peep from both of them. Wuta I’m sure is working his socks off and Interest is probably lounging around somewhere at somebody else’s expense5 lol

7. Has DF given you any good music yet?

As you know, when he gets ‘round to sending it to me.


8. See anything more from Asuka since I last checked?

Nope, because of this horribly slow period the team’s going through right at the moment.

9. How about Vegeta—gotten some 3D models yet?

Clint was talking about modelling so I asked samples from him and Vegeta, Clint got back quick but Vegeta must’ve forgotten about that post, guess I’ll have to post again.

Things may have been pretty uneventful so far – but due to my over-pessimistic view there might well have been something half-decent that I might have overlooked. I did have a spurt of enthusiasm about a week ago; do you remember the picture of Clint I drew when he left the team? Well I eventually managed to find the strength to have another attempt at colouring it in. Resulting in: (see the back page)

It’s not finished obviously but it’s something, I finally managed to work out how to do an effective metal, err, effect. Maybe I’ll get the picture finished one day; the next hurdle to get over is realistic clothing effect, gah!

Now what? The fact I’ve run out of stuff to say certainly shows how little has happened, and I’m so well known for writing great huge lengthy posts lol

Kroc goes off to play Sonic and Knuckles, manages to get to the last boss and dies only a couple of hits away from completing the game, Damn you Robotnik! I’ll get you next time

Ah well s’pose I can gap fill by going into a bit more detail about Badly Drawn:
I intend to basically produce this game in two side-by-side steps. First create the level editor so that I can create and save object files and level files etc, then program support for the files into the game itself. At the moment I’ve almost finished the object editor, which outputs the objects that make up the world, once complete I can then program the game itself to load the object files and display/animate/move them etc.

It’s a lot of work to get little visible evidence afterward because you have to spend plenty of time back coding the data structure and animation support etc, so after months of coding all I’ve got is a stick-man walking back and forth :P But the important thing is that the structure is behind it so that any object can be used, etc.

I’m hoping to make the game code itself as open plan as possible so that the scripting engine handles how an object interacts entirely which is less restrictive than hard coding object interactivity into the game. For this to work a very, very fast scripting engine is needed—but hark, I’ve thought about that also!

As far as I know, only Asuka and I know about machine language programming (possibly Vegeta101 also), but anyway Machine Code (MC or ASM) is the ultra-low level programming language that flows directly through the CPU. Therefore MC commands are broken down to tiny, tiny little steps so that each can be processed as a single instruction. Now I’m familiar with Commodore64’s 6502 processor machine code and here’s a brief crash course in machine code:

Say you want to execute “MyVar = 6 + 5”, now you’d think that, that is a single instruction, but it can be broken down even further;

LDA #05		;Load the ‘A’ registry with 5
ADD #06		;Adds the ‘A’ registry to 6
STA MyVar	;Stores ‘A’ in MyVar

Because machine code can only consist of single commands, you cannot have multiple parameters so the CPU has 3 registers that store numbers used in functions. Because these registers are automatically used in functions, you do not need to pass a function any parameters because the values can be loaded into the registers beforehand.


And it’s because of the low-level simplicity of Machine Code that it makes a great scripting language (or at least the compiled version of a scripting language). Your program is not slowed down by trying to read parameters; the function just goes straight to the registers to get the parameters. In Badly Drawn the kernel commands use this to the full, i.e.:

LDA #01    ;Load ‘A’ register with 1 – the index of the object
LDX #02    ;Load ‘X’ with the index of one of the object’s animations
KRN ANIM   ;Starts an anim, it uses ‘A’ as the object and ‘X’ as the anim

The 6510 was the C64’s 6502 based 1 MHz (Wow, speedy!) CPU and I’ve basically ‘borrowed’ the MC command set from there and added my own improvements so hopefully this should simplify scripting and keep the speed up. I do intend to have a higher level language and use the MC as the compiled script because writing MC is difficult and time consuming. I had an idea of using something based on XML i.e.:

<if expr=[v1+v2] result=[true]>
	This text will display in debug output if v1+v2 is equal to 3.
	<!-- Else is optional -->

Which would compile to:

LDA v1			;Load A with the value of v1
LDX v2			;Load X with the value of v2
CAX			;Compare A with X
BNE #02			;Branch if Not Equal – Move down 2 lines
DBG "This text..."	;Print Debug Output
BRK			;Stop (break)

As you can see, something like that would require minimal processing because things like the compare function doesn’t handle the redirection, it just returns if it was equal, not equal, greater than, etc and then you decide afterward with BranchIfEQual, BranchIfNotEqual, BranchIfGreaterThan, BranchIfGreaterThanOrEqualTo, BranchIfLessThan and BranchIfLessThanOrEqualTo—thus the branch command doesn’t need to redo the ‘if’ command, its result would’ve already been stored by the compare command (which requires no parameters saving shed-loads of time).

The limitations are that you only have 3 registers, so if you want ‘if’ commands inside each other, the computer needs somewhere to temporarily store values whilst it uses the registers for something else. Therefore you can use something you’ll be familiar with—a stack. You just use simple command like PHA (Push ‘A’ to stack) and PLA (Pull ‘A’ from stack) etc.

And since the MC will be compiled it’ll be stored as binary tokens and not as the 3 letter codes. Each instruction is 5 bytes—one for the instruction and a 4 byte long value for the parameter. Thus to run a script all it involves is skipping through a string 5 bytes at a time and executing very, very short routines for each, i.e.: Genius!!! :P

Public Sub S6502e_LDA_VALUE(lValue as long)
	S6502e_CPU_A = lValue 'Set the A-register to the value
End Sub

On the next page are the token byte values for all commands, excluding the kernel commands since I haven’t thought of them all yet.

The kernel commands are MC commands specific to the particular program, whereas the others would apply regardless of the program they were in, thus Badly Drawn’s Kernel MC commands are used to interface with Badly Drawn’s own variables—i.e. request the X, Y position of an object, start an object animation etc.


This means that the scripting engine, once written, could easily be ported to any other application. The only changes would be to write a set of appropriate kernel commands for that app. All the other commands would run through the script engine fine.

~> ’Scripting_6502_Enhanced '-------------------------------------------------------------------------------- ’Load Commands - Load register with given value / variable '-------------------------------------------------------------------------------- S6502e_LDA_VALUE = &H0 ’Load Accumulator with value S6502e_LDX_VALUE = &H1 ’Load X-Register with value S6502e_LDY_VALUE = &H2 ’Load Y-Register with value S6502e_LDA_VARIABLE = &H8 ’Load Accumulator with value of variable S6502e_LDX_VARIABLE = &H9 ’Load X-Register with value of variable S6502e_LDY_VARIABLE = &HA ’Load Y-Register with value of variable '-------------------------------------------------------------------------------- ’Store commands - put register into a variable '-------------------------------------------------------------------------------- S6502e_STA = &H10 ’Store the Accumulator in variable S6502e_STX = &H11 ’Store the X-Register in variable S6502e_STY = &H12 ’Store the Y-Register in variable '-------------------------------------------------------------------------------- ’Transfer Commands - copy one register to another '-------------------------------------------------------------------------------- S6502e_TAX = &H20 ’Transfer Accumulator to X-Register S6502e_TAY = &H21 ’Transfer Accumulator to Y-Register S6502e_TXA = &H22 ’Transfer X-Register to Accumulator S6502e_TXY = &H23 ’Transfer X-Register to Y-Register S6502e_TYA = &H24 ’Transfer Y-Register to Accumulator S6502e_TYX = &H25 ’Transfer Y-Register to X-Register '-------------------------------------------------------------------------------- ’Increment Commands - add to a register '-------------------------------------------------------------------------------- S6502e_INC = &H30 ’Increment Accumulator by value S6502e_INX = &H31 ’Increment X-Register by value S6502e_INY = &H32 ’Increment Y-Register by value '-------------------------------------------------------------------------------- ’Decrement Commands - subtract from a register '-------------------------------------------------------------------------------- S6502e_DEC = &H40 ’Decrement Accumulator by value S6502e_DEX = &H41 ’Decrement X-Register by value S6502e_DEY = &H42 ’Decrement Y-Register by value '-------------------------------------------------------------------------------- ’Push/Pull Commands - Copy registers on and off the stack '-------------------------------------------------------------------------------- S6502e_PHA = &H50 ’Push Accumulator onto stack S6502e_PHX = &H51 ’Push X-Register onto stack S6502e_PHY = &H52 ’Push Y-Register onto stack S6502e_PLA = &H58 ’Pull Accumulator from stack S6502e_PLX = &H59 ’Pull X-Register from stack S6502e_PLY = &H5A ’Pull Y-Register from stack '-------------------------------------------------------------------------------- ’Flow Control Commands - For moving around '-------------------------------------------------------------------------------- S6502e_JMP = &H60 ’Jump relative S6502e_JSR = &H61 ’Jump to subroutine saving return address S6502e_RTS = &H68 ’Return from subroutine S6502e_BRK = &H69 ’Stop script '-------------------------------------------------------------------------------- ’Comparison Commands - For comparing values '-------------------------------------------------------------------------------- S6502e_CMP = &H70 ’Compare Accumulator with value S6502e_CPX = &H71 ’Compare X-Register with value S6502e_CPY = &H72 ’Compare Y-Register with value S6502e_CAX = &H78 ’Compare Accumulator with X-Register S6502e_CAY = &H79 ’Compare Accumulator with Y-Register S6502e_CXY = &H7A ’Compare X-Register with Y-Register '-------------------------------------------------------------------------------- ’Branch Controls - Similar to flow controls but based on prior comparison '-------------------------------------------------------------------------------- S6502e_BEQ = &H80 ’JMP relative if parameters matched S6502e_BNE = &H81 ’JMP relative if parameters did not match S6502e_BGT = &H82 ’JMP relative if 1st was greater than 2nd S6502e_BGE = &H83 ’JMP relative if 1st was greater than or equal to 2nd S6502e_BLT = &H84 ’JMP relative if 1st was less than 2nd S6502e_BLE = &H85 ’JMP relative if 1st was less than or equal to 2nd <~


Ok, that’s enough about that :D I don’t want to fry your mind with machine code, especially when you’ve got more important things to think of!

Kroc attempts to print letter, but realises is out of ink, cannot buy any because the shops are shut for Easter, two days later he finally gets a damned ink cartridge

Time to wrap up now I suppose, I hope you’re going well despite your busy schedule and all that. Oh and sorry about the ridiculous length of this letter, but this me we’re talking about. But what’s a letter without a goodbye?

Until Later,

Kroc Camen

An early version of an art piece of Clint V Franklin