The way things work

From OHRRPGCE-Wiki
Jump to navigation Jump to search
Revise.png
This article or section is not complete. If you wish, you may finish it, and remove this tag when you are done.

Note: This document is a slightly humourous, but accurate, explanation of why we do things the way we do, in terms of the source code, and management of the OHR.

Note 2: This document was written by Mike Caron, and may be biased. Tough.

Why do we do things the way we do?[edit]

The biggest thing to remember with the OHR is this:

The O.H.R.RPG.C.E. was a DOS program, created by one person for the vast majority of its lifespan, and the 32-bit ports are direct source ports of the original code

If you don't keep this in mind, you will be utterly confused about everything.

Source formatting[edit]

Those familiar with FreeBasic's preferred syntax knows it looks something like this:

'in a .bi file somewhere
Declare Function Foo(as string, as integer = 0) as string
'the function itself
Function Foo(bar as string, baz as integer = 0) as string
 Return baz & bar 'string concatenation
End Function

However, in the world of QBasic, that same function would look like this:

'scattered throughout every module
DECLARE FUNCTION foo$(bar$, baz)
'somewhere above
DEFINT A-Z

'the function
Function foo$(bar$, baz)
 foo = str$(baz) + bar$
end function

Clearly, the first version is cleaner, more easily understood, and less dependant on its surroundings. But much code looks like the second version, mainly because QBasic did not provide many of the conveniences of FreeBasic. It still works under FreeBasic, but is just ugly.

A beginning hacker may want to try and clean up the code, to update it to the best standards... but, don't even bother. If you happen to be hacking on a sub, sure, by all means. But, actively going out and cleaning things up for style alone really is a waste of time.

File formats[edit]

Back in the QBasic days, there were two formats: String and Integer (well, really, there were a couple others, but no one cared). As QBasic was 16-bit, Integers followed suit, being limited between +32,767 and -32,768 (see What is so special about the number 32767?). This is the source of many of the limitations we have. When we moved to 32-bit, many of these limitations vanished, along with memory restrictions, and awesome, new hi-res video modes with up to 24 bit colour!

Problem is, all the existing RPGs had files that used 16-bit integers, 8-bit colours (and 4-bit sprites), etc etc. So, we had to stick with that, and many restrictions will remain simply for the lack of will to correct the file formats that enforce these restrictions in the first place.

For example, let's look at the enemy data. Anywhere that references the enemy data uses a 16-bit integer to do so. In other words, even if you could create more enemies than that, there would be no way to access them. In order to access more enemies, you would need more room. And, as is shown, there isn't any room to be had.