SKOLM - Some kind of lua menu

SKOLM - Some kind of lua menu

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderators: Moderators, Moderators

Post Reply
User avatar
Funkencool
Posts: 542
Joined: 02 Dec 2011, 22:31

SKOLM - Some kind of lua menu

Post by Funkencool »

I'm not looking for any superficial criticism yet. Advice and help on the other hand, are welcome :-)

My goal is fuzzy but relatively straight forward.. Build a feature rich start menu like you see in most games, while using Chili for the GUI. ( Personally my most memorable GUI was UT99 ). My original goal was for BAR specifically. However it made more sense to build something generic I could then fork for BAR. Hopefully other games will find some use in it as well.

Also; Chili, some of the Spring API, and various other lua parts could use improvement. If I accomplish only one thing I'd like it to be creating something that makes these areas more apparent and easier to tackle.

Now for the link to the github repo and a short description..
Like discussed in the 'in-game menu' thread it's a game archive I launch with a basic startscript.
Specifically this one

Code: Select all

[game]
{
	[allyteam0]
	{
		numallies=0;
	}
	[modoptions]
	{
		maxspeed=20;
	}
	
	[player0]
	{
		name=UnnamedPlayer;
		team=0;
	}
	
	[team0]
	{
		allyteam=0;
		teamleader=0;
	}
	
	gametype=SKOLM alpha;
	ishost=1;
	mapname=Ravaged_v2;
	myplayername=UnnamedPlayer;
	nohelperais=0;
	onlylocal=1;
}
For now it works best to create some kind of shortcut for launching. You also might want to change the map, check here viewtopic.php?f=13&t=33196 for ideas

I would've made this thread earlier but I find I have an easier time going through my code than describing it. It isn't much now, and there's a lot of ground work yet to lay; but I'll try keep this updated as I make progress.

New menu proposal: (keep in mind this is mostly separate from my other work)
I think this is pretty solid, and covers everything discussed thus far.

-> Games include lua code. When main menu is loaded it scans and includes this lua.
-> Said lua code contains that games chili (or any UI really) based code for rendering a custom menu.
-> Automagically add tab which loads said menu.
-> Include selectable default menu.

This would allow spring to include it's own generic menu, while allowing games to easily include a custom menu. All from spring.exe.

(I'll put options and that stuff on the right, just didn't for these pics)
Image

using my menu as an example.
Image

Code would be straight forward; this is what I use now

Code: Select all

customMenu = Chili.Control:New{}

AddMenu{name = 'BAR', content = customMenu, color = bla, etc..}
I'm working on a proof of concept with BAR as I type this , I'll try get some more info up later.

Other things I want/could do:
  • Incorporate gajops work to include lobby chat/multiplayer as menus
  • Work on API so user widgets can easily add custom menus (should be easy)
    • would allow users to download and use there own menus
Last edited by Funkencool on 07 Mar 2015, 17:02, edited 5 times in total.
0 x

gajop
Moderator
Posts: 3023
Joined: 05 Aug 2009, 20:42

Re: SKOLM - Some kind of lua menu

Post by gajop »

Why aren't you using VFS.GetGames() to get a list of games?
It's cleaner, and the way you're doing it now includes modtype = 0 archives.
0 x

gajop
Moderator
Posts: 3023
Joined: 05 Aug 2009, 20:42

Re: SKOLM - Some kind of lua menu

Post by gajop »

Slightly unrelated, but I see you're using luasockets with "api.springfiles.com". If you ever make an API for that, it would be great to have something like liblobby, perhaps "libspringfiles", or "springfilesapi" that could be used by other projects as well. ;)
0 x

User avatar
Funkencool
Posts: 542
Joined: 02 Dec 2011, 22:31

Re: SKOLM - Some kind of lua menu

Post by Funkencool »

gajop wrote:Why aren't you using VFS.GetGames() to get a list of games?
It's cleaner, and the way you're doing it now includes modtype = 0 archives.
Short answer: It doesn't give side data

If I'm accessing the actual dir or archive I can include sidedata.lua and many other goodies not supplied by VFS.GetGames(). I'd maybe use it to get a basic list instead of VFS.DirList() and VFS.SubDirs(), but it also doesn't provide dir and archive names, which I need to get that extra data.

All that aside, cleaning that code up is what I'm working on right now.
gajop wrote:Slightly unrelated, but I see you're using luasockets with "api.springfiles.com". If you ever make an API for that, it would be great to have something like liblobby, perhaps "libspringfiles", or "springfilesapi" that could be used by other projects as well. ;)
Some of that code might have made sense at one point but there's a lot of coded all night into the next night type stuff in it. Take it with a grain of salt for now :regret:

I think I even tried disassembling the smt to get the height and minimap at one point (way over my head)
0 x

gajop
Moderator
Posts: 3023
Joined: 05 Aug 2009, 20:42

Re: SKOLM - Some kind of lua menu

Post by gajop »

Funkencool wrote:
gajop wrote:Why aren't you using VFS.GetGames() to get a list of games?
It's cleaner, and the way you're doing it now includes modtype = 0 archives.
Short answer: It doesn't give side data
but it also doesn't provide dir and archive names, which I need to get that extra data.
I actually remember reading these complains before I think. Getting side data as well could be fixable, but dir archive is not really useful I think, because if you use normal sdz/sdd-s, you don't have access to pool (rapid archives).

Would be great if we could do load a pool archive with VFS as well, but not sure how hard that would be...?
0 x

User avatar
Funkencool
Posts: 542
Joined: 02 Dec 2011, 22:31

Re: SKOLM - Some kind of lua menu

Post by Funkencool »

gajop wrote:Would be great if we could do load a pool archive with VFS as well, but not sure how hard that would be...?
I think that would be preferable, if doable. Mapoptions.lua and Modoptions.lua are a couple more important ones to have(eventually). Besides that one could go as far as pulling bitmaps out of games for various purposes, like adding/changing a background or getting a certain icon. A springfiles API would be useful in a similar way.
0 x

User avatar
Funkencool
Posts: 542
Joined: 02 Dec 2011, 22:31

Re: SKOLM - Some kind of lua menu

Post by Funkencool »

Essentially all this stuff is in unitsync.dll (or even engine) already, we just don't have a way of accessing it.
In the mean time, I'm taking a little liberty with my methods :regret:
0 x

User avatar
Funkencool
Posts: 542
Joined: 02 Dec 2011, 22:31

Re: SKOLM - Some kind of lua menu

Post by Funkencool »

combined with OP
Last edited by Funkencool on 07 Mar 2015, 15:18, edited 1 time in total.
0 x

gajop
Moderator
Posts: 3023
Joined: 05 Aug 2009, 20:42

Re: SKOLM - Some kind of lua menu

Post by gajop »

I like the "settings in the top right corner" design you're pushing here ;) I'm doing the same thing with chililobby if you've noticed here: viewtopic.php?f=23&t=33190#p567177

Keep up the good work!
0 x

gajop
Moderator
Posts: 3023
Joined: 05 Aug 2009, 20:42

Re: SKOLM - Some kind of lua menu

Post by gajop »

Funkencool wrote: Incorporate gajops work to include lobby chat/multiplayer as menus
Just a heads up, I'm currently doing major work on this with the implementation of queue system, i18n, and some other stuff.
Oh and I'll also be stealing your code from here, chililobby is meant to handle both singleplayer and multiplayer content ;)
0 x

User avatar
Funkencool
Posts: 542
Joined: 02 Dec 2011, 22:31

Re: SKOLM - Some kind of lua menu

Post by Funkencool »

gajop wrote:
Funkencool wrote: Incorporate gajops work to include lobby chat/multiplayer as menus
Just a heads up, I'm currently doing major work on this with the implementation of queue system, i18n, and some other stuff.
Oh and I'll also be stealing your code from here, chililobby is meant to handle both singleplayer and multiplayer content ;)
You should be able to basically drag and drop this
https://github.com/LebDooder/StartMenu/ ... irmish.lua
with minimal changes, for a basic single player (subject to many changes tho). you probably already knew this tho :regret:

The great thing about chili is how easy it is to mix and match :mrgreen:
0 x

gajop
Moderator
Posts: 3023
Joined: 05 Aug 2009, 20:42

Re: SKOLM - Some kind of lua menu

Post by gajop »

Funkencool wrote: I like the icons too, I just haven't mustered up the motivation to get any myself (on the todo list).
As far as including your's goes, it should be easy to just basically wrap it in my chili and leave it at that. But I won't likely be doing that for awhile anyway.
You can always use mine although I'm going for a blue-ish theme where you are doing a red thing.
The licences include the site I got them from so you might be able to find related things there.
This reminds me, I'm not sure how usable our lobbies are with the different chili skins. It sometimes seems as the coords/padding needs fixing when modifying it.

My one suggestion is to use i18n from the get go. It's available already as a Spring/rapid dependency so it wouldn't be too much work ;)
Funkencool wrote: The great thing about chili is how easy it is to mix and match :mrgreen:
It sorta is, but at the same time I see the difficulties in writing reusable GUI components. We will likely keep changing things so they fit in our vision of how a lobby should look like, where as I would rather we combine effort on common things while just extending/configuring the rest.
However, it seems really hard to make anything reusable like that though, so I guess with the exception of libs such as liblobby, i18n, chiliui and similar, most GUI work would involve copy/pasting :p
0 x

User avatar
Funkencool
Posts: 542
Joined: 02 Dec 2011, 22:31

Re: SKOLM - Some kind of lua menu

Post by Funkencool »

gajop wrote:My one suggestion is to use i18n from the get go. It's available already as a Spring/rapid dependency so it wouldn't be too much work
Thanks, I will definitely keep this in mind
gajop wrote:It sorta is, but at the same time I see the difficulties in writing reusable GUI components
True, but at least with chili my work and your work are basically using the same framework. It makes that copy/pasting a little easier to handle.
It also keeps the UI mostly coherent between widgets. So for instance when I included your chat code in my earlier work; It allowed me to mostly ignore the backend stuff and just deal with the chili control it was tied to.
0 x

Post Reply

Return to “Lua Scripts”

cron