RealityFactory 0.80 - WIP

Programming Reality Factory and Genesis3D.
User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Re: RealityFactory 0.80 - WIP

Post by metal_head »

Yeah, well anyways I won't be using RF to develop MF anymore, I'm working on a side scroller and thank god, sidescrollers don't need pathfinding :D
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: RealityFactory 0.80 - WIP

Post by QuestOfDreams »

Finally some holydays so I can work a bit more on RF. Unfortunately there's still quite some work to do...

Some recent changes:

Unlimited number of predefined effects (previously 200)
Unlimited number of predefined explosions (previously 50)
Unlimited number of projectile definitions (previously 50)
Unlimited number of different actor files per level (previously 1024)
Bug fix: Explosion Manager and Effect Manager were updated 2x per frame (delay & lifetime of effects halved)
User avatar
hgt_terry
RF Dev Team
Posts: 167
Joined: Sun Feb 24, 2008 12:20 am
Location: England

Re: RealityFactory 0.80 - WIP

Post by hgt_terry »

Fantastic stuff QuestOfDreams

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

Re: RealityFactory 0.80 - WIP

Post by QuestOfDreams »

Quick update: completion of following features
  • Scriptable Messages
  • Writing log entries from scripts
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: RealityFactory 0.80 - WIP

Post by QuestOfDreams »

Just to elaborate on my last post, here's a simple example of a scripted message.

First you create a layout file for the message (I've done it manually but you can use the CEGUI layout editor for this task):

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<GUILayout >
	<Window Type="TaharezLook/FrameWindow" Name="Message/Scripted/Window">
		<Property Name="UnifiedPosition" Value="{{0.3,0},{0.15,0}}" />
		<Property Name="UnifiedMaxSize" Value="{{0.5,0},{0.5,0}}" />
		<Property Name="UnifiedMinSize" Value="{{0,128},{0,128}}" />
		<Property Name="UnifiedSize" Value="{{0.4,0},{0.3,0}}" />
		<Property Name="Text" Value="Message Window" />
		<Event Name="Shown" Function="Message_OnShown" />
		<Event Name="CloseClicked" Function="Message_OnCloseClicked" />

		<Window Type="TaharezLook/StaticText" Name="Message/Scripted/Text" >
			<Property Name="TextColours" Value="tl:FF648CDC tr:FF648CDC bl:FF648CDC br:FF648CDC" />
			<Property Name="FrameEnabled" Value="False" />
			<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
			<Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.1,0},{0.9,0},{0.8,0}}" />
			<Property Name="BackgroundEnabled" Value="False" />
			<Property Name="HorzFormatting" Value="WordWrapCentred" />
		</Window>

		<Window Type="TaharezLook/Button" Name="Message/Scripted/Close" >
			<Property Name="Text" Value="Close" />
			<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
			<Property Name="UnifiedAreaRect" Value="{{0.6,0},{0.75,0},{0.9,0},{0.9,0}}" />
			<Property Name="Tooltip" Value="Click to close message window" />
			<Event Name="Clicked" Function="Message_OnCloseClicked" />
		</Window>
	</Window>
</GUILayout>
This is a simple window with 2 children, namely a static text window (which actually receives the message text) and a button to close the window. Besides the property definitions like the window size, the event attributes may have caught your attention. These attributes actually connect events with script methods.

Before we get to the script, let's make this layout available for message entities. To do this we are using the message.ini file as in earlier RF versions, however the definition looks different now:

Code: Select all

[Scripted]
layout = message_scripted.layout
textwindow = Message/Scripted/Text
script = message.s
Here we specify the layout file (the one above), the window that will receive the message text and the script that will handle events from the message window.

And this brings us to the actual script

Code: Select all

{
	Message_OnShown[(e)
	{
		DialogState.UpdateLevel(false);
		DialogState.RenderLevel(true);		// default
		DialogState.Enter();

		Log.SetFile("message_script.log");	// open log file
		Log.SetPriority(Log.DEBUG);			// set output level
		Log.Print("Log.Print");
		Log.Debug("Log.Debug");
		Log.Info("Log.Info");
		Log.Notice("Log.Notice");
		Log.Warning("Log.Warning");
		//Log.Error("Log.Error");
		//Log.Critical("Log.Critical");
		Log.Log(Log.DEBUG, "Log.Log");
		
		// iterate over all loaded fonts and print their heights
		for each font in GUI.FontManager
		{
			Log.Print("font height " # toString(font.getFontHeight()));
		}

		Log.SetFile("RealityFactory.log");	// reset log file to default
	}]

	Message_OnCloseClicked[(e)
	{
		DialogState.Exit();
	}]
}
Message_OnShown gets called when the message entity gets activated and the layout is shown. Right at the start of this method we change into DialogState which restricts user interaction to the GUI. You can choose whether the level should continue to run during this state or time will be frozen (DialogState.UpdateLevel). Also rendering the level is optional in this state (DialogState.RenderLevel).
Next in this method is a test of various Log functions, which produce the following output in the file message_script.log

Code: Select all

Log.Print
[debug]   Log.Debug
[info]    Log.Info
[notice]  Log.Notice
[warning] Log.Warning
[debug]   Log.Log
font height 14.493395
Also demonstrated in this method is a nifty little feature of Simkin that let's you iterate over a set of values in custom objects in a 'for each' statement (provided you wrote the corresponding iterator class). In this example we run through all fonts loaded in the FontManager and print their height to the log file.

Message_OnCloseClicked gets called when we click the Close button. Here we just switch back to the normal play state.
Attachments
Scripted message
Scripted message
wip080_01.jpg (33.35 KiB) Viewed 13562 times
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: RealityFactory 0.80 - WIP

Post by Jay »

Wow. Seems like you have been busy with this. Will all messages have to be scripted, or will the current ones still work?

Also, the "Log" and the "GUI.FontManager" objects look interesting. Do they work in all kind of scripts or just with the scripted messages?
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: RealityFactory 0.80 - WIP

Post by QuestOfDreams »

You can still define messages that don't need a script, however you will need a layout file to define the look, e.g.:

Code: Select all

[Simple]
layout = message_simple.layout
textwindow = Message/Simple/Text
displaytime = 2
fadeintime = 0.2
fadeouttime = 0.2
This defines a message that fades in and out while the game continues to run, very much like it's used to be. One thing to note is that only 1 instance of a layout file/message definition can be active at any one time. So if you have several message entities using the same definition and more than 1 entity gets activated, the text will be set to the one of the last activated message. (If it's in the process of fading out it will of course stop and fade in again with the new message text)

The Log and GUI objects are globals and can be used in any script. The GUI object will give you access to a major part of the CEGUI API.
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: RealityFactory 0.80 - WIP

Post by QuestOfDreams »

Just wanted to let you know that the Simkin wrapper for CEGUI is almost completed. There are just a few window types and the Falagard system left that need to be exposed, however the latter may get added at a later date.
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: RealityFactory 0.80 - WIP

Post by QuestOfDreams »

Simkin wrapper completed, new scriptable inventory system almost finished.

Short video of a basic drag&drop based inventory (other systems like listboxes are possible, too).
http://www.youtube.com/watch?v=qENgK7xtyrg
User avatar
paradoxnj
RF2 Dev Team
Posts: 1328
Joined: Wed Mar 01, 2006 7:37 pm
Location: Brick, NJ
Contact:

Re: RealityFactory 0.80 - WIP

Post by paradoxnj »

Nice. Big improvement over the existing.
Many Bothans died to bring you this signature....
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: RealityFactory 0.80 - WIP

Post by QuestOfDreams »

Another inventory type which is visible all the time in-game. Note the automatic removal of empty slots.

http://www.youtube.com/watch?v=dXudzp7m1aw
Wraps
Posts: 41
Joined: Sun Jun 06, 2010 2:04 am

Re: RealityFactory 0.80 - WIP

Post by Wraps »

VERY NICE!What would we need rf2 for if rf1 can do this?Seriously....if rf1's worldsize and number of actors is upped a bit, as stated above...I'd have no need for rf2...or anything else.RF1's editors are the greatest ever.
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: RealityFactory 0.80 - WIP

Post by QuestOfDreams »

Well, it's difficult to update the graphics system, the main reason for writing RF2.
I'm trying to write all new components in RF in a way so they can easily be adapted to RF2.

Update:
Fixed ogg vorbis playback (updated to libogg 1.2.0, and libvorbis 1.3.1) :)
I'm trying to get the new conversation system done within the next few days.
User avatar
madness
Posts: 91
Joined: Mon Feb 11, 2008 5:56 pm

Re: RealityFactory 0.80 - WIP

Post by madness »

Is this still in the works? I'm trying to build my own little RF oriented towards my game needs but I'd like to see some activity here as well. :o
Somewhere in Nevada...
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: RealityFactory 0.80 - WIP

Post by QuestOfDreams »

Yes, I'm still working on it. I'll post a video of the new conversation system ASAP.
Post Reply