-
Notifications
You must be signed in to change notification settings - Fork 0
Switch scripting language to angelscript #116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
0993960
add angelscript
AlemSnyder a3a131d
slightly cleanup cmake file
AlemSnyder b2b9af6
add tests
AlemSnyder 6fddc68
Angelscript tests and loading
AlemSnyder 2384df5
initialize reference count to one.
AlemSnyder 501ce46
angelscript return types
AlemSnyder 8deeb91
angelscript logging and other tests
AlemSnyder da88497
comment out angelscript code in biome map
AlemSnyder 073b13e
remove memory leaks from multithreading
AlemSnyder 9f7b440
clean up
AlemSnyder a31234f
angelscript map test
AlemSnyder 5388f28
Add a load time test
AlemSnyder 27242b0
maybe clang 19
AlemSnyder 8b422f6
apt install
AlemSnyder d192404
Merge branch 'fixes' into change_to_as
AlemSnyder bae239c
remove sol and lua
AlemSnyder 70ef9aa
use plant map name for map
AlemSnyder 97e2d74
formatting documentations and include
AlemSnyder b7c8f9c
suggested changes
AlemSnyder 1cf7b62
suggested changes and angelscript namespace
AlemSnyder 2dc938b
add error checking to interface
AlemSnyder 2dc1f60
suggested changes
AlemSnyder 1c759f6
error checking
AlemSnyder 5cf688c
remove message callback from global context
AlemSnyder b26c21d
one run function
AlemSnyder 93ad8c7
change how errors are processed
AlemSnyder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| // Biome map files must define a function that returns a structure with a "map". | ||
| // The map function is called from c++ and reads the x and y lengths. Using this | ||
| // information the "map" key of the returned structure can be used as if it were | ||
| // a 2D array. | ||
|
|
||
| // Anyway, do something like this and it should work as long as there are | ||
| // correctly defined tile types and tile macros. | ||
|
|
||
| // Base = Base or {} | ||
| // Base.biome_map = Base.biome_map or {} | ||
|
|
||
| // Base.biome_map.spacing = .8 | ||
|
|
||
| namespace Base { | ||
|
|
||
| namespace biomes { | ||
|
|
||
| class biome_map { | ||
|
|
||
| TerrainGeneration::FractalNoise noise; | ||
| TerrainGeneration::AlternativeWorleyNoise flower_noise; | ||
| float spacing; | ||
|
|
||
| biome_map() { | ||
| noise = TerrainGeneration::FractalNoise(4, 0.6, 3); | ||
| flower_noise = TerrainGeneration::AlternativeWorleyNoise(32, 0.5, 32); | ||
| spacing = 0.8; | ||
| } | ||
|
|
||
| int sample(int x, int y) { | ||
| // sample noise and set a value | ||
| float height = 12.0 * noise.sample(float(x) * spacing, float(y) * spacing) - 4.0; | ||
| // each value must be integers. math.floor changes doubles to ints | ||
| int height_map_value = int(height) ; | ||
| // This biome only defines tile types between 0, and 6 | ||
| if (height_map_value > 6) { | ||
| height_map_value = 6; | ||
| } | ||
| else if (height_map_value < 0) { | ||
| height_map_value = 0; | ||
| } | ||
| return height_map_value; | ||
| } | ||
|
|
||
| // Maps for trees and bushes | ||
| // name should be used in json file | ||
| float sample_plants(string plant_id, int x, int y) { | ||
| if (plant_id == "Trees_1") { | ||
| int height = sample(x, y); | ||
| if (height == 1) { | ||
| return 0.1; | ||
| } | ||
| else { | ||
| return 0.0; | ||
| } | ||
| } | ||
| else if (plant_id == "Flower_1") { | ||
| int flower_height = int(flower_noise.sample(x * 4, y * 4)); | ||
| if (flower_height > 0) { | ||
| return 0.10; | ||
| } | ||
| else { | ||
| return 0.0; | ||
| } | ||
| } | ||
| else { | ||
| return 0.0; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| } | ||
|
|
||
| } | ||
|
|
||
| void do_something() { | ||
| Base::biomes::biome_map@ map = Base::biomes::biome_map(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,5 +17,5 @@ | |
| } | ||
| ], | ||
| "listeners":"", | ||
| "ai":"ai.lua" | ||
| "ai":"ai.as" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| void test1() { | ||
| int x = 5; | ||
| return; | ||
| } | ||
|
|
||
| int test2() { | ||
| int x = 1 * 2 * 3 * 4 * 5 * 6; | ||
| if (x % 2 == 0) { | ||
| return 2; | ||
| } | ||
| return 1; | ||
| } | ||
|
|
||
| int test3() { | ||
| LOGGING::LOG_BACKTRACE("Backtrace log 1"); | ||
| LOGGING::LOG_BACKTRACE("Backtrace log 2"); | ||
|
|
||
| LOGGING::LOG_INFO("Welcome to AngelScript!"); | ||
| LOGGING::LOG_ERROR("An error message. error code 123"); | ||
| LOGGING::LOG_WARNING("A warning message."); | ||
| LOGGING::LOG_CRITICAL("A critical error."); | ||
| LOGGING::LOG_DEBUG("Debugging foo 1234"); | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| bool is_prime(int N) { | ||
| for (int x = 2; x * x < N; x++) { | ||
| if (N % x == 0) { | ||
| return false; | ||
| } | ||
| } | ||
| return true; | ||
| } |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make an issue for this or update it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#114
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I was confused by what you meant by this. I will make a sub issue on #104.