Open Surge Forum

A fun 2D retro platformer inspired by Sonic games and a game creation system

You are not logged in.

Announcement

Our community has moved to Discord! https://discord.gg/w8JqM7m

#51 2017-09-24 17:55:14

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,300
Website

Re: Introducing SurgeScript (released! v0.5.2)

Sorting in SurgeScript

One of the most important themes in computer science is sorting. In games, you may use sorting, for example, to create a high scores table and display the highest scores first. SurgeScript allows you to sort arrays using the sort() method: smile

Original array:
3 7 1 5 9 2 4 6 8 0
Sorting in ascending order...
0 1 2 3 4 5 6 7 8 9
Sorting in descending order...
9 8 7 6 5 4 3 2 1 0
Sorting in custom order (odds first)...
1 3 5 7 9 0 2 4 6 8

You can sort anything: numbers, strings and even more complex data.

Code link: sort_array.ss

Offline

#52 2017-10-19 16:48:13

TheSeventhEmerald
Member
From: Spain
Registered: 2010-04-19
Posts: 302

Re: Introducing SurgeScript (released! v0.5.2)

I can see that the development of SurgeScript does not stop. The progress is awesome. Having such tool as the scripting engine inside Open Surge is going to make it really powerful.

When will be integrated?


Piece of cake...!

Offline

#53 2017-10-19 19:12:20

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,300
Website

Re: Introducing SurgeScript (released! v0.5.2)

TheSeventhEmerald wrote:

When will be integrated?

It's about to be integrated. One or two details to do, and the first build of SurgeScript will be done. Then comes the integration.

Offline

#54 2017-10-25 17:16:03

SynfigMaster91
Member
Registered: 2017-10-10
Posts: 144

Re: Introducing SurgeScript (released! v0.5.2)

Can't wait to see this program released smile

It will be awesome to make games of all genres on an easy way!

Offline

#55 2018-01-04 22:57:24

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,300
Website

Re: Introducing SurgeScript (released! v0.5.2)

Advanced features

A very nice feature of object-oriented programming languages is called a functor (or function object). It allows you to have objects that behave like functions.

In SurgeScript, you can do really powerful programming using functors. In the example below, we have an object called Benchmark that can measure the performance of any code/object that you provide:

// We'll measure the performance of the computation of the Fibonacci sequence using an exponential method
object "Application"
{
    benchmark = spawn("Benchmark");
    fib = spawn("Fibonacci");

    state "main"
    {
        t  = benchmark(fib(1));
        t += benchmark(fib(5));
        t += benchmark(fib(10));
        t += benchmark(fib(25));
        t += benchmark(fib(32));
        Console.print("Total time: " + t + " seconds.");
        Application.exit();
    }
}

In my computer, the output of this program is as follows:

Computing ExpFib(1) = 1          done in 0.000018 seconds.
Computing ExpFib(5) = 5          done in 0.000052 seconds.
Computing ExpFib(10) = 55          done in 0.000478 seconds.
Computing ExpFib(25) = 75025          done in 0.203170 seconds.
Computing ExpFib(32) = 2178309          done in 5.642050 seconds.
Total time: 5.845768 seconds.

Check out the full example!

Granted, it's an advanced feature. smile

Offline

#56 2018-01-05 09:40:24

G.E.R.
Member
From: Russia, Krasnodar
Registered: 2017-12-26
Posts: 177

Re: Introducing SurgeScript (released! v0.5.2)

Advanced features

Is this script necessary for levels with a large map and a large number of objects?
I think It can be tested in a virtual machine with Windows 98 or 2000.

Offline

#57 2018-01-05 10:01:40

TheSeventhEmerald
Member
From: Spain
Registered: 2010-04-19
Posts: 302

Re: Introducing SurgeScript (released! v0.5.2)

G.E.R. wrote:

Is this script necessary for levels with a large map and a large number of objects?
I think It can be tested in a virtual machine with Windows 98 or 2000.

I don't think so. Open Surge runs well even in old computers, and once the map is loaded you should have no problem. It is more useful to test algorithms inside the new SurgeScript.

Alexandre wrote:

Advanced features
A very nice feature of object-oriented programming languages is called a functor (or function object). It allows you to have objects that behave like functions.

In SurgeScript, you can do really powerful programming using functors. In the example below, we have an object called Benchmark that can measure the performance of any code/object that you provide

Granted, it's an advanced feature.

Nice addition. My only criticism is that the functor has not a very clear syntax. At least for me it is diffiicult to understand, only reading the code, what is exactly the black magic behind it. In C++ for example the functor is done overloading (), which is way easier to understand. However, it may be matter to get used to it.

I see that the scripting is getting really complete. I think it is time to integrate it with the Open Surge engine to test it in the wild. I really want to get my hands dirty with it.

Happy new year to everybody, BTW.

Last edited by TheSeventhEmerald (2018-01-05 10:01:58)


Piece of cake...!

Offline

#58 2018-01-14 10:36:00

aronthehedgehog
Member
From: Lincoln, NE
Registered: 2013-04-05
Posts: 390

Re: Introducing SurgeScript (released! v0.5.2)

I'm sorry for butting in on the conversation (this should be in another section but...), Is it possible to set a custom fps for a Sprite via objects?

If it's not, that's ok, but I want to know if it's possible to do so. I want to play around with certain time variables and I want it to include sprite fps.

(I sped read the whole thing because I'm on time constraints right now, so if it's already an asked question I understand.)


Not active much anymore.
The only things I do now is just let inspiration come to me when it's needed.
Also bad profile pic because I don't have anything else in mind.

Offline

#59 2018-01-15 13:26:01

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,300
Website

Re: Introducing SurgeScript (released! v0.5.2)

aronthehedgehog wrote:

I'm sorry for butting in on the conversation (this should be in another section but...), Is it possible to set a custom fps for a Sprite via objects?

If it's not, that's ok, but I want to know if it's possible to do so. I want to play around with certain time variables and I want it to include sprite fps.

(I sped read the whole thing because I'm on time constraints right now, so if it's already an asked question I understand.)

Hi aronthehedgehog, welcome back. smile

set_animation_speed_factor

Offline

#60 2018-01-16 02:14:24

aronthehedgehog
Member
From: Lincoln, NE
Registered: 2013-04-05
Posts: 390

Re: Introducing SurgeScript (released! v0.5.2)

Alexandre wrote:
aronthehedgehog wrote:

I'm sorry for butting in on the conversation (this should be in another section but...), Is it possible to set a custom fps for a Sprite via objects?

If it's not, that's ok, but I want to know if it's possible to do so. I want to play around with certain time variables and I want it to include sprite fps.

(I sped read the whole thing because I'm on time constraints right now, so if it's already an asked question I understand.)

Hi aronthehedgehog, welcome back. smile

set_animation_speed_factor

Ok, thanks!
This'll greatly help me.


Not active much anymore.
The only things I do now is just let inspiration come to me when it's needed.
Also bad profile pic because I don't have anything else in mind.

Offline

#61 2018-01-16 22:37:53

KZR
Member
Registered: 2010-07-14
Posts: 1,447
Website

Re: Introducing SurgeScript (released! v0.5.2)

I can add to that. If you use a global variable like $_gamespeed and multiply every object/player speed including gravity and jump power, and animation speed factor by it, you can do two things:

modify the speed of the whole game to your taste without doing it per object and per player

simulate slow-motion and fast forward

in fact for this to completely work for players you have to create an actor object, which is no more than a mimic of the player's animations, while the player itself is invisible

hopefully setting game speed will be easier in the future (set_game_speed N)

Last edited by KZR (2018-01-16 22:41:57)


SD_sml.pngSeD_sml.pngLTot_W_sml.png
https://discord.gg/w8JqM7m ---> Open Surge's Discord server

Offline

#62 2018-04-01 02:51:27

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,300
Website

Re: Introducing SurgeScript (released! v0.5.2)

The SurgeScript documentation will be available at:

https://alemart.github.io/surgescript/ cool

In the next few days I'll add some more content, and then proceed to the engine integration. There are no more language features I plan to develop for the time being.

Offline

#63 2018-04-15 23:57:23

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,300
Website

Re: Introducing SurgeScript (released! v0.5.2)

SurgeScript v0.5.0 is released!

opensurge.png

I'm glad to announce that SurgeScript v0.5.0 has just been released! big_smile

Official website: https://alemart.github.io/surgescript (contains full documentation)

Download link: https://github.com/alemart/surgescript/releases

This beta version has not been integrated into the Open Surge Engine yet. However, it supports text mode and the core of the language is fully operational! You can try it out playing with scripts. You need to compile it at this time.

This is a total evolution from the previous scripting system embedded in Open Surge. It retains the easy things of the state machines, but adds extraordinary power to you. With SurgeScript, you will be able to unleash your unlimited creativity! smile

If you find any bugs, please let me know. If you want to ask anything about SurgeScript, please feel free to do so!

This has been a lot of work! Soon I'll be announcing details about the engine integration.

Offline

#64 2018-04-17 12:57:25

SynfigMaster91
Member
Registered: 2017-10-10
Posts: 144

Re: Introducing SurgeScript (released! v0.5.2)

Alexandre wrote:
SurgeScript v0.5.0 is released!

opensurge.png

I'm glad to announce that SurgeScript v0.5.0 has just been released! big_smile

Official website: https://alemart.github.io/surgescript (contains full documentation)

Download link: https://github.com/alemart/surgescript/releases

This beta version has not been integrated into the Open Surge Engine yet. However, it supports text mode and the core of the language is fully operational! You can try it out playing with scripts. You need to compile it at this time.

This is a total evolution from the previous scripting system embedded in Open Surge. It retains the easy things of the state machines, but adds extraordinary power to you. With SurgeScript, you will be able to unleash your unlimited creativity! smile

If you find any bugs, please let me know. If you want to ask anything about SurgeScript, please feel free to do so!

This has been a lot of work! Soon I'll be announcing details about the engine integration.

Yo, Alex smile

Congratulations in uploading this. wink

I'm going to test it but you said the best way is using the Open Surge Engine. When will we have the link? And more importantly, how can I start using the SurgeScript on it?

Offline

#65 2018-04-17 13:46:39

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,300
Website

Re: Introducing SurgeScript (released! v0.5.2)

SynfigMaster91 wrote:

I'm going to test it but you said the best way is using the Open Surge Engine. When will we have the link? And more importantly, how can I start using the SurgeScript on it?

In a few days.

Right now, the only way to test it is using the standalone version. I'll be making a video explaining how to use this early version.

You can start using SurgeScript right now if you follow the instructions on the website.

Thanks for the support, Alvaro smile

for everyone: the API Reference on the Open Surge Wiki will be turned obsolete. There's a new Reference for SurgeScript, featuring a more friendly website.

Offline

#66 2018-04-17 13:52:16

TheSeventhEmerald
Member
From: Spain
Registered: 2010-04-19
Posts: 302

Re: Introducing SurgeScript (released! v0.5.2)

I have just read the full documentation.

I am absolutely impressed. It is impressive. It can be used as the finite state machine we have always used in Open Surge. New users can employ only the pre-built functions. Experienced users can mess with conditionals, loops, and even overloading and iterators. It is crazy you managed to implement this only by yourself.

My congrats on this project. I hope it gets some attention, because I think that it could be applied for many game projects with ease. Only counter I see is that it requires integration with a C engine -most developers are using more modern stuff, such as Unity, Godot, or LibGDX/SFML.
In any case, for OpenSurge these are big news. This is going to turn the engine in the most complete and powerful Sonic-like engine ever built. I cannot wait to put my hands over it.

I will try as soon as I have time and give you some comments

Please keep up informed about the integration! big_smile:D:D:D:D:D:D:D:D:D:D

Last edited by TheSeventhEmerald (2018-04-17 13:52:41)


Piece of cake...!

Offline

#67 2018-04-17 15:21:53

G.E.R.
Member
From: Russia, Krasnodar
Registered: 2017-12-26
Posts: 177

Re: Introducing SurgeScript (released! v0.5.2)

I hope I do not have to rewrite all scripts?

Offline

#68 2018-04-17 17:36:41

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,300
Website

Re: Introducing SurgeScript (released! v0.5.2)

TheSeventhEmerald wrote:

I am absolutely impressed. It is impressive.

Hey, thanks TheSeventhEmerald! I knew you would like it smile

TheSeventhEmerald wrote:

This is going to turn the engine in the most complete and powerful Sonic-like engine ever built. I cannot wait to put my hands over it.

Yes, I truly believe this is going to be so. cool

TheSeventhEmerald wrote:

Only counter I see is that it requires integration with a C engine -most developers are using more modern stuff, such as Unity, Godot, or LibGDX/SFML.

SurgeScript can be used with other technologies, such as SFML. It just happens that I personally won't be focusing on other engines at the moment; Open Surge is more than enough work for me. Perhaps I should have phrased it differently. SurgeScript is built in C, which is nearly universal. smile

G.E.R. wrote:

I hope I do not have to rewrite all scripts?

The old scripts will continue to work. However, I won't be updating the old system too often.

Offline

#69 2018-04-20 11:40:01

G.E.R.
Member
From: Russia, Krasnodar
Registered: 2017-12-26
Posts: 177

Re: Introducing SurgeScript (released! v0.5.2)

All this is very good, you are expanding Open Surge project. I decompiled and was studied game engines Sonic Generations and Sonic Mania on last year and I want to note that Open Sonic/Surge is most optimal engine for creating users games.

When you write API Reference, I can translate it on russian (and, maybe, japanese) language

Offline

#70 2018-04-25 21:24:01

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,300
Website

Re: Introducing SurgeScript (released! v0.5.2)

Thanks for the comments, guys.

As promised, I uploaded a video explaining how to use this initial version of SurgeScript: cool

https://youtu.be/LusUl5Xd6V4

As to the next step to the Open Surge project, I'll be working on a system that will allows to deploy the latest development version to the cloud. We'll soon have new builds compiled for you.

Offline

#71 2018-04-27 23:31:58

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,300
Website

Re: Introducing SurgeScript (released! v0.5.2)

Newer builds of Open Surge are now available at the Development Builds thread:
http://opensnc.sourceforge.net/forum/vi … hp?id=1931
Users are encouraged to upgrade to the latest version. smile

Additionally, I made a new tutorial - it's on the wiki. How to cross compile the game:
http://opensnc.sourceforge.net/wiki/ind … dvanced.29
This was written in addition to KZR's tutorial on how to compile on Windows.

Offline

#72 2018-04-29 09:13:15

TheSeventhEmerald
Member
From: Spain
Registered: 2010-04-19
Posts: 302

Re: Introducing SurgeScript (released! v0.5.2)

Wow! Does the new version feature now SurgeScript? You should add a little changelog so we can see what are the new things.

I can run the Windows version using WINE. Any instructions on how to compile the sources for a Linux build? The instructions on cross-compiling look very Windows-oriented.

These are super great news!

Last edited by TheSeventhEmerald (2018-04-29 09:13:29)


Piece of cake...!

Offline

#73 2018-04-29 16:25:31

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,300
Website

Re: Introducing SurgeScript (released! v0.5.2)

TheSeventhEmerald wrote:

Wow! Does the new version feature now SurgeScript?

No. The integration takes a bit of work and will be done gradually.

TheSeventhEmerald wrote:

I can run the Windows version using WINE. Any instructions on how to compile the sources for a Linux build? The instructions on cross-compiling look very Windows-oriented.

You can use the same instructions to compile for Linux (natively). Simply remove the references to MinGW and to cross-compiling and you're all set. If you have any questions, please let me know.

Additionally, if you want to use the OpenAL backend for audio playback (optional), you'll also need ALURE and OpenAL Soft.

TheSeventhEmerald wrote:

These are super great news!

Indeed they are cool

Offline

#74 2018-04-29 23:34:23

lainz
Member
Registered: 2009-02-18
Posts: 202

Re: Introducing SurgeScript (released! v0.5.2)

I like a lot scripting.
You can provide a single executable only with the scripting capabilities to test?

Offline

#75 2018-04-30 13:25:49

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,300
Website

Re: Introducing SurgeScript (released! v0.5.2)

lainz wrote:

I like a lot scripting.
You can provide a single executable only with the scripting capabilities to test?

Yes, in the next few days I'll be providing it.

I'll be releasing SurgeScript 0.5.1 with a few tweaks: you'll be able to easily build it as a static library. This will be important for integrating it into Open Surge. I'll release a Windows executable as well for testing purposes.

Last edited by Alexandre (2018-04-30 13:43:37)

Offline

Board footer

Powered by FluxBB  hosted by tuxfamily.org