Topic for enhancements on RF i made

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

Topic for enhancements on RF i made

Post by Jay » Sun Feb 11, 2007 10:12 pm

Since I am finally able to compile the source, i already made my first addition:

-Enchanced Pawn Weapon System: It is now possible to add up to 16 Weapon Actors to one pawn, this should make some inventory systems a bit easier. They are stored in different 'slots' named 0 to 15. Because olf this slot system, SetWeapon() and RemoveWeapon() now have one argument more that dtermines the slot.

I also plan a few other things that will make making of RPGs with RF a bit easier.


When i am finished with that i will post the RealityFactory.exe and also the source code.
Last edited by Jay on Sun May 13, 2007 8:06 pm, edited 1 time in total.
Everyone can see the difficult, but only the wise can see the simple.
-----

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post by Juutis » Mon Feb 12, 2007 9:33 am

Yeeess! Very nice!
A very useful update, I was hoping for something like this to come up. :D
Pain is only psychological.

User avatar
Anonymu$
Posts: 77
Joined: Sun Aug 06, 2006 2:51 pm
Location: Lithuania

Post by Anonymu$ » Mon Feb 12, 2007 3:16 pm

Fantastic!

:)
:)

User avatar
scott
Posts: 1151
Joined: Tue Jul 05, 2005 1:59 am
Location: United Kingdom

Post by scott » Mon Feb 12, 2007 4:25 pm

the simple ideas are normaly the best, good work.
*GD*

User avatar
jonas
Posts: 779
Joined: Tue Jul 05, 2005 5:43 pm
Location: Texas, USA
Contact:

Post by jonas » Mon Feb 12, 2007 5:36 pm

Great additions.
Did you have any problems with strmbasd.lib? Mine says it can't find it but I do have strmiid.lib . I have directx 9 sdk with extras plus platform sdk, I'm not sure what step I missed. Any ideas?
Jonas

Focused, hard work is the real key to success. Keep your eyes on the goal, and just keep taking the next step towards completing it. If you aren't sure which way to do something, do it both ways and see which works better. - John Carmack

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

Post by Jay » Mon Feb 12, 2007 6:18 pm

new commands:

-EndScript() - ends the current script. More explanation in the Feature Requests section.
-FreezeEntity(char* szEntityName, bool State) - Can 'Freeze' and 'Unfreeze' a pawn, meaning that this pawns script isn't executed. Animations are not played. It's still rendered though. False means frozen, true means active.
-implemented Nout's Math(...) Command.

more in the work.

@jonas: I have not needed this library (as far as i know). All libraries i linked to are these:

genesis.lib
vorbisfile.lib
vorbis.lib
ogg.lib
winmm.lib
vfw32.lib
dxguid.lib
quartz.lib
decrypt.lib
wsock32.lib
freeimage.lib
coldet.lib
Joystick.lib
user32.lib
gdi32.lib
comdlg32.lib

with IgnoreAllDefaultLibraries: No and IgnoreSpecificLibrary: libc
Everyone can see the difficult, but only the wise can see the simple.
-----

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post by Juutis » Mon Feb 12, 2007 7:34 pm

Excellent work!
I'm glad to see that after the update people have started to develope RF on their own, it's not all on QoD's shoulders anymore. :)
BTW, thank you QoD, for making this possible.
***EDIT***
Oh, and of course, thank you too, Jay. :D

-FreezeEntity(char* szEntityName, bool State) - Can 'Freeze' and 'Unfreeze' a pawn, meaning that this pawns script isn't executed. Animations are not played. It's still rendered though. False means frozen, true means active.
Very good, very good indeed!
So if the pawn is playing an animation, will the animation freeze too?
If so, this command can produce neat effects. Like time stopping. :P
Pain is only psychological.

User avatar
jonas
Posts: 779
Joined: Tue Jul 05, 2005 5:43 pm
Location: Texas, USA
Contact:

Post by jonas » Mon Feb 12, 2007 8:58 pm

I'll try taking that lib off the list and see if it helps
Jonas

Focused, hard work is the real key to success. Keep your eyes on the goal, and just keep taking the next step towards completing it. If you aren't sure which way to do something, do it both ways and see which works better. - John Carmack

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

Post by QuestOfDreams » Mon Feb 12, 2007 9:00 pm

Did you have any problems with strmbasd.lib? Mine says it can't find it but I do have strmiid.lib . I have directx 9 sdk with extras plus platform sdk, I'm not sure what step I missed. Any ideas?
Oops, seems like I didn't remove it from the library list in the debug configuration. You should be abe to just remove it. (Project -> Poperties -> Configuration Properties -> Linker -> Input -> Additional Dependencies).
I first needed it when removing MFC. The problem with strmbasd.lib/strmbase.lib is that the platform sdk only comes with the code for this library but doesn't include a prebuilt library. Additionally it is supposed to be compiled with the command line compiler which I couldn't get to work with the provided makefile even after some hours of work... :evil:

-implemented Nout's Math(...) Command.
I intentionally did not include this in the last release... I hope you didn't just copy it from the forum because it had lot of bugs...

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

Post by Jay » Mon Feb 12, 2007 10:00 pm

oh where are those bugs? :oops: i did not know this, i may have to rewrite it...
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:

Post by QuestOfDreams » Tue Feb 13, 2007 6:51 pm

Well, ok, "a lot of bugs" is a bit exaggerated. The only real bugs probably came from copy&paste. For the asin command the sin function is used and in the atan command the tan function is used.

The input values for the functions are not checked befor use and I must admit that I forgot this too when adding the asin, acos commands ( valid input is in [-1, 1] ).

Generally I don't like the idea of the Math command...
an example: you use the following code in your script

Code: Select all

b = Math(abs, a);
What happens?
The command is passed to the interpreting function in the RF code (1 switch/case)
It jumps to the "Math" case and does a strcpy of the 1st parameter
It does an if/else if with stricmp function
It does a check of the parameter count
It calls the abs function of the standard math library
It assigns the return value to b, we're done

Now compare this to the following script code

Code: Select all

if(a > 0)
{
    b = a;
}
else
{
    b = -a;
}
What happens?
The script interpreter needs to do an if/else
b is assigned the correct value, we're done

Another example is the pow function. In most cases you want to calculate int a^int b or float a^int b. Now look at the declaration of the pow function: double pow(double a, double b). It calculates double a^double b which is much more expensive. (From my experience most beginners with programming do not care about this)

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

Post by Jay » Wed Feb 14, 2007 10:35 pm

Yes that's all true what you're saying i thought it was ok the way Nout made it, i fixed the bugs you mentioned, but i made no speed optimizations.

Also, i have a question: what is the upper maximum of parameters and of characters in one script command?
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

Post by Jay » Mon Feb 26, 2007 8:31 pm

Sorry for the double post, but otherwise i think no one would see that i posted something new.

I am currently working on a new Entity:

I call this entity the EntityAreaSystem. It does this:

Before the first frame, all entities are 'reorganized'. They are then put into 'areas'. There is a global area and several 'geometrical' areas. But the thing is, only entities from certain areas are executed. That means it will get easier to simulate big environments in RF, which actually is what i have in mind. It will also be possible to disable Entities (that just means they are moved to the 'disabled' entity area). It is possible to set the amount of areas in XYZ direction. Also it is possible to set a 'sightdist' of areas which means how many of the surrounding areas are also executed. By this, you can influence the speed of the EntityAreaSystem. Just have one area in Y direction (like if you have a terrain and not a cave with many levels)? Set the Y value of the 'sightdist' to 0 and it will be faster.

The system does not influence the ability to access entities that are out of the areas that are currently used. You can still modifiy a pawn or any entity that is on the other side of the world. However, those entities are not used until you get near enough or until they are in the global entity area.

Due to something a cannot solve right now, you have to tell the entity the extends of the world (most accurate is best) so that it can calculate the areas.

If you don't have an EntityAreaSystem in your world, everything is like it always has been.

For the programmers:
I set a 'guiding line' for writing entities for RF:
The first variable of every entity MUST be its origin. Otherwise i cannot garuantee (hope it's spelled right) that they will work. This is because i want to read out the origin of the entities in the first frame.

I still need a few days to complete this project. I will tell you when there is something new. I hope that this entity works out well. I may also add a script command to move Entities to certain areas, like the global or the disabled one.

EDIT: I hope it wasn't that difficult to follow.

EDIT2:

The entity is nearly ready. Not all entities will be automaticly thrown out by the EAS (EntityAreaSystem). Here is a list of the entities that are automaticly 'culled' (not the right word, but basically it is like this...)

Attribute - it does not make sense to be able to take them if you aren't near them
Pawn - scripts take much time to execute
StaticMesh - If you cannot see them because of the farclipplane, why bother to process them?
StaticEntityProxy - see StaticMesh
ParticleSystemProxy - Particle systems have always been framerate eaters
Flame - see ParticleSystemProxy
Spout- see ParticleSystemProxy
DynamicLight - same here
FlipTree - see StaticMesh
Foliage - There can be many Foliage entities in an outdoor scene, so this makes sense
FlipBook - often used, let's save time
ActorSpout - If you can't see it, why should it be processed?
FirePoint - see ActorSpout
FixedCamera - They can still be activated with the ForceTrigger
Rain - framerate eater - see ParticleSystemProxy
DSpotLight - see DynamicLight

The 'Global Entity Area' already works (it's for thinghs like scripted players or for terrain meshes that always have to be visible)

I have to admit that the entity does not make much sense in small outdoor scenes (big would be for example 8000x8000 with a player scale of 0.2), but for big outdoor scenes it could improve performance. (if it does not i will throw it out then). But if you don't like it, you can always leave out the entity and everything is like it always has been..


To get an idea of how it works, take morrowind as an example: it is divided into 'areas' and when you get to theend of one area, the next is loaded. That's basically how the EAS works.

EDIT3: I have now competed the entity. There seems to be a bug but it only comes when RF closes (it closes and just before it closes, it crashes...that's strange). I will get to the bottom of this.
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

Post by Jay » Wed Feb 28, 2007 9:36 am

Even if i am triple posting: (this thread seems to become a WIP thread)

I have made a test that basically shows off the capabilities of the EAS...

For the pawn test i used pawns that have no corpse(ok well they have one, it's the good old proj.act). The pawns that are in the other areas are currently rendered but there is no script execution. The idea behind this is that you set the LODDistances of the pawns in a way that they aren't rendered when they get 'out of range'

Foliages have been with a RenderDistance of 512 so that they will be cut at that point, i wanted to know how much difference the EAS does.

However, this is only a small level and it has only 4x1x4 Sections. In big levels, it could be even more powerfull.

the main character btw is a scripted player which is a global entity. That way its script always gets executed.
Attachments
before_and_after.JPG
(124.94 KiB) Downloaded 82 times
Everyone can see the difficult, but only the wise can see the simple.
-----

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post by Juutis » Wed Feb 28, 2007 10:05 am

Great work. :D


I'm not sure I understand how this works, though...

Could this entity be used in a closed environment?
I'm thinking mainly for pawn scripts. Like... could it disable a script for a pawn that is, say, two rooms away from the player? With big levels and lots of enemies, the amount of scripts can bring the framerate down pretty much. So I'm just thinking that could the entity disable those scripts that aren't needed, even if the player was just on the other side of a wall?
Pain is only psychological.

Post Reply