Custom RF Build

Programming Reality Factory and Genesis3D.
Post Reply
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Custom RF Build

Post by Jay » Sun Nov 22, 2015 11:20 am

Hello. I did some heavy modding of my RF version+GenesisLib source code. This is based on the 076source, since sadly there is no later one available (i tried to get the 080source code but no sucess...). This post is also a test if anyone actually reads these forums anymore.
Some highlights: [CODING] changes affect coding. [PERF] changes are possible performance changes. [SCRIPTING] affects in-game scripting.

GenesisLIB:
-[CODING] GenesisLIB now fully migrated to c++.
-[CODING/PERF] threw out some of the "__asm" stuff because modern compilers can optimize better. Kept the sqrt-non-double version using fpu.
-[CODING/PERF] XForm3d+ almost entirely rewritten for better readability, stability (no more modifying const variables), for the compiler to better optimize... extra overridden functions from the migration to c++.

Realityfactory:
-[CODING] created a base class for new global scriptobjects
-[SCRIPTING] moved Input scripting to new "Input" scriptobject
-[SCRIPTING] moved Camera scripting to new "Camera" scriptobject
-[SCRIPTING] moved Math scripting to new "Math" scriptobject+lots of Math functions
-[SCRIPTING] moved Force scripting to new "Force" scriptobject
-[SCRIPTING] moved scripting for things like WindGenerator, Gravity, etc... to new "Environment" scriptobject
-[SCRIPTING] added a few script methods here and there

One particular "Genesis3d gem" i found while migrating to c++ is a coding structure that i have NEVER seen before:
It used a macro inside a macro to build the HEADER of a for-clause. This for clause then was based around the fact that it traversed a struct which had an inside list-struct at the beginning of said struct. (so each struct has a list struct) Because in C you can switch very easily without much syntax between pointer types, it then casted freely between the list and the node pointers of the same object to traverse the list (which works because their addresses are the same) And all of this mumbo-jumbo was done to delete a simple list. I didn't want to touch the data structures of Genesis3d in any way in order to not break code - Genesis3d breaks at the slightest changes.. So I expanded the macros and kept it in peace.
Everyone can see the difficult, but only the wise can see the simple.
-----

User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: Custom RF Build

Post by QuestOfDreams » Sun Nov 22, 2015 2:51 pm

Realityfactory:
-[CODING] created a base class for new global scriptobjects
-[SCRIPTING] moved Input scripting to new "Input" scriptobject
-[SCRIPTING] moved Camera scripting to new "Camera" scriptobject
-[SCRIPTING] moved Math scripting to new "Math" scriptobject+lots of Math functions
-[SCRIPTING] moved Force scripting to new "Force" scriptobject
-[SCRIPTING] moved scripting for things like WindGenerator, Gravity, etc... to new "Environment" scriptobject
-[SCRIPTING] added a few script methods here and there
Actually, with many of these changes you have duplicated work I had already put into RF 0.78.
Sorry, I must have missed your request for the actual source code. Speaking of which, I will move my current base code to github.com to make it more accessible for those still interested.
These days, however, you can get e.g. Unity or Unreal Engine 4 SDKs for free, which have much more advanced engines AND tools, so I really don't see too many applicabilities other than a mere coding playground.

User avatar
aicd99
Posts: 264
Joined: Mon Oct 10, 2011 11:17 am

Re: Custom RF Build

Post by aicd99 » Mon Nov 23, 2015 1:37 am

QuestOfDreams wrote:
Realityfactory:
-[CODING] created a base class for new global scriptobjects
-[SCRIPTING] moved Input scripting to new "Input" scriptobject
-[SCRIPTING] moved Camera scripting to new "Camera" scriptobject
-[SCRIPTING] moved Math scripting to new "Math" scriptobject+lots of Math functions
-[SCRIPTING] moved Force scripting to new "Force" scriptobject
-[SCRIPTING] moved scripting for things like WindGenerator, Gravity, etc... to new "Environment" scriptobject
-[SCRIPTING] added a few script methods here and there
Actually, with many of these changes you have duplicated work I had already put into RF 0.78.
Sorry, I must have missed your request for the actual source code. Speaking of which, I will move my current base code to github.com to make it more accessible for those still interested.
These days, however, you can get e.g. Unity or Unreal Engine 4 SDKs for free, which have much more advanced engines AND tools, so I really don't see too many applicabilities other than a mere coding playground.
No one at the RFforums cares about Unity or other game engine we are into RF only QOD hanks

User avatar
aicd99
Posts: 264
Joined: Mon Oct 10, 2011 11:17 am

Re: Custom RF Build

Post by aicd99 » Mon Nov 23, 2015 1:39 am

and will that beta 2014 Release of RF becomes completed ?? QOD please I really want that software to be made

Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: Custom RF Build

Post by Jay » Mon Nov 23, 2015 11:55 am

Acid99, let's be real.
We are dealing with the granddad of GameCreationSystems. I think a lot of users actually went to newer GameEngines, since their tools have improved rapidly in the last years, and some went "free" (meaning i you don't have to invest money just to get the SDK). When RF came out, it was one of a kind and making a game (even modding required coding for the most part) required you to write tools and write code and (i think the most important part) invest money.
Also, even from a coding standpoint, it makes almost more sense to rebuild RF around a modern Engine (i have no idea what happened to RF2. I have no idea what happened to AndyCR) than still using Genesis3d.

I am not sure if you ever looked at the Genesis3d source code. It is a nightmare to even read... plus there are a lot of "//I changed this" "#if 0 {(50 lines outcommented code)}" "/* (50 lines outcommented code */" inside the source code. It makes it really hard to read. It makes a lot more sense to write changes into a kind of changelog at the beginning of the file, or a doc file or something. I can actually understand the G3D source code BETTER when i remove those comments. Before i could do any adjustments, i first had to clean up the code ... i did part of that while fixing the 2000 compiler errors it gave (c++ does not allow the c-hacks it uses natively (casting from void* to char* to uint32* and back again, casting from signed to unsigned types and back again... you must specifiy that you explicitly want to use those hacks...). It does that ALL the time. (>2000 times actually, once i fixed the bulk of it, the compiler found more, it was like "WHEN WILL THIS NIGHTMARE END". I am still amazed i did not break it with all this copy+paste.) Whoever built this monster has my respect for making sure that it is alive. But it is not very modular, you cannot just add a arm or two, because the monster still thinks it has only 8 of them and the extra two arms are prone to necrosis and kill the whole thing.

(Theorethical) Genesis3d Example:

Code: Select all

//Change MightyLordOfAwesomeness 23_11_15: BLOP_MAPPING
/*t.x += BLOP.X*Scale;
t.y += BLOP.Y*Scale;
t.z += BLOP.Z*Scale;*/
//End Change MightyLordOfAwesomeness 23_11_15: BLOP_MAPPING
//Change MightyLordOfAwesomeness 24_11_15: BLOP_MAPPING: Optimization
//Oops... i forgot i could do it with a geVec3d_AddScaled(...)
geVec3d_AddScaled(&t,&BLOP,Scale,&t);
//End Change MightyLordOfAwesomeness 24_11_15: BLOP_MAPPING
Note how this code is even undefined behaviour, because the first paramter of geVec3d_AddScaled() is a pointer to a const variable, that means we are telling the compiler we are NOT going to change the variable in any way (It may do some pretty aggressive optimizations based on that)... yet the last parameter (the result pointer) is not a pointer to a const variable. But because it is the same, we are in essence modifying the first variable which we told the compiler we are NOT going to change. This is undefined behavior (it may crash, it may work - on your machine, it may do things we cannot expect without looking at the assembly. I am NOT going to look at the assembly, I trust that a compiler can do its job as long as i can).
This was one of the reasons i migrated to c++ - because now i can override the functions inside the LIB and use a function-calls-function approach (like it is standard when you define operators on types to treat them like base-types. The greatest feature of C++ ever, i really miss overloading operators when i program in Java - practically the only thing i miss, yet it makes sense from a language philosophy). Now, the code is not undefined behaviour anymore and in those case where it would be slower, the compiler can choose to optimize it (which it will) if it is safe.

But yes, QoD, it is basically a coding playground. The main reason i duplicated the work was because i did not get the source code from you a long time ago (The forum was really active these days, i think your reasoning was that you wanted to do a lot of things with RF before giving away the source code), and i saw noone was posting around here... i assumed everyone had left.
Everyone can see the difficult, but only the wise can see the simple.
-----

User avatar
aicd99
Posts: 264
Joined: Mon Oct 10, 2011 11:17 am

Re: Custom RF Build

Post by aicd99 » Tue Nov 24, 2015 6:12 am

Cool now could I test out a costom build please.

Could you port this to mac as well ???

Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: Custom RF Build

Post by Jay » Tue Nov 24, 2015 2:01 pm

@acid99: Cannot port to Mac. Way too much work. To do something like that, you could just rewrite Realityfactory,Genesis3d, etc etc. Second, i don't think MSVC++ does not support. Third, i have no idea how to program for mac (besides Java).
And all this "unsafe Genesis3d" behavior might just break with mac.

As a side note, i am also trying to exchange the compiler of MSVC++ Express 2008... (The Microsoft compiler is bad at optimization, especially for SSE...)

@QoD: It would be nice to have a code dependency map for all of RF. I mean, fore example, what is actually dependent on Genesis.dll, or are they all statically bound? When i rename the file, so far at least the editor works.

Right now i am having problems with GBSPLib.dll, when i compile it... the game just breaks. The editor also gives me some warnings about LeafMightSeeLeaf that weren't there before. Luckily i still had a backup.
Everyone can see the difficult, but only the wise can see the simple.
-----

User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: Custom RF Build

Post by QuestOfDreams » Fri Dec 04, 2015 5:00 pm

Phew, turns out my previous SVN hoster decided to deem the repository abandoned after 6 months of inactivity and removed it, which basically leaves me with my local working copy of the code but no commit/revision history (SVN doesn't store that locally - another reason I want to move to git).

Thus far I've moved the already released code of the Genesis3D engine and RealityFactory executable to
https://github.com/realityfactory
trying to preserve some history.
Next will be Genesis3D & RF tools and my current developments.
Jay wrote:@QoD: It would be nice to have a code dependency map for all of RF. I mean, fore example, what is actually dependent on Genesis.dll, or are they all statically bound? When i rename the file, so far at least the editor works.
RealityFactory is linked statically against the Genesis3D library as are most of the tools that require it. Right now I don't remember which program requires the Genesis3D.dll (could be obsolete as well).

Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: Custom RF Build

Post by Jay » Tue Dec 22, 2015 5:43 pm

Just wanted to check in and show that i am still alive. Due to Christmas time and personal things, i have not found much time to work on RF. I cannot guarantee anything until the next year.
RealityFactory is linked statically against the Genesis3D library as are most of the tools that require it. Right now I don't remember which program requires the Genesis3D.dll (could be obsolete as well).
I thought so...
Everyone can see the difficult, but only the wise can see the simple.
-----

Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: Custom RF Build

Post by Jay » Sat Mar 19, 2016 4:38 pm

If anyone is still here, i had to discontinue the project because of a computer crash and very limited time. I am very sorry about that.
Everyone can see the difficult, but only the wise can see the simple.
-----

User avatar
seppgirty
Posts: 161
Joined: Sat May 16, 2015 12:37 am
Location: Pittsburgh, Pa.
Contact:

Re: Custom RF Build

Post by seppgirty » Sat Mar 19, 2016 10:58 pm

sorry it didn't work out. good try anyway.
Gamer, Lover, Film maker,

http://www.chaosbrosfilms.com

User avatar
aicd99
Posts: 264
Joined: Mon Oct 10, 2011 11:17 am

Re: Custom RF Build

Post by aicd99 » Thu Apr 07, 2016 9:19 am

Such a disappointment

Wraps
Posts: 41
Joined: Sun Jun 06, 2010 2:04 am

Re: Custom RF Build

Post by Wraps » Mon Apr 18, 2016 4:12 pm

The problem with unity and udk and godot , etc. Is that none of them have a level editor that can touch rfeditpro's ease of use.

User avatar
aicd99
Posts: 264
Joined: Mon Oct 10, 2011 11:17 am

Re: Custom RF Build

Post by aicd99 » Thu Apr 21, 2016 4:35 am

Exactly :D :D

Post Reply