Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 559 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 29 of 34 1 2 27 28 29 30 31 33 34
Re: The answer to life, the universe and unity3d [Re: the_clown] #440080
04/17/14 17:21
04/17/14 17:21
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline OP
Expert
WretchedSid  Offline OP
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Blogpost time everyone! It's about something that hasn't been covered yet: The backend that powers the website!
http://rayne3d.com/blog/04-17-2014-devblog-9-pimpin-drizzle

Sorry the_clown, your request was a bit too late! tongue
But seriously though, anything you want to know in particular?
Do you just want to know how it's implemented in general, or also how it works together with the KVO and KVC systems?


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: The answer to life, the universe and unity3d [Re: WretchedSid] #440082
04/17/14 17:41
04/17/14 17:41
Joined: Nov 2008
Posts: 946
T
the_clown Offline
User
the_clown  Offline
User
T

Joined: Nov 2008
Posts: 946
Originally Posted By: JustSid

But seriously though, anything you want to know in particular?
Do you just want to know how it's implemented in general, or also how it works together with the KVO and KVC systems?


The general implementation for starters... All articles I've read so far basically start with implementing half a compiler, as they all aim towards, well, basically code agnostic, automated introspection. You've stated though your system works only with Raynes object class so I guess your implementation is much more straightforward and maybe a bit easier to comprehend.

Re: The answer to life, the universe and unity3d [Re: the_clown] #440086
04/17/14 19:29
04/17/14 19:29
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline OP
Expert
WretchedSid  Offline OP
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Okay, so, there are two components at the core: The class Catalogue that holds information about all registered classes, and the registration mechanism which is provided by two macros. The two macros are required and the reason we don't have to hack our own compiler together, there is one for the interface part of your class and one for the implementation side which provides all the glue code that is responsible for actually registering your class with the Catalogue.

All the information we have of the class is gathered at compile time through C++11's type traits, so we know what your class supports and how it can be constructed, so all it boils down to at runtime is calling a method on the class catalogue that will dissect the classes name into its namespace and store it. That is done once at startup when all static initializer run and is the only runtime overhead this system has.

When that is done, the Catalogue knows about your class, its superclass, what things it supports (serialisation, copying, default construction...) and it's querieable from the Catalogue, for example, in Downpour we query all registered classes and look if it inherits from the SceneNode class at some to then display it in the node class picker on the left side. Here is an example that uses the Sun class we have in our Testgame, but doesn't actually need to see the Sun interface header at any point to work!

Code:
RN::MetaClass *meta = RN::Catalogue::GetSharedInstance()->GetClassWithName("TG::Sun");
RN::Object *object = meta->Construct();

object->SetValueForKey(RN::Number::WithFloat(1000), "time");


(Real code should probably add some error checking)

Okay, so that's the general idea and there is nothing really exciting about that. More exciting is setting the time without actually knowing the setter!

On top of that systems sits the KVO and KVC layer of the Object class, this layer provides, at a very high level, the "SetValueForKey(), GetValueForKey(), AddObserver() and GetPropertiesForClass()" methods. They allow setting, getting and observing properties of instances at runtime, for example, the decal system uses that to automatically adapt itself to the underlying geometry, by simply adding itself as an observer for the objects transform it is placed on.

This system requires a bit of manual work, for two reasons:
1) We don't have a compiler
2) Not every property should be exposed and there needs to be a way to annotate what is exported and what isn't.

What you need to do is to wrap all your properties in the Observable class, for example:
Code:
class MyClass : public ...
{
public:
	...

private:
	RN::Observable<float> _myProperty;	
};



At construction time you can initialize the property with a name and additionally your own getters and setters for the property. You can also set wether it is read-only, atomic and what memory model it should use (if the observable wraps an Object). Right now, this has to be done at runtime which adds a bit of overhead, but I'm planning on moving that to compile time with template annotations.

Anyways, underlying of this is a Signal and glue code that provides high level setters and getters that take Object instances and convert them to the wrapped type (the example sets an RN::Number instance which is then unpacked into a float by the observable before being passed to the actual setter, similarly, the getters first pack the value into the appropriate RN::Object instance). This allows one interface that can serve all types of types, more complex objects like structs are wrapped in RN::Value instances.

The signal is emitted every time the value of the wrapped object changes, and provides the observable part. You can observe a property and request the runtime to provide you with the old, new and/or initial value so you can trace any change made to the object. Of course, this also works when setting the property directly, without the getter and setter part, and there is a fast path for when no observer is present so it only adds a very minimal runtime overhead when the feature isn't used.

Of course, there is also a query interface to get the exported properties. Downpour walks down the class hierarchy of an object and queries the exported properties for that class, to then display it in the inspector on the right side. Of course, it also adds itself as an observer of the properties. So when a property is updated over the network, the inspector automatically updates itself without the two systems having to know of each other.

Edit: I should note that non of this is a requirement. Everything will function even if your class doesn't participate in the class Catalogue or the property system. Some things won't work, but only directly affecting that class. For example, a SceneNode subclass that doesn't define itself in the class catalogue is still correctly identified as a SceneNode subclass.

Last edited by JustSid; 04/17/14 19:43.

Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: The answer to life, the universe and unity3d [Re: WretchedSid] #440138
04/18/14 21:19
04/18/14 21:19
Joined: Nov 2008
Posts: 946
T
the_clown Offline
User
the_clown  Offline
User
T

Joined: Nov 2008
Posts: 946
Wow, alright, that's a fairly nice explanation so far... I didn't know about C++11's type traits before.
I'd still be interested in more details how exactly the information about the classes is stored though. Note that I'm not asking from the PoV of a potential Rayne user right now but rather that of a c++ programmer.

Also, kinda non-related question that pops up from my mind right now, are you to any extend using the C++ STL library?

Last edited by the_clown; 04/18/14 21:20.
Re: The answer to life, the universe and unity3d [Re: the_clown] #441307
05/18/14 20:09
05/18/14 20:09
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
Though we were quite silent for a couple of weeks, Rayne is far from dead and we are still working on it.
Also I wrote about our shadow mapping solution for the sun which is nothing fancy, but kinda production proven, stable and good looking at good performance: http://rayne3d.com/blog/05-18-2014-shadow-casting-directional-lights

About two weeks ago I also wrote about our clustered shading: http://rayne3d.com/blog/05-01-2014-clustered-shading-in-rayne

Oh and check out my Ludum Dare Game I made alone in 48h using Rayne, it isn´t too much fun and a bit buggy, but at least something and I ported it to Windows :): http://www.ludumdare.com/compo/ludum-dare-29/?action=preview&uid=35658

@the_clown: we do use STL quite a bit. Mostly std::vector, but also a couple of other types and functions.

Re: The answer to life, the universe and unity3d [Re: Slin] #441314
05/19/14 06:45
05/19/14 06:45
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
I like your articles, quite informative and the length is fortunately not due to Hollywood standards laugh (unfortunately the game is crashing because of my ugly drivers)

do you plan to implement in future the currently so trendy physically based shading?


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: The answer to life, the universe and unity3d [Re: sivan] #441371
05/20/14 11:46
05/20/14 11:46
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
i am not sure if "the future" section of your interesting shadow mapping article contains something similar... but have you looked into rectilinear shadow mapping? i read about it on the supertuxkart blog and it sounds like it can easily compete with the quality of cascaded shadow maps while only using one shadow map (which doesn't have to be huge).

Re: The answer to life, the universe and unity3d [Re: ventilator] #441378
05/20/14 15:17
05/20/14 15:17
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
@sivan: Physically based shading is planned, but probably after an initial release. The current shading works good enough , so for now other areas are more important.

@ventilator: rectilinearly warped shadow mapping looks interesting, but the disadvantage is the need for well tessellated meshes, because the warping has to be used on the geometry. I am not sure how well this would work for a general purpose game engine. Also there is the need to analyze the rendered scene for the warping, which would either cause a CPU stall or if everything is done on the GPU, it would still require an additional pass before the real rendering, which might be needed anyways, but still would complicate the rendering pipeline.

Re: The answer to life, the universe and unity3d [Re: Slin] #441707
05/31/14 16:59
05/31/14 16:59
Joined: Mar 2005
Posts: 514
Brazil
Carloos Offline
User
Carloos  Offline
User

Joined: Mar 2005
Posts: 514
Brazil
Congrats for the nice work. I´m waiting for the release. I will probably buy it.

Re: The answer to life, the universe and unity3d [Re: Carloos] #441709
05/31/14 17:25
05/31/14 17:25
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Thank you for the article about shadows Slin. Also your robot game does not work here cause of MSVCP120.dll missing. Probably cause this is an old laptop though (/old drivers or whatever).

Last edited by Reconnoiter; 05/31/14 17:25.
Page 29 of 34 1 2 27 28 29 30 31 33 34

Moderated by  aztec, Blink, HeelX 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1