Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Learning the Source

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> Paradox Lounge
View previous topic :: View next topic  
Author Message
Bagne
ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA




Joined: 19 Feb 2003
Posts: 518
Location: Halifax

PostPosted: Mon Nov 09, 2009 8:33 pm    Post subject: Learning the Source Reply with quote

I'm toying with the idea of learning about some of the OHR source code.
Then maybe I don't need to ask everyone so many questions ... or maybe I'll just be asking more :-D

Would anyone be able to point me towards a good place to begin?
game.bas or something?

Is it a problem that I don't really know basic?
I know some other languages at a 1st year university-ish level of competence, and I'm coding FORTRAN and MATLAB practically every day.
_________________
Working on rain and cloud formation
Back to top
View user's profile Send private message
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Mon Nov 09, 2009 9:11 pm    Post subject: Reply with quote

The code is all in the .bi files. If you're familiar with C++, the .bas files are used as header files and the .bi files contain the function implementations.

The code is a disorganized mess. If you want to dive into the code, most of the meatier stuff is in common.bi and the yetmore files.

BASIC is, you know, pretty basic. There will be some things that you don't know what they do, but you should be able to hack it without much trouble if you already know other languages.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Tue Nov 10, 2009 3:57 pm    Post subject: Reply with quote

Almost. The .bi files are the headers, and the .bas files are the implementation files.

Most of the code is messy, but a lot of it is getting better.

makegame.bat and makeedit.bat are used to build game.exe and custom.exe respectively.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Fri Nov 13, 2009 12:23 am    Post subject: Reply with quote

There is no guide anywhere as to the organisation of the code. The only somewhat relevant documentation is 'RPG Format#List of Lumps' (which might be needed for understanding some things). You can check makegame.bat and makeedit.bat to find out which source files are part of Game, which are part of Custom, and which are common. To get by, you need to use grep or some other search-in-files tool/editor function (eg tags) heavily.

You can find the code for something in Custom by starting from the main menu (although the code for many menus is nonlinear and very hard to follow). Finding anything in Game is generally harder; the 'main loop' is a complete mess. To find anything in the battle engine, which I am the least familar with, I just search for a keyword (eg. 'damage') or browse randomly and then follow leads as I find them.

If you have any specific question, just ask.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Bagne
ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA




Joined: 19 Feb 2003
Posts: 518
Location: Halifax

PostPosted: Sun Apr 25, 2010 7:18 pm    Post subject: Reply with quote

I'm confused - I'm checking out some of that graphics source stuff mentioned in a post long ago ... and blit.c is ... well, it's written in C. Is the OHR written in both FreeBasic and C?
_________________
Working on rain and cloud formation
Back to top
View user's profile Send private message
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Sun Apr 25, 2010 7:54 pm    Post subject: Reply with quote

The OHRRPGCE is mostly written in FreeBasic, but some parts, such as blit.c or the directx backend are written in C/C++. An the hspeak compiler is written in Euphoria.

Last november when TMC said there was no guide to the organization of the source files, that was true, but recently we have written a little one. See: 'Guide to source files'.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Mon Apr 26, 2010 1:50 am    Post subject: Reply with quote

And we didn't have blit.c in November either.

Suggestions for making that documentation more helpful?

blit.c is the only thing written in C, but the new script interpreter which hasn't been checked in yet is written half in C and half in C++. Why, is C bad? I guess many people are scared of C, I certainly was once. Since then, because of Unix and other influences I've come to a mindset of "all experienced programmers know C and it's the least scary of all languages," which is pretty absurd now that I think about it.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Bagne
ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA




Joined: 19 Feb 2003
Posts: 518
Location: Halifax

PostPosted: Mon Apr 26, 2010 3:59 am    Post subject: Reply with quote

I'm actually much more familiar with C (from 1st year CSci training. So, your proverb was let's say, 1/4 verified).
I like structs.
I don't really care what it's written in, so long as it's not LOLcode.

My limited programming experience has me thinking: "Everything must be written in one language! What's C doing here?" but I guess you can do it however you want so long as you have the right compilers and a proper makefile, yeah?

Hah - ok - let's put it this way: C doesn't intimidate me at all - but big crazy makefiles do :-)
I'm still learning makespeak.
_________________
Working on rain and cloud formation
Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Mon Apr 26, 2010 5:29 pm    Post subject: Reply with quote

We don't actually have proper makefiles :(. Maintaining the .bat build scripts is a nightmare, it's really time to move to something else. Makefiles intimidate me too; we could use an alternative.

If you look around the source repository, you'll see we use two dialects of FB, C, C++, Euphoria, QuickBasic, x86 assembly (old DOS releases), HamsterSpeak, Python, PHP, Shell scripts, Emacs Lisp, and even GDB scripts. Only FB, C, and C++ are linked into the OHR. Who knows what will be next?
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Bagne
ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA




Joined: 19 Feb 2003
Posts: 518
Location: Halifax

PostPosted: Mon Apr 26, 2010 5:55 pm    Post subject: Reply with quote

How about these languages?
http://en.wikipedia.org/wiki/Esoteric_languages


Oi, ok ... I think I'm in way over my head.

Is there an easy way to explain how Darwine is supposed to work on my Mac OS? I have it installed ... supposedly :-S
How would I go about installing FreeBasic with Darwine? How would I use it to compile the OHR code? I don't really understand this whole bottle thing.
(EDIT: I'm not even sure that I have "Darwine".
The official Darwine site seems to be here, but the x86 link is broken.
I think I'm using WineBottler)

Euh ...
Maybe I should try compiling under windows first before the Mac OS.
Baby steps or something.


What? No makefile?
Man, this program was written by aliens. Someone posted about the linking system a while ago ... I guess I'll have to read that.
_________________
Working on rain and cloud formation
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> Paradox Lounge All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group