You are not logged in.
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:
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
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
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
Can't wait to see this program released
It will be awesome to make games of all genres on an easy way!
Offline
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.
Offline
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
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.
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
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
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.
Offline
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.
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
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)
https://discord.gg/w8JqM7m ---> Open Surge's Discord server
Offline
The SurgeScript documentation will be available at:
https://alemart.github.io/surgescript/
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
I'm glad to announce that SurgeScript v0.5.0 has just been released!
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!
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
SurgeScript v0.5.0 is released!
I'm glad to announce that SurgeScript v0.5.0 has just been released!
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!
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
Congratulations in uploading this.
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
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
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
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! :D:D:D:D:D:D:D:D:D:D
Last edited by TheSeventhEmerald (2018-04-17 13:52:41)
Piece of cake...!
Offline
I hope I do not have to rewrite all scripts?
Offline
I am absolutely impressed. It is impressive.
Hey, thanks TheSeventhEmerald! I knew you would like it
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.
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.
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
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
Thanks for the comments, guys.
As promised, I uploaded a video explaining how to use this initial version of SurgeScript:
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
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.
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
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
Wow! Does the new version feature now SurgeScript?
No. The integration takes a bit of work and will be done gradually.
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.
These are super great news!
Indeed they are
Offline
I like a lot scripting.
You can provide a single executable only with the scripting capabilities to test?
Offline
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