A base editor

A forum for the discussion and development of programs to assist working on or playing with the Vegastrike engine and data sets.
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: A base editor

Post by klauss »

No, i meant the issue tracker in VS's sourceforge page.

There's a lot of abandoned stuff there since it's little used, but I've been keeping track of it lately.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: A base editor

Post by travists »

Can't find the data on fixers:

Code: Select all

fixers.CreateFixers(room1,[(-.9, -0.61, 0.25, 0.667)])
I think the first 3 are xyz, what is the last? (scale perhaps)

I've noticed guilds in the python stuff, are they A currently supported, and B currently implemented? That way I know If I should include them.


Also, clearly the xyz coords and bounding boxes are not in pixels. This is understandable to allow for different resolutions, but what are they in?
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: A base editor

Post by klauss »

Coordinates all over the place are "normalized", (0,0) is the screen's center, (-1,-1) is top-left, (1,1) is bottom-right. IIRC. Some axis might be flipped (ie: top-left could be (-1,1)).

All sprites are given in the form of a center and dimensions, so center=(0,0) dimensions=(2,2) would fill the screen.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: A base editor

Post by travists »

klauss wrote:@travists: that looks simple and intuitive enough. If you can output the kind of XML XGUI.py would take when finished, we have something.

Ran this test of my code before I got your note on the numbers. That may take some math.... Anyway, the numbers arn't valid yet, but this is a direct dump from my program so far:

Code: Select all

#Initial Imports
import Base
import dynamic_mission
import VS
import fixers
def MakeLandingAndConcourse(time_of_day):
	time_of_day=''#not used
	dynamic_mission.CreateMissions()
plist=VS.musicAddList('C:\BaseMakerTest\music\02 - Axel F.mp3')
VS.musicPlayList(plist)
#rooms setup
room = base.room ('bob')
room0= roomBase.Texture (room, 'background', C:\BaseMakerTest\marsTexture.jpg', 0, 0)
#Set Hotspots
Base.Link (0, 'my_Link_id',  281,  154,  100,  50, Room1);
Base.Comp (0, 'my_Comp_id',  93,  57,  50,  50, 'ShipDealer Info Upgrade Cargo Mission_Computer Missions News  ');
I think I about have the basics licked.
pheonixstorm
Elite
Elite
Posts: 1567
Joined: Tue Jan 26, 2010 2:03 am

Re: A base editor

Post by pheonixstorm »

Good job so far. Can't wait to see how it turns out. I wonder what might be easier to port it too though.. GTK or QT. GTK I could setup a new project for it but have no experience with gtk while QT I have used often but whoever wants to build from source (on windows) will have to download QT4 and thats a hefty 300-400mb download.

@klauss:
Digging into the cockpit files I think there is a way to adjust the radar views.

Code: Select all

<Radar file="" xcent=".5995" ycent="-.429" width=".23" height=".33"/>
for the radar itself with radar.sprite providing the image size. Its untested, but seems to me it should work else the privateer radars would be a mess.
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: A base editor

Post by travists »

QT I think is the one that has a plug in for visual studio. I simply grabed the 2008 Visual Basic side, but this next time I can grab the whole shooting match and run the plug in. I'd certainly post the source, but the exeicutable would be just as simple to upload, with a shorter time to get running! If you know some vb and want to play, I can post what I have now too.
pheonixstorm
Elite
Elite
Posts: 1567
Joined: Tue Jan 26, 2010 2:03 am

Re: A base editor

Post by pheonixstorm »

Well, there are too many apps and tools that were made for VS that no longer work and have NO source code that I am trying to make sure any future contributions have either and app or just the source so we don't loose any more tools/apps to abandonment.
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: A base editor

Post by travists »

Sure, makes perfect sense to me. Think I'll try to figure out what math I need for the convertion to usable then upload. -no editing yet just creation and launch may not have your ship, but useable.
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: A base editor

Post by klauss »

That portability issue is why a long time ago it was decided that python with tkInter was the best choice, python comes with tkInter in its standard library, so whereever python is installed, it would run.

tkInter is a bit harder to work with than Qt, but there are tools.

There are similar tools for PyQT and PyGTK, which would also be quite portable. For windows, there's a py2exe program that can package all the required modules in an executable form, so people don't have to install python.

So... it's a good choice. Python's not hard to learn at all, if you code in C++, you'll grasp python basics in no time, and you'll get rid of a ton of portability headaches.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: A base editor

Post by travists »

Not ditching python just yet. First, I'm programming it in what I know to get a feel for what needs to be done. If I can port from VB to multi-platform, that's one less step. If not, I know more than when I started and can focus on picking up the new language. My C was limited at its best and now is rusty and limited. In the interests of a usable product as soon as possible, I'm starting with the familiar. It may end in python after all.

Soon isn't just a service, I've been working on and off on a 2D adventure game for eons. If I don't crack it soon, or hit a wall, my interests my just wander. Then all there would be is a nice thread that goes nowhere
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: A base editor

Post by travists »

Could someone check my math here?

To convert from the pixel based top left is 0,0 that I currently have it should be:

(X/(window width/2))-1

right?
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: A base editor

Post by klauss »

Pretty much, but it's more complex, since base screens have a configurable "margin".

You really want to use GUI.py's GUIRect for that math ;-)

Do take a look at main_menu.py
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: A base editor

Post by travists »

Ok, I've looked at main_menu.py and see how that would simplify thing in one respect. But it looks it handles clicks completely differently from the rest of the bases. The base.link, and base.comp are each designed to do something specific. Unless I'm missing something, to use the GUI.py I'd have to completely redo the base structure. Other than fixers, I'm not placing decorative sprites...yet. Though, now that I think about it, it sounds like something to include after the main features are taken care of.

Code: Select all

       
   For H = 0 To 255
         If Hotspots(H).Type <> "" Then
               rtbCode.Text = rtbCode.Text + "Base." + Hotspots(H).Type + " (" + Hotspots(H).Inroom + ", 'my_" + Hotspots(H).Type + "_id', " + Str(Hotspots(H).X) + ", " + Str(Hotspots(H).Y) + ", " + Str(Hotspots(H).Width) + ", " + Str(Hotspots(H).Height) + ", " + Hotspots(H).Data + ");" + vbNewLine
         End If
   Next
Ok, I've looked at main_menu.py and see how that would simplify thing in one respect. But it looks it handles clicks completely differently from the rest of the bases. The base.link, and base.comp are each designed to do something specific. Unless I'm missing something, to use the GUI.py I'd have to completely redo the base structure. Other than fixers, I'm not placing decorative sprites...yet. Though, now that I think about it, it sounds like something to include after the main features are taken care of.

That is how I presently turn the internal inputs into useable script.

To place an item, you click on the center point, then enter width and height. Depending on type you either enter a room number, or select available displays for the computer.

I'll gladly import gui.py and use that, but I only see buttons and sprites in main_menu.

I understand you know a fair bit of the current code. Will base.link accept a GUI statement in it? Is there a related command in GUI.py's code? I do appreciate the help, just not sure how the two methods will work together. Thanks for all of your time!
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: A base editor

Post by klauss »

GUI.py is a wrapper around Base.link stuff.

If you use GUI.py, you stick to it.

GUI.py is simpler when you have to do complex stuff. If you want a button to do something, with GUI.py you tell it to call a function when clicked (or you can override its onClick method).

You have more complex widgets too.
  • Elements:
    • GUIStaticImage: just a decorative image, or a base class for defining other widgets.
    • GUIStaticText: a text element
    • GUILineEdit: an editable text box
    • GUIButton: a skinnable press-button.
    • GUICompButton: A GUIButton that links to the built-in computer interface (like Base.Comp).
    • GUIRoomButton: A GUIButton that links to a room (like Base.link)
    • GUICheckButton: A tristate checkbox. A button you toggle between checked, unchecked and neutral.
    • GUIRadioButton: A standard radio button
    • GUISimpleListPicker: A list of elements you can pick from
    • GUIVideoTexture: instead of an image, it takes a video that will be looped forever (untested)
    • GUIVideoStream: a movie, you can startPlaying, stopPlaying, if it has sound it will... sound... etc.
  • Room types:
    • GUIRoom: A normal room, you can attach elements to it
    • GUIMovieRoom: A cutscene. When you enter this room, a movie starts playing. When it finishes playing (or the user skips the movie), it takes you to the "nextroom".

I think that's a comprehensive yet superficial listing of what GUI.py offers.

Building all that with Base.<blah> stuff isn't trivial, that's why I recommend using GUI.py for new stuff.

If you really really just want the math to get coordinates right, you can obtain them through GUIRect.

Code: Select all

from GUI import GUIRect

# for drawing sprites
GUIRect( 0, 0, 100, 10, ref=(1024,768) ).getSpriteRect()

# for hotzones
GUIRect( 0, 0, 100, 10, ref=(1024,768) ).getHotRect()

# for text areas
GUIRect( 0, 0, 100, 10, ref=(1024,768) ).getTextRect()
You have different coordinate systems for sprites, hot zones and text elements. It's messy, Base.<whatever> stuff is just that messy, and we can't fix it without breaking just too much content, so GUI.py is a nice way to get away from that madness.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: A base editor

Post by travists »

Most Excellent!! :mrgreen: :mrgreen: I'll take a look at those commands in further detail later. As for the fixer code I don't know what I was thinking, its x, y, H,w :oops:


perhaps guy.py can handle them too??

With Static images and movies, it may be possible to have quite fancy bases with the current setup. Thanks!!
pheonixstorm
Elite
Elite
Posts: 1567
Joined: Tue Jan 26, 2010 2:03 am

Re: A base editor

Post by pheonixstorm »

Any luck getting a working copy up and running?
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: A base editor

Post by travists »

Close, Got a base output, had some trouble with link positions. Retooling with GUI.py. Will jpgs work?
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: A base editor

Post by klauss »

jpgs, pngs and dxt1/3/5-coded dds all work
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: A base editor

Post by travists »

But I need to use nvcompress to encode them? Having trouble seeing backgrounds when I test, that's why I ask.
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: A base editor

Post by klauss »

Well, the tool should be able to decode them.

Encoding them should be a decision left to the artist, since there's a lot of things to weigh before taking that step. Some screens wouldn't benefit much from DXT compression, some might look noticeably degraded and the artists might choose not to compress them.

I'm of the idea that base interface stuff shouldn't be compressed with DXT, only png or jpg, since quality there is rather important and memory bandwidth within bases isn't a main concern.

But the tool should be able to take DXT images and display them.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: A base editor

Post by travists »

Sounds like a 1.01 thing, I'm kinda at .01; just barely functional. That would be ideal though.
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: A base editor

Post by travists »

GUI base is tanking fast... anyone have a base using GUI.py working? May have to switch back. Ah well, till I figure out how to do the ship and fixers it won't be useable anyway.

Status Report:

Interface: working

Rooms, Standard mode: Iffy
Computers, standard mode: functional, but missplaced.
Links, standard mode: functional, but missplaced.
Ship placement, standard mode: Not sure how
Fixers, standard mode: Not sure how

Rooms, GUI mode: DOA
Computers, GUI mode: DOA
Links, GUI mode: DOA
Ship placement, GUI mode: Unknown Functionality
Fixers, GUI mode: Unknown Functionality

Saving: working(mostly)
Loading: Not sure how
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: A base editor

Post by travists »

:evil: That's where it was... need to debug again!
pheonixstorm
Elite
Elite
Posts: 1567
Joined: Tue Jan 26, 2010 2:03 am

Re: A base editor

Post by pheonixstorm »

Ah the joys of programming... For basemaker I am thinking if I would be better off taking out opengl and trying to copy it over to a directx app :roll:
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: A base editor

Post by klauss »

travists wrote:Saving: working(mostly)
Loading: Not sure how
Build an XML, we'll make xgui.py load the xml.

see how easy? :D
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
Post Reply