Yeah I took a look at some of those including XNA. Not really a fan, I like working low-level for this type of programming.
I guess I was a bit rash the other day. Been a bit tense lately.
I also want to re-emphasize. My knowledge of coding has grown tremendously since I started 12D. I would have chose to use C++ now but back then I didn't. That's just how things go.
I understand how VM based languages work. My point was that C++ is not natively cross platform, but you can port it to any platform so long as there are libraries to make it work.
My knowledge of C# was a bit dated yes. That was part of the problem here.
Thought you were a mod still welp.
I was planning on open sourcing to github recently but I unfortunately need to hire a lawyer to write me a license agreement and EULA. I want to retain the rights to the engine so that if I develop a commercial game on it (plan too in the future) I won't have to worry about copyright on contributions from other people and other shit.
I also have asked for opinions and suggestions about things (such as scripting language stuff and shader language stuff). Haven't gotten many replies about that though.
It's not. It may have been when I started but I'm far past choosing a language at this stage.
I don't think that I'm going to be able to convert 14k lines of code + lwjgl + other libraries I'm using without rewriting a lot of stuff. Sorry.
The hell is scala anyways?
Last edited by Not Inferno; July 1st, 2013 at 10:46 PM.
I don't think that I'm going to be able to convert 14k lines of code + lwjgl + other libraries I'm using without rewriting a lot of stuff. Sorry.
The hell is scala anyways?
Whoo-Java compatible what's that-oosh.
You'd only convert your code but you wouldn't even have to, you can compile both Java and Scala sources through the Scala compiler. The only reason you would want to is for sanity of having everything in the same syntax.
Scala is a programming language with more features than Java that is capable of running on the JVM (with a few features that can't be implemented on the JVM inevitably are disabled).
It's not. It may have been when I started but I'm far past choosing a language at this stage.
Heh. See above and be master exploder'd.
And back on topic...
After quite a bit of debugging I've gotten the scripting engine running with basic functions.
Test Script:
Interpreter output:Code:(var boolean test_boolean false) (var boolean test_boolean2 true) (var int test_int 1) (var int test_int2 125) (var int test_int3 -10020) (script all dormant "test" (if test_boolean (begin (log "test boolean is true") ) (begin (log "test boolean is false") ) ) (if (== test_int2 125) (begin (log "equals") ) (begin (log "not equals") ) ) (log (<= 1 4)) )
And when I enter wake test into the console I get this in the log:Code:- (script all dormant "test" <4> <10> <12> ) -- Call:If ID#4 Src: (if <-1> <1> <3>) --- Call:Variable ID#-1 Src: test_boolean --- Call:Begin ID#1 Src: (begin <0>) ---- Call:Log ID#0 Src: (log <-1>) ----- Call:Constant ID#-1 Src: test boolean is true --- Call:Begin ID#3 Src: (begin <2>) ---- Call:Log ID#2 Src: (log <-1>) ----- Call:Constant ID#-1 Src: test boolean is false -- Call:If ID#10 Src: (if <5> <7> <9>) --- Call:Equals ID#5 Src: (== <-1> <-2>) ---- Call:Variable ID#-1 Src: test_int2 ---- Call:Constant ID#-2 Src: 125 --- Call:Begin ID#7 Src: (begin <6>) ---- Call:Log ID#6 Src: (log <-1>) ----- Call:Constant ID#-1 Src: equals --- Call:Begin ID#9 Src: (begin <8>) ---- Call:Log ID#8 Src: (log <-1>) ----- Call:Constant ID#-1 Src: not equals -- Call:Log ID#12 Src: (log <11>) --- Call:Lequal ID#11 Src: (<= <-1> <-2>) ---- Call:Constant ID#-1 Src: 1 ---- Call:Constant ID#-2 Src: 4
If you'll notice the interpreter output is quite informative nowCode:test boolean is false equals true
And if you look closely you might find some built in casting. Mmmmmm girllllll. Look at that casting.
Writing custom functions is pretty easy to do. Though writing functions that stop the scripting language is a bit complex. (stuff like sleep and begin). I learned a lot about interpreting code like this though so next time it'll be better![]()
In the end it's all functional so yay.
What kind of functions would you guys like to see. Stuff you wish halo had basically.
edit-
@Skyline:
Scala isn't any faster than java from what I've read. It's also not as widely used as java. I don't see any reason to switch unless I run into some major problem that I can't do with java (spoilers: I won't).
Last edited by Not Inferno; July 2nd, 2013 at 02:13 AM.
Since you are emulating halo script, maybe some details on how it works internally would be useful.
The hs runtime has its own "hs threads" (which are not actual system threads). Eg, a startup script would spawn its own hs_thread, a continuous script would run in its own hs_thread, the console has its own hs_thread, globals are initialized in their own hs_thread, etc.
Like system threads, each hs_thread has its own stack memory. Bit of trivia: Kirby was a jerk and made a heavily nested script for a CMT feature which exceeded the stack memory of an hs_thread, causing it to overflow into another hs_thread (and thus crashing). Were the community to have access to actual debug/tag builds of the runtime, there would be errors explaining this overflow. Instead, I had to debug this nonsense, which wasn't immediately obvious (and I wasn't involved with CMT's scripts). The stack memory contains stack frames (essentially an IP and a few other useful values) plus arguments to hs functions.
Anyway, for sleep they set a field to be 'current-game-time + sleep-time', and when the hs_runtime updates it checks that if the current game time to be sure if it can evaluate the hs_thread yet.
Also, 343i no longer uses the a LISP-esque syntax for halo script. Eg,
IDK if this was work that Bungie had initially started, or if it was something 343i sparked. Either way, they changed a lot of the underlying implementation of the script system (for the better AFAICT)
Scala isn't any faster than java from what I've read.
It is using the JVM should have made that clear as day.
It's also not as widely used as java.
Java was the most used language at some point for a year or two, forget the website with the statistics, though still not really a valid reason for justification. If you are building a multi-threaded database that runs on several servers, you wouldn't want to use C for that. If you are using lock-free algorithms, some problems occur such as the ABA problem that can be solved using a garbage collector that would otherwise be difficult in C. If I recall correctly C is the current most used language, but just because it is doesn't mean you should choose it for said purposes.
I don't see any reason to switch unless I run into some major problem that I can't do with java (spoilers: I won't).
Well I guess you can't miss something you never had.
It'll sync without any kind of scripting help. The entire engine is designed around multiplayer so unless you tell an object not to sync it will.
I'm just using lisp syntax. The way my scripts work (in code) is nothing like halo I assume. I just like the lisp syntax over lua. That's just a preference thing.
It would take a fuck load of work to overload my scripts haha. I'd actually like to see someone do it.
Scripts are executed post gameplay tick. It's on my list of things to multi-thread though.
As of right now I have these functions coded in:
log
if
sleep
<
>
<=
>=
==
begin
I need a lot more than that but I don't really know where to begin with adding stuff. :P
Last edited by Not Inferno; July 2nd, 2013 at 11:46 AM.
Added some more functions:
spawn <tag path> <script id> <x> <y> <z> returns void
actor <script id> returns actorID
invoke <actorID> <function to invoke> <opt param0> <opt param1> <opt param2> etc... returns void
Spawn let's you spawn a actor by giving it's tag, the scripting name you want it to have and an x y z coord.
Actor let's you get an actor by it's script name. It returns the actor id.
Invoke lets you invoke a function on an actor in the world. Invoke functions are relative to the type of actor you are invoking on. All actors have basic invoke functions like "location" "rotation" "push" and "destroy". Bipeds have invoke functions like "jump" and "animation". Weapons have invoke functions like "ammo" and "fire".
Code I tested with to make sure everything was working.
Code:(spawn "object/scenery/raichu.scenery" "Toasty" 0 0 0) (sleep 120) (invoke (actor "Toasty") location 0 0 -50) (sleep 60) (invoke (actor "Toasty") rotation 0 1.2 0) (sleep 60) (invoke (actor "Toasty") destroy) (log "Toasty was a bitch")
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks