Author Topic: 'Expiremental' GAE, with new stuff!  (Read 4183 times)

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
'Expiremental' GAE, with new stuff!
« on: 27 November 2009, 08:36:54 »
An experimental version of GAE is now available, consider it a sneak peak at 0.2.13, the functionality added will probably be the last for 0.2.

For people wishing to get a head start with the new Lua additions or to play with the options for particles systems that Daniel introduced...
Win-32
linux-x86

I'm assuming this wont have a large audience, so I'm supplying a windows binary only atm, if anyone wants a linux binary, make some noise.


The download is just the executable, please ensure you can run 0.2.12b first.

I still haven't documented all the new Lua function yet, some of them were quite literally just added...

but here they are, in a nutshell...

setTimer(name, type, interval, periodic)
stopTimer(name)
registerRegion(name, area) -- a 'rectangle', specified as { x, y, w, h }
registerEvent(name)
setUnitTrigger(unitId, condition, event)
setUnitTriggerX(unitId, condition, event, userData)
setFactionTrigger(factionIndex, condition, event, userData)
lockInput()
unlockInput()
unfogMap(area)
giveTargetCommand(unitId, command, targetId)
giveStopCommand(unitId, command)
playerName(factionIndex)
scenarioDir()

-- and some debugging aids...
debugLog(msg)
consoleMsg(msg)
hilightCell(pos)
hilightRegion(region) -- region == name of registered region
clearHilights()


I'll be documenting them asap and will post a link, some decent examples might take a bit longer... you don't want to see the Lua I've been writing in the last few days ;)

Edit: Ooops...

I forgot to mention one other thing... while a proper 'console' for Lua is 'in the pipeline' it probably isn't 'just around the corner', so for the time being a chat message beginning with '~' is not a chat message at all, the tilde is discarded and the rest sent to the Lua interpreter.

Also, I started a new topic and didn't post a pretty picutre ;) here we go... hilightRegion() activated (numerous times) in game through a 'chat' message.

« Last Edit: 30 November 2009, 06:03:53 by silnarm »
Glest Advanced Engine - Code Monkey

Timeline | Downloads

wciow

  • Behemoth
  • *******
  • Posts: 968
    • View Profile
Re: 'Expiremental' GAE, with new stuff!
« Reply #1 on: 27 November 2009, 10:56:33 »
Great stuff Silnarm, I've been waiting for the new Lua tags   :)

What exactly does lockInput() and unlockInput() do?

Whilst looking at the pic of highlighted cells I was wondering whether it would be possible to have decals placed by Lua in the future?

I will be testing with the new tags and hopefully produce a new scenario with them in a few days.

Check out my new Goblin faction - https://forum.megaglest.org/index.php?topic=9658.0

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Re: 'Expiremental' GAE, with new stuff!
« Reply #2 on: 27 November 2009, 13:34:07 »
Hmmm............
What are the new particle options?
Egypt Remastered!

Proof: Owner of glest@mail.com

wciow

  • Behemoth
  • *******
  • Posts: 968
    • View Profile
Re: 'Expiremental' GAE, with new stuff!
« Reply #3 on: 27 November 2009, 14:57:43 »
Daniel posted some help with how to use the new particle settings on the Wiki.

https://docs.megaglest.org/GAE/Projectile_Particle_XML
« Last Edit: 18 June 2016, 18:59:24 by filux »
Check out my new Goblin faction - https://forum.megaglest.org/index.php?topic=9658.0

Hectate

  • Guest
Re: 'Expiremental' GAE, with new stuff!
« Reply #4 on: 27 November 2009, 20:39:27 »
Daniel posted some help with how to use the new particle settings on the Wiki.

https://docs.megaglest.org/GAE/Projectile_Particle_XML

We discussed it in a forum post a while back too. This thread (topic 4625.0) has significant details as well as links to the above mentioned wikia information. You'll note that you'll need to understand the OpenGL definitions to understand the different settings - but a few settings that should work as expected are detailed in the thread linked above.

I'm particularly interested in these particles myself...
« Last Edit: 18 June 2016, 18:53:33 by filux »

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: 'Expiremental' GAE, with new stuff!
« Reply #5 on: 28 November 2009, 01:28:22 »
What exactly does lockInput() and unlockInput() do?

Whilst looking at the pic of highlighted cells I was wondering whether it would be possible to have decals placed by Lua in the future?

lockInput() and unlockInput() disables or re-enables user input, primarily so you can prevent the user from moving the camera while doing 'cut-scenes' [I want cooler camera controls for this too, but I'm putting that in the 'too hard for now' basket :(]

Decals are a great idea, for marking objectives and other areas of interest, can't believe I hadn't thought of that.  I'll make a ticket for it, a first hack at probably wouldn't be hard, but it would need to be 'tile' sized (ie, 2*2 cells in game), and 'tile aligned' (ie, on a tile, not 'across' two).
Glest Advanced Engine - Code Monkey

Timeline | Downloads

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: 'Expiremental' GAE, with new stuff!
« Reply #6 on: 28 November 2009, 04:28:30 »
https://sourceforge.net/apps/trac/glestae/wiki/LuaReference

I haven't got to the queries yet, but they are all the same as regular Glest, plus playerName() and scenarioDir(), and I haven't got to the debugging ones yet, but hopefully they should be easy enough to figure out :)
Glest Advanced Engine - Code Monkey

Timeline | Downloads

wciow

  • Behemoth
  • *******
  • Posts: 968
    • View Profile
Re: 'Expiremental' GAE, with new stuff!
« Reply #7 on: 28 November 2009, 10:21:16 »



Well it's certainly experimental!

text at the bottom says "warning, no startup script defined".

I'm assuming Glest is looking for a lua script even in normal games and then just freezes without one. Scenario's work fine though.
Check out my new Goblin faction - https://forum.megaglest.org/index.php?topic=9658.0

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: 'Expiremental' GAE, with new stuff!
« Reply #8 on: 28 November 2009, 13:09:10 »
hehe, yeah.. I've been experimenting with scenarios lots... and clearly didn't try a normal game.  My bad.

... the game is actually just paused, I introduced a function to funnel all lua related errors to, so the error reporting behaviour can be changed easily, it pauses the game... normally it also displays a message box, the dismissing of which will resume the game, but I gave it a 'quietly' parameter at the last minute, to report less serious problems without the message box popping up, but it was still pausing (silently) the game...

Anyway, patched up, updated the file on sourceforge, same link.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

Zoythrus

  • Guest
Re: 'Expiremental' GAE, with new stuff!
« Reply #9 on: 28 November 2009, 18:26:14 »
ok, why cant i make a selection box? and why are my men a foot in the ground?

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: 'Expiremental' GAE, with new stuff!
« Reply #10 on: 29 November 2009, 00:49:32 »
ok, why cant i make a selection box? and why are my men a foot in the ground?

You can't make a selection box because I broke something.

The men aren't 'a foot' in the ground, the terrain geometry is drawn twice, once at normal height with normal textures, then again a bit higher, generally with no textures or colour, this is to support drawing various things over the map for debugging. But even a fully transparent plane cuts off other geometry in Glest... a known problem.  In any case, without the debug rendering, it's not there...

Edit: Selection box problem fixed, file updated, same link.
« Last Edit: 29 November 2009, 02:03:40 by silnarm »
Glest Advanced Engine - Code Monkey

Timeline | Downloads

Loronal

  • Guest
Re: 'Expiremental' GAE, with new stuff!
« Reply #11 on: 29 November 2009, 09:46:02 »
Is it possible to spawn or kill units that enter a region? like
onEnterRegion
for 1,2 do
createUnit ,deamon ,0 ,0)
end

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: 'Expiremental' GAE, with new stuff!
« Reply #12 on: 29 November 2009, 10:33:25 »
Is it possible to spawn or kill units that enter a region? like
onEnterRegion
for 1,2 do
createUnit ,deamon ,0 ,0)
end

Actually, you can't kill units at all from Lua atm, that definitely needs to be changed asap.  Spawning units in response to another unit entering a region is indeed possible, the exact way you set it up could vary a bit, but basically you have a region and an event registered, you then set triggers on the units, that fire the 'event' when the unit enters the region.  Your event handler then spawns the units.

So to set it up, you'd have something like this
Code: [Select]
resgisterRegion("no_go", { 25, 25, 10, 20 }); -- register region

registerEvent("entered_no_go"); -- register event

function unitEvent_entered_no_go(unit_id) -- define event handler
   for i=1, 5 do
      createUnit("daemon", 1, {15,15});
      local id = lastCreatedUnit();
      givePositionCommand(id, "attack", {30, 35} );
   end
end

That registers the region and event, and defines the event handler.  You would then set triggers on whatever units might trigger the event, if you wanted to discourage the human player from going somewhere you might set the triggers like this,
Code: [Select]
<unitCreated>
   local id = lastCreatedUnit();
   local faction = unitFaction(id);
   if faction == 0 then -- if the human player just got a new unit
      setUnitTrigger(id, "region=no_go", "entered_no_go");
   end
</unitCreated>

Glest Advanced Engine - Code Monkey

Timeline | Downloads

Loronal

  • Guest
Re: 'Expiremental' GAE, with new stuff!
« Reply #13 on: 29 November 2009, 14:13:22 »
Cool I was thinking that in Glest Stories a guy could walk in the graveyard and all these undead well attack him. Thanks I think I'm going to go make a scenario right now..

Loronal

  • Guest
Re: 'Expiremental' GAE, with new stuff!
« Reply #14 on: 29 November 2009, 14:15:58 »
There are many terms of noise. There is the fact that many gae ideas become white noise. In images there is noise to make things look rough. Right no I'm using the most common use of noise. LINUX NEEDS LUA TOO I do have dual boot so I'll use this on windows for now...

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: 'Expiremental' GAE, with new stuff!
« Reply #15 on: 30 November 2009, 06:04:41 »
Glest Advanced Engine - Code Monkey

Timeline | Downloads

ZaggyDad

  • Guest
Re: 'Expiremental' GAE, with new stuff!
« Reply #16 on: 30 November 2009, 16:42:30 »
Wow, this is great. Now I can tell my enemies to turn on their allies. XD

wciow

  • Behemoth
  • *******
  • Posts: 968
    • View Profile
Re: 'Expiremental' GAE, with new stuff!
« Reply #17 on: 2 December 2009, 17:02:10 »
There is an error on the Lua Reference page.

It says: unfogMap(area, time) 

It should say: unfogMap(time, area)

Caused me more than a few minutes of head scratching. On the plus side I did eventually figure it out using the new Lua debug messages rather than come running to the forums to complain that the function was broken.
Check out my new Goblin faction - https://forum.megaglest.org/index.php?topic=9658.0

Loronal

  • Guest
Re: 'Expiremental' GAE, with new stuff!
« Reply #18 on: 2 December 2009, 17:58:14 »
Cool thanks that will help a lot. Also just a question how do you view all the lua commands? I have only used those that pop up in glest and things like that

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: 'Expiremental' GAE, with new stuff!
« Reply #19 on: 3 December 2009, 01:35:17 »
There is an error on the Lua Reference page.
Thanks!

Quote
... On the plus side I did eventually figure it out using the new Lua debug messages rather than come running to the forums to complain that the function was broken.
A little bit nicer, isn't it :)

Cool thanks that will help a lot. Also just a question how do you view all the lua commands? I have only used those that pop up in glest and things like that
http://sourceforge.net/apps/trac/glestae/wiki/LuaReference
Glest Advanced Engine - Code Monkey

Timeline | Downloads