Create PGE language

Description: It's archive, posting new is here http://wohlsoft.ru/forum/viewforum.php?f=11

What do you think?

Hell, we should've had this feature already!
0
No votes
Nope too hard for me
0
No votes
Just use the old obsolete user interface and let me do things the hard way.
0
No votes
 
Total voters: 0
Ariana
Topic author, Passerby
Passerby
Ariana
Topic author, Passerby
Passerby
Reputation: 0
Posts: 2
Joined: 16 Aug 2015

Post #1by Ariana » 16 Aug 2015, 11:55

So what is your progress on layers and events guys? I've seen people suggest things like global events and map events. But they didn't give you any idea as of how exactly to implement that. This wild suggestion came to my mind that night while I was making my level in smbx. How about merging the 2 sections of the layers and events into one single user interface called Triggers? In triggers, the level designer should be able to both define, rename and delete layers AND create, edit and delete events. Now let's take this even further. With more advanced UI we will need more advanced features. What if we could have our own programming lnaguage for manipulating game logic within triggers? Nothing too crazy when you think about it. Most people that play smbx will play PGE. And these people are not kids so some programming wouldn't be that hard for them. And when I talk about "programming" I mean not really that much complicated stuff. Like take a look at the following example:

Code: Select all

----- This is a comment
----- Begin User-made Triggers
for (i > 0, i < 21, i++)
{
    wait 0.5s;
    bridgeLayer(block) - i;
}


This is for use in Castle levels where when you get the axe the bridge disappears block by block. Usually to achieve this behavior in smbx you'll have to add like 20 layers for each separate block and 20 chained events. This will wait 0.5 seconds, remove a block from the left side of the bridgeLayer and do the same again - for() loop. This will loop until all the blocks in that layer disappear. For general layer object look below. Another example - taking logic out of the game:

Code: Select all

----- Begin conditional logic
if (enemiesLayer(npc).Dead)
{
    Shout("Well Done! You must've killed all the enemies in that layer!");
}

if (enemiesLayer(Goomba).Dead)
{
    Shout("You killed that single Goomba within the layer!");
}


Now you saw me use the layer called bridgeLayer() above with the block parameter. This returns all the blocks within the layer. As seen here I don't need the blocks anymore so I switched to npc, you guessed it! This returns all NPCs from the layer. You can do the same for backgrounds, water/quicksand and even warps to manipulate which part of the layer exactly does what. However if you want to hide/show ALL objects in the layer you'll have to pass it the general object parameter unit. Example: layerName(unit).Hide(); This will hide everything within that layer. On the other hand, if you want to target a single npc from within that layer you'll have to do it like this: layerName(npcName).Copy(); This should create a copy of the enemy you want from within the layer. Very useful in combination with loops, so that you can create npcs in-game without actually using the editor to place them.
The shout function is very similar to the textbox within the events window. it's purpose is to display text in the game world, with the game font, and act like a pause until the player indicates they read it. It basically takes a string as it's parameter, nothing too hard just get the text in between the double quotes ("). Escaping quotes like this:

Code: Select all

function LevelStart()
{
    Shout("The level called \"MyLevelName\" has been started.");
}


The code above will output the following: The level called "MyLevelName" has been started. This is a bad example because for the level name you could just use the levelName variable, but you get the idea. The function LevelStart() is a game default defined function and cannot be deleted, defined anew nor renamed. However the user can use it to manipulate layers upon game start. There are game-defined layers that act like this, for example Default.

Code: Select all

----- Begin User-made triggers
function onEnemyKIll(layerName(npc), greeting)
{
    Shout(greeting);
}

----- Usage:
if (enemiesLayer(Goomba).Dead)
{
    onEnemyKill(this, "You killed that single Goomba within the layer!");
}


In the above example I passed this to the function param list. The if logical statement is formed of if (condition) { expression; }. So I passed this as a layerName because it is the layer used in the condition. Remember, if there are more than 1 layer used in condition/loop this should throw an exception because the game doesn't know to which layer you are referring.

With this language you can write 4 or 5 lines of code instead of adding like 20 layers and the 20 events one by one. In most cases programming it would be the easier/faster option.

Sorry if the language seems too hard for you, I'm a junior C# developer and I decided to "borrow" some of Microsoft's syntax ideas :biggrin: . Basically this language should be from the C family. Also as you saw above nothing too complicated. Since this is a fictional language (yet :facepalm: ) I will be willing to write the syntax and documentation for each function to enable the actual developers to implement it in C++ if people like this idea of course. Also a programming language for a game editor should have its own name, I'm open for suggestions :)

EDIT:

Pre-defined stuff as of now:

Code: Select all

Layers:
Default
DestroyedBlock
SpawnedNPC
Events:
LevelStart
onPSwitchEnd
onPSwitchStart
Variables:
unit = accepted by layers. Contains everything within a layer.
block = accepted by layers. Contains all blocks within a layer.
npc = accepted by layers. Contains all npcs within a layer.
background = accepted by layers. Contains all backgrounds within a layer.
warp = accepted by layers. Contains all warps within a layer.
water = accepted by layers. Contains all water gravity within a layer.
quicksand = accepted by layers. Contains all quicksand gravity within a layer.
string = accepted by layers. Contains a user-specified unit within a layer.
levelName = returns the name of the level as set in Level Settings, if none, returns null by default

Kevsoft M
Angry developer
Angry developer
Avatar
Kevsoft M
Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #2by Kevsoft » 16 Aug 2015, 12:31

You probably haven't notice yet, but for that we will stick to the scripting language lua. It may has no braces and uses more of a "Visual Basic" syntax, but it is one of the best language when it is coming to performance (especially thanks to luajit).

However, your events you written down are very similar to what we have planned. We cannot implement that 1:1, but we will try to make the syntax as easy as possible.

If you want to get a taste of how it may feel you might want to check out LunaLua. It is a extension to a hack for SMBX I have written, which enables lua scripting in SMBX.
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬

Ariana
Topic author, Passerby
Passerby
Ariana
Topic author, Passerby
Passerby
Reputation: 0
Posts: 2
Joined: 16 Aug 2015

Post #3by Ariana » 16 Aug 2015, 12:39

Kevsoft wrote:You probably haven't notice yet, but for that we will stick to the scripting language lua. It may has no braces and uses more of a "Visual Basic" syntax, but it is one of the best language when it is coming to performance (especially thanks to luajit).

However, your events you written down are very similar to what we have planned. We cannot implement that 1:1, but we will try to make the syntax as easy as possible.

If you want to get a taste of how it may feel you might want to check out LunaLua. It is a extension to a hack for SMBX I have written, which enables lua scripting in SMBX.

Oh, I see. How the hell did I miss that... One more thing. You didn't say anything about merging layers with events and what about an in-game code editor? So that scripting can be made even easier? Maybe some basic syntax highlighting and a compile function?

And what about changing the editor selection to be dependent on layers? For example:
Layer:
Default
blocks,
npcs,
backgrounds,
gravity,
warp
So if we split the layer like this we can reference the objects within it with just events and eliminate the need for more layers. Also to select an npc from the game world you should have selected the npc module first and etc for the others. So if you placed a background behind a block you won't have to remove the block and then select the background. And maybe implement a simpler layer movement so we can achieve such things: move 3 blocks with the size of 32x32 in the game world instead of using a speed and duration.


Return to “Troubleshooting”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest