Page 1 of 9

[BETA] Custom Gui V0.8 - Update: 23/08/2007

Posted: Tue, 31. Jul 07, 14:30
by Cycrow
This is a fully customizable Direct3D Overlay for the game that is controlled via included scripts.

:arrow: Introduction

Displays can either be a fixed message, or a completly custom GUI created by an external script

There are various examples include on how to create the external scripts as well as using them in the game and sending varibles to them

:arrow: Downloading and Using

:arrow: Download Site 1
:arrow: Download Site 2
:arrow: Download Site 3

To use it, simply extract the files to the X3 directory. Most of the files are found in the Overlay directory, this includes sprites, textures, sounds and external scripts.

The includes exe, X3_Gui.exe is what you need to run instead of the normal X3.exe. This allows hooking the Direct3D DLL to use the Custom Gui.

:arrow: Screen Shot

http://homepage.ntlworld.com/cycrow/addons/gui/gui.jpg

:arrow: Features
  • Allows creation of Custom Dialog to overlay the game
  • Includes Animated Sprites
  • Fully Programmable Custom Dialogs
  • Ability to get variables from the game to setup the GUI
  • Includes Time-Based animation sequences for each object
  • Can display text, textures and sprites
  • Includes playing of sound files at set times, both wav and mp3
  • Fully Customisable Gui Border
  • Capture and control the mouse
  • Can close on mouse click
  • Move Over Event to change gui when highlighted
  • Allows playing of external sound and voice files directly from scripts
  • Can play full videos in the GUI Window
  • Includes Cut Scene mode for playing of full screen videos
:arrow: Sprites

Sprites are a custom file (stx) that allows for animated textures.

To create stx files, use the SpriteCreator program

:arrow: Examples

Example1: Basic display, same as the screen shot, shows text and a texture
Example2: Shows no border, and use of animated sprites
Example3: Shows how to use a custom border, and varibles
Example4: Shows animation sequences
Example5: Shows the new animation sequences for sprites, using sounds and Close Events.
Example6: Menu System, shows use of mouse cursor and the MouseOver event
Example7: Menu System, shows functions, OnClick event, and script callbacks

Posted: Tue, 31. Jul 07, 14:46
by defiant1
CY check PM...sent u one related to this

Posted: Tue, 31. Jul 07, 14:49
by Diskun
Holy cow! This is an awesome innovation!
I'm interested in custom overlay GUI design too. Send me a PM if you want a tester and translator :P

Greets

Posted: Tue, 31. Jul 07, 14:52
by defiant1
same...and i will have another way of putting it through the gauntlet...hehehe

Posted: Tue, 31. Jul 07, 15:35
by dragonsblade71uk
Man looks like someone might get EGOSOFT to hire him for the next version.
Definately some great work here!
GO go Cycrow!

Posted: Tue, 31. Jul 07, 15:51
by sphr
hmmm... did you do this by creating a directx surface and bind it as a child over the x3 game surface? any input or performance issues?

perhaps could open up a whole new realm of possibilities.... e.g. work around the limited ui currently in the game :)

Posted: Tue, 31. Jul 07, 15:55
by Cycrow
i did it by hooking the directx dll and adding to the rendering cycle to render on top of the current display.

then it jsut uses ingame scripts to control whats displays on the gui

im currently working on making it fully customizable so you can design the display how you want.

it also hooks directinput so you can get key presses as well

Posted: Tue, 31. Jul 07, 16:44
by sphr
Cycrow wrote: it also hooks directinput so you can get key presses as well
ahhh.. possibilities.... :)

Posted: Tue, 31. Jul 07, 17:06
by defiant1
and lots of em....and now i see even more...hehe

Posted: Tue, 31. Jul 07, 17:27
by B-O'F
Hi Cycrow,

Sounds as though it could be useful....


The above is probably one of the greatest understatements ever......

Boron - Ol Fh'art

Posted: Tue, 31. Jul 07, 19:54
by ninjitsumonk
I think I'm in love..... With the gui of course :P
WOW! Can't wait to see this in full! I'd gladly help test! Pm me or whatever with a link.
You rule cycrow!

Posted: Tue, 31. Jul 07, 21:03
by Bunny
It's official

Cycrow frightens me :o

Posted: Tue, 31. Jul 07, 23:27
by Cycrow
ok, i have a first test for you all to play with

http://x3.ircwhore.co.uk/Gui.rar

Files Include
Direct3d-Hook.dll - Main dll file to control the gui
X3_Gui.exe - The launcher application, it hooks the dll and launches x3
scripts/plugin.plugman.displaymessage.xml - script to display a message, has heading and main text as well as the size of the gui to display.
scripts/plugin.plugman.displaycustom.xml - displays a custom gui, reads a text file with settings in
scripts/example.showgui1.xml - First example to show a custom gui
scripts/example.showgui2.xml - displays the 2nd custom gui
Overlay/border.png - The border gfx
Overlay/face.png - Texture file used for first example
Overlay/explosion.stx - Sprite file used for 2nd example
Overlay/customgui1.txt - scripts for first gui display
Overlay/customgui2.txt - scripts for second gui display
Overlay/spriteCreator.exe - Program to create stx files for animated textures

========================

The custom displays requires a script file that lays out the display. You can add text, textures or sprites into the display, you can use the whole screen or just part it, it will automatically center to the screen.

Sprites are a custom file (stx) that allows for animated textures.

To create stx files, use the SpriteCreator program

Posted: Wed, 1. Aug 07, 04:07
by eladan
This has to be your best innovation yet, Cycrow. <shakes head> You continue to astound me with what you manage to come up with. 8)
dragonsblade71uk wrote:Man looks like someone might get EGOSOFT to hire him for the next version.
I find I've got mixed feelings on this... Iit would be great for Cycrow, and would benefit the X games, and from that point of view I hope it happens. But there's a small selfish part of me that says that he wouldn't be given the creative freedom he has now if he's part of ES, and also, he wouldn't be able to be part of the modding community anymore, which would be a huge loss.

Posted: Wed, 1. Aug 07, 04:59
by sphr
@Cycrow, don't mind if I ask some more questions... please correct me if I'm wrong

1) Currently, it is mostly a statically templated GUI, meaning that the number of "UI components" is fixed in each GUI set but can switch between them, though each "component" can be dynamically driven by script. E.g. say you set a "text area" component, I can change the content of the text area dynamically, but I can't say create 3 text areas this time and 5 text areas the next time.

2) Is it possible to use that as a secondary command menu (launched after a command slot is invoked) that displays a secondary menu system using this? menu data can be script driven (e.g. putting things in an input Array in particular order) and menu input handling can also be script handled (e.g. returns a number representing which item is chosen, and let script decides what it does).

If 2) is not directly possible due to need to hardcode script calls (or is there a script command that can call a generic script specified by string variable and generic input variables?), would it be more possible if say I create a hard-coded dispatcher that takes in a string_script, value1, value2, ....,
and internally dispatches it to stuff like

Code: Select all

if $string_script == "!move.whatever" 
  $result = call script "!move.whatever": arg1=value1
  return $result
else if $string_script == "!move.somwherer" 
  $result = call script "!move.somewhere" : arg1=value1, arg2=value2
  return $result
else
...
so that the "menu" handler can be data-driven by just setting the generic string and values.

If this is feasible, we may have found a real way to get around the Command Slot shortage problem.

Posted: Wed, 1. Aug 07, 12:22
by KanineLupus
Just a quick point of feedback here. Could you possibly switch out the 3+ MB PNG preview screenshot you got there for a more manageable JPG image?? I'm on a 1.5MB ADSL connection and it still takes forever to get the image (although I suspect there might be a bandwidth issue your end). Like many of us I like to be able to get a clue of things befopre I go off and download them, but this is s tad rediculous.

Cheers buddy :)

Posted: Wed, 1. Aug 07, 12:23
by Cycrow
well, the current version is static, but thats only because its a very early base.

i plan to make it more controlable eventually

1) for that, what you can do, is create 2 gui script files, one with 3 text areas and one with 5, then use a script to select which one you wish to use.

u'll be able to set varibles so the text can come directly from x3 itself rather than being set in the gui file, i havn't dont the varibles yet.

also, the script is a simply text file, you can create an x3 script that creates the gui script file without a problem. So instead of using the template you simply write the whole thing and output it to the logfile via X3

in x3, simply use the write log functions to create the file, then call the custom gui and give it the log file name

2) Im actually designing it to work with as a menu system, so you can get input from the player, but i've not done that yet

how it will work, is there will be a script that will constantly read a text file, the text file will be written by the program with the choises made by the player and store them in an intertal array. Then your script will simply require the data, if the choise has been made, it will return

Code: Select all

while [TRUE]
  $answer = call script 'plugin.plugman.checkanswer', File = 'customgui1.txt' Setting = 'Menu'
  if $answer 
    break
  end
  wait 500 ms
end
im working on intercepting the mouse so it can control the gui instead of the game when its open

Posted: Wed, 1. Aug 07, 14:53
by dostillevi
Cycrow!

I'm so glad you heard my idea and were able to run with it! This is very exciting. You're the best.

Posted: Wed, 1. Aug 07, 15:02
by dostillevi
oh.. you probably know this, but make sure to set up mutex with the file being read and written to. Time delay on the part of the reader isn't enough. Maybe make the first item in the file a 0 or 1, and if 0 the game can read it and then set to 1, and if its 1 the GUI overlay can write to it and then set it to 0.

Posted: Wed, 1. Aug 07, 15:07
by Cycrow
I've switched the screenshot for a jpg.

dostillevi, a mutex lock isn't really nesecarray.

the file is never read by both at a time.

what happens, is the scripts create a log file, when the program detects a new file is created, it will read the data from the file and remove it.

a different file will be used to read data into the game