Support for librocket

Support for librocket

Requests for features in the spring code.

Moderator: Moderators

User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Support for librocket

Post by SpliFF »

http://www.librocket.com/

It's a UI middleware for creating windows/panels using a subset of HTML and CSS (called RML and RCSS respectively). In short if you want UI elements like tables or select boxes you design them in RML/RCSS and then load them through librocket.

The advantage of this approach is it removes the requirement for the UI designer to know Lua. Most designers aren't programmers so building your Spring UI currently requires a programmer to translate the designs into OpenGL calls.

LibRocket supports many GUI elements that are difficult to implement in Lua/OpenGL. Elements that come to mind are tables with dynamic cell resizing, drop-down lists, flowed content, floated elements, scrolling content, forms, tabs, backgrounds, borders and UI events like drag-and-drop. I'm not saying you can't do these things now, just that they are difficult and generally ugly to code.

I looked around at a variety of UI middleware but most are either:

1.) too ugly (fltk,gtk,etc)
2.) don't work over OpenGL (most of them)
3.) too heavy (QT,webkit,etc)

libRocket appears to provide enough CSS support for elegant designs without being prohibitively complex.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Support for librocket

Post by CarRepairer »

SpliFF wrote:Most designers aren't programmers so building your Spring UI currently requires a programmer to translate the designs into OpenGL calls.
Chili has been designed to look like CSS. The ZK team has non-programmers able to modify the look and feel of our UI with ease.
Satirik
Lobby Developer
Posts: 1688
Joined: 16 Mar 2007, 18:27

Re: Support for librocket

Post by Satirik »

would be awesome, but i guess it just won't happen unless you add it yourself
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Support for librocket

Post by AF »

Why not Berkelium?

Then instead of a subset of html+css in a library that runs at an okayish speed, we get the efforts of the Google Chrome team, a full HTML5 CSS webkit browser, minus flash/silverlight, complete with javascript engine and wrapper interface.

Prefer to build your UI using photoshop+dreamweaver+JQuery?
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Re: Support for librocket

Post by SpliFF »

I didn't know about Berkelium. It's practicality would probably depend on its size and ease of integration. I don't know enough about either project to comment on which is best.

Where did you hear that librocket runs at "okayish speed"? Is that just an assumption that Google writes better software or based on evidence?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Support for librocket

Post by AF »

Its based on the assumption that librocket doesn't have the sheer force of momentum that Google is pushing into Chromium/Google Chrome/Chrome OS, nevermind the side contributions pulled from webkit and Apple/etc.

If Mozilla and Microsoft are barely keeping up with Googles frenetic pace, can librocket?
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Re: Support for librocket

Post by SpliFF »

libRocket is intended to be a lightweight UI for games. Berkelium is intended to be a fully functional HTML5 webbrowser. Regardless of who is developing them they have distinctly different priorities.

Honestly, all other concerns aside I can't see the other devs being exited about embedding millions of lines of browser code in Spring. It's a huge increase in complexity for the sake of being able to use CSS3 and Javascript inside an embedded window. I see it as overkill.
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2700
Joined: 25 Aug 2004, 13:31

Re: Support for librocket

Post by bobthedinosaur »

lightweight as in not as laggy as chili?
SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

Re: Support for librocket

Post by SirMaverick »

SpliFF wrote:Honestly, all other concerns aside I can't see the other devs being exited about embedding millions of lines of browser code in Spring. It's a huge increase in complexity for the sake of being able to use CSS3 and Javascript inside an embedded window. I see it as overkill.
I agree.
bobthedinosaur wrote:lightweight as in not as laggy as chili?
http://springrts.com/phpbb/viewtopic.ph ... 95#p404095
Explain me why jk is lying.
Last edited by SirMaverick on 17 Mar 2011, 20:42, edited 1 time in total.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Support for librocket

Post by smoth »

bobthedinosaur wrote:lightweight as in not as laggy as chili?
a challenger apears
not a single person has proven it.
User avatar
MidKnight
Posts: 2652
Joined: 10 Sep 2008, 03:11

Re: Support for librocket

Post by MidKnight »

smoth wrote:
bobthedinosaur wrote:lightweight as in not as laggy as chili?
a challenger apears
not a single person has proven it.
Chilli is slow is the new creationism. :P
User avatar
MidKnight
Posts: 2652
Joined: 10 Sep 2008, 03:11

Re: Support for librocket

Post by MidKnight »

smoth wrote:
bobthedinosaur wrote:lightweight as in not as laggy as chili?
a challenger apears
not a single person has proven it.
Chilli is slow is the new creationism. :P
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2700
Joined: 25 Aug 2004, 13:31

Re: Support for librocket

Post by bobthedinosaur »

Sure let me take some screens...

I think what people mean is chili shows little difference in performance on decent computers. However, on older/ low end computers... well let's see.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Support for librocket

Post by smoth »

What is decent what is old?

I am running on a 2 year old pc:
8gigs of ram
nvidia 280
dual 3.5ghz
lotsa hd space with all that porn gone.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Support for librocket

Post by knorke »

What is decent what is old?
Who cares?
"computer too slow for chili" is like super retarted.
Most players with these problems can run at decent details and everything... Just some chili widgets cause the fps problems.
It is like being able to play Crysis or Call of Duty (or w/e is the newest highend graphic shooter atm) at high detail and then you press tab for the scoreboard and the screen freezes.
btw nice derail.

So, this librocket
-could you post an example how ie some buttons with this would look like code wise? Really just html?
-To interact with Lua, would there be new lua functions ie a callin "LibrocketButtonClicked (buttonname)"?
-would it be possible to change the UI runtime, ie adding a button for every selected unit and removing the button if the unit gets deselected?
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Support for librocket

Post by smoth »

considering browsers cannot do css/html right consistently and even have very huge inconsistencies between them I don't want to imagine using html to setup ui elements.
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Re: Support for librocket

Post by SpliFF »

Somebody asked for samples. I looked around and found a commercial game using librocket with a nice clean design (as opposed to the butt-ugly sample linked from the librocket project site).

Image

The settings panel shown above is defined entirely using RML and RCSS templates - as is the main menu below it and the background (which is a simple JPG). Even that funky color slider.

All UI events are mapped to python events (though librocket can support Lua and other bindings as well). The Python support is optional, it can be removed entirely and replaced with Lua bindings.

I also captured some video of the UI in action (YouTube).

The UI was perfectly smooth, even running under Wine. The shearing and stuttering artifacts you see in the video is from the screen recording process (VLC screen://).

You can download Kong free at http://www.konggame.co.uk/
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Support for librocket

Post by Google_Frog »

I am a bit dubious about another UI framework. Unless it is significantly faster than lua (Chilli specifically) I do not see the point. I also prefer chilli as it is entirely lua which means it is not subject to failing because bugs are added to the engine every version and the development cycle for fixes can be much shorter,
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Re: Support for librocket

Post by SpliFF »

When looking at the benefits of a UI framework, performance is one the last thing to consider. Honestly how often do you see a slow GUI these days? If it was a consideration I'd really have to say it's extremely doubtful librocket would be slower than existing Lua frameworks considering its foundation classes are C++.

On the other hand the top of my list of things to consider is how easy it is to use. Now I can't comment on any of Spring's existing frameworks for the simple reason that I haven't used them.

What I can say though is that every designer on the planet under the age of 30 should by now be familiar with HTML/CSS and/or the tools that generate them (like Dreamweaver). Hell, even MS Word can save as HTML (terrible, ugly, non-standard HTML but still...).

With LibRocket I can create a a batch of HTML files with the GUI elements I want already defined and scripted and give it to a designer who can then create CSS files for me. That designer wouldn't need to know any coding at all. They wouldn't need to touch my markup either as CSS can and should be defined in a seperate file. This is called seperation of presentation and logic (or MVC in jargon) and it's a fundamental part of good software and website design.

On the other hand the number of people on the planet who are both good designers and good Lua programmers must be tiny. If you want somebody who is a good designer to design and implement a Lua interface they'd pretty much have to learn both Lua and the UI framework from scratch.

So the REAL question here is NOT which framework is faster but who you are more likely to find to work unpaid on your game; the 1/100,000 designer who can competently code Lua or the 99,999/100,000 designer who can do CSS?

And for the record, nothing in the integration of librocket would prevent chili or any other framework from being used. It's about offering more choices, not replacing existing ones.
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Re: Support for librocket

Post by SpliFF »

Actual code samples:

RML with embedded scripts and styles

Code: Select all

<rml>
	<head>
		<link type="text/template" href="window.rml" />
		<title>Select Team</title>

		<style>
		body {width: 190px; height: 190px; margin: auto}
		</style>

		<script>
		// inline scripting (Python)
		def BuildMenu(document):
			teamGame = GAME.GetGameMode().TeamGame()
		</script>

	</head>
	<body template="window" onload="OnWindowLoad(self); BuildMenu(document)">
		<div id="red"><button onclick="GAME.ChangeTeam(TEAM.RED); document.Close()">Red</button></div>
		<div id="blue"><button onclick="GAME.ChangeTeam(TEAM.BLUE); document.Close()">Blue</button></div>
		<div id="auto"><button onclick="GAME.ChangeTeam(GAME.AutoSelectTeam()); document.Close()">Auto-Select</button></div>
		<div id="spec"><button onclick="GAME.ChangeTeam(TEAM.NONE); document.Close()">Spectator</button></div>
		<button onclick="document.Close()">Cancel</button>
	</body>
</rml>
RCSS

Code: Select all

body
{
	font-family: Fontin Sans;
	font-weight: normal;
	font-style: normal;
	font-size: 15;
	font-charset: U+0020-00FF;
	color: white;
	cursor: arrow;
}

body.window
{
	padding-bottom: 20px;
	min-width: 0px;
	max-width: 800px;
	min-height: 0px;
	max-height: 700px;
}

div#title_bar
{
	z-index: 1;
	position: absolute;
	top: 0px;
	left: 0px;
	text-align: left;
}

div#title_bar div#icon
{
	z-index: 2;
	position: absolute;
	left: 0px;
	top: -38px;
	width: 63px;
	height: 63px;
	background-decorator: image;
	background-image: kong.png 1px 1px 64px 64px;
}
Post Reply

Return to “Feature Requests”