Worklog for Baystep Productions

Workings of deranged programmer

Return to Worklogs

PsyScr3(Posted 2008-11-08)
Functions are now working. Single parameter only due to my laziness. Adding those in tomorrow. But you can now right your own functions with parameters and it all works. Since the functions variables and parameters are renamed to prevent memory leaking and doubling, theres no worry of having global variables with the same name as function parameters. Functions will have a neat new function of hierachy scope. Universal, Global, and Local are the scopes along with Public and Private. They effect the overwriting feature with built-in functions and defaults. Speed is still the same. Surprisingly saving each function as its own class didn't slow things down. 0ms execution for calling a custom function. So I hit the 1.6k lines-of-code mark and 38k characters. HURRAY! I'm gonna party once I hit 2k. I expect that to be just after class-object creation.


PsyScr3(Posted 2008-11-05)
InstrWord
ReplaceWord

Both work.

I added commenting. Why I didn't earlier I don't know. So comments are in C style. "//" is the key. I also added block commenting by using "comment" and "endcomment". But there was a change to the compiler. And that was, I added a PreCompile function that will take up cleaning out the source code on memory. It will pick-out the comments and blank lines as well as moving the function declerations to a new type class PSFunction. The PSFunction class will handle the parameters, returns, execution, and actually holding the codeing to be executed with the function. I chose to do it this way so that functions could be created at the bottom and still be usable in the top parts of the script that will be executed first. The interpretation is looking to be too slow for active runtime. Unless it's only being called once. But for contant loop, no promises. Thats why byte-code compiling is for! If it only takes 2ms to break down and compile a script I'm sure it should surfice for intital loading.


PsyScr3(Posted 2008-11-03)
Everyday updates now.

Select/Case/Default/EndSelect where added to the engine. Now work is being done on Functions.

So functions are gonna be a project in their own.

Function parameters are treated as variables and are there-for created variables that have localized names. IE:
Decleration: Function Test(inp$,inp2$)
Creates the variables: __Test_inp and __Test_inp2

They will also support default values, and all data types. The only problem I came across was using Instr to find and replace variables names/values. So I created 2 new functions from scratch InstrWord and ReplaceWord. They search the string for whole words and return/replace the matches. Examples:

ReplaceWord("Hello World","World","Blitz") would replace world with blitz. Nothing to amazing
ReplaceWord("Into Integers","Int","BANNANA") would replace nothing. Because there are no whole words named "Int". The function isn't case-sensitive either. I will be replacing the variable replacement algorithms with this new function. Which will remove the previous bug of variable.

The bug mixed up the variable names as in:
var weight# = 180.5
var moonWeight# = weight*10
print(moonWeight#)

print would then print "moon180.5" because there is already a variable that contains the word "weight". The new function only searches characters between symbols as to get the "whole word". Expect those functions to be posted here later.

Example of a working script. This script tests everything and works flawlessly in 3ms.
var name$ = ""
name = "Chris"
var age% = 19
var height% = 6
var weight# = 145.76
var hexID& = FFA016

var bottles% = 0
for bottles = 100 to 0
   print(bottles+" bottles of beer on the wall.")
next
repeat
   bottles+=1
   print("Added another bottle of beer to the wall, now we have "+bottles)
until bottles>=100
while bottles>0
   print(bottles+" bottles of beer on the wall.")
endwhile
if age<18
   print("You can't vote yet!")
elseif age<21
   print("At least you can vote!")
else
   print("You can drink now too!")
endif
select height
   case 4
      print("Legally a midget!")
   case 5
      print("Short but average")
   default
      print("Pretty tall!")
endselect

[/code]


More Updates - PsyScr3(Posted 2008-11-02)
So is ziggy giving me some competition? Lol. Just kidding, maybe he can join me. Unfortunatly this isn't really a small-scripting language. It's turning into a full fledge engine and language in it's own. Considering it can be interpreted, short-code compiled, and byte-code compiled with Assembly output and linking with other languages for stand-alone executables. Dare I say watch out Lua? I mean luas amazing, but doesn't it not have active class/object creation. With hierarchy style over-writing? It's like a mini-C+ within BlitzMax. But yeah, virtual/interpreted/compiled. Thats the idea here.

More statistics:
Source code size is over 1.6K lines, and over 26.7k characters. The source and engine is all from scratch, and referenced code-snipts where re-typed by hand, by me.

Helpful Hands:
If anybody has a better way to calculate string formulas fast and accurate I'm open to it. It needs to support all the data types. :( That means int, long, float, double, hex, and string. Don't worry about object. :)


Update - PsychoScript 3(Posted 2008-11-01)
Ok. Now I have all the loops working. for/next currently only accepts integers for the steps and all, unfortunatly its tempromental. If the incretments don't add up exact then the loop will get thrown into inf repeat.

Some statistics!

100 lines of script is interpreted and executed in 2.7251 milliseconds. Which is over 36000 lines of code per 1 second.

Expect more speed cause the engine will run in 3 stages.
First is interpretation and optional execution.
Second is interpretation and compiling to short-code (human readable).
Third is short-code to truely compiled (non-human readable).

Note: The engines short-code will be like x86 Assembler so expect it to be able to convert TO assembly and link as a stand-alone executable. Making this script language and actual language.


Update - PsychoScript 3(Posted 2008-10-31)
More work was done on the scripting. Completed parts...

Varialbes...
Accepted data types are integer, long-int, float, double, string, and hex. Will be adding byte, short, arrays, and object.

If/ElseIf/Else statements where also completed with working expressions. Loops include the keywords repeat/until/forever and while. Soon to come is For/Next.

The math system is working a bit crappy. It seems to only like to compute formulas with less then or equal to 1 parenthasis section. I also added the ability to use "-=/+=" for easy adding values to variables. As soon as those are cleaned up work will start on functions, and then... DUN DUN DUN! CLASSES AND OBJECTS. Along with hierarchy, over-writing, priority, global vs. local and yadadadada.


More updates(Posted 2008-10-29)
Um. So the work is slow. I know the scripting engine is gonna feature a event based system for linking into the game. Allowing hooking and unhooking to call-back functions. This will empower the user with the ultimate in modifications. I'm a bit weary cause this will allow virus and cheat creations on whim. But thats fun and I like it when people actually take the time to make the game theirs. The whole virus thing really struck my fancy though. Cause I can add that as a feature to the game. Sickness to the player. Not the virus you where probably thinking of but yeah, that works to. A virus would be a script containing the class to an object/item/weapon/etc and have a link from onUse or onEquip to the virus's object creation. The viruses object would immediatly call an infect method which would add a event hook to whatever it wanted. The event system would automaticly call the virus's supplied call-back and the damage is done. A cure would be a simple call of unhookEvent()

So right now I'm thinking it will get played out like this...
hookEvent(EVENT_ID%,OBJECT_REFERENCED,CALL_BACK_FUNCTION)

...and the same for unhookEvent()

Ahh this is gonna be hard. BUT FUN! Oh btw. This development on the scripting language is all gonna be bundled into a library for distrabution. PscychoScript3 (wip) Any interests in this please email. It's a BMX Module.

OH! AND ANY IDEAS/SUGGESTIONS/PARTNERSHIPS PLEASE EMAIL ME AT CHRISPIKUL510@...

Thanks!


Universal's the theme!(Posted 2008-10-17)
Internets down, and no money to pay the bill. So commendeering this here laptop I shall update you on my biggest project so far. THE BIGGEST. Ever.

I'm expecting months of coding, partnerships, hardware upgrading, software upgrading, the whole shabang. I'm going at this project a bit (a lot) differently then anything I've done before.

Controllers
Not input controllers but library controllers. A new technique I came up with on the fly and I hope it works well. This technique infuses BlitzMax with an OOP writing technique but writing the different segments of application control in their own indevidual Type classes. So the sound engine is one class, graphics another, input another, networking, scripting/configuration, logic/AI, and a new one I call CGame. A CGame type controlls the game itself and basicly contains everything that makes the coding "original". The reason for me coding this way is that in the event I switch to 3D, I just change out one source file. No coding to switch around or anything. Cause the Graphics controller is coded universally. So the type class "CGraphics" will have the same name and functions. So calling gfx.Render will be the same for Max2D, OpenGL, DirectX3D, etc. etc. Other hierarchy examples include update input, networking, actual game logic, changing scripting, you get the idea. I anticipate it might be SLIGHTLY harsher on the CPU being that the code control will constantly be jumping through different classes, but very minor. I wanted to use this system so that I can develop the game in 2D now and "easily" port to 3D when I obtain an awesome graphics engine (and DX10 card).

The Mash-up
So many ideas and library's and all have been filling my head for this project. So I'm gonna try and keep writing things down so I don't forget. First off, continuing with OOP, is my next idea of Entities. Not original I know, BUT just wait. Like 3D entity's of B3D in being that everything is an entity I will do for this project. Even if it's 2D. But I want to expand it for more UNIVERSAL application. As in the entity class is universal, the parent coding won't care what type of entity, what it is, what it's for, nothing. All it will know is that it's some sort of game object or useful in some way. The entity class it's self will decifer what IT is, what actions should be taken based on that, and control other things. It's control should include what to do with Input values, when to play sounds, physics, logics, etc.

This project is also going to use all my other librarys and uutilities. Including PsychoScript3 (in development, it's amazing), ResGUI, InterDb, MicroPatch (in development), PsychoNet2 (in development), and a couple others.

The Game
Finally to what this is all about. To bad I can't tell you (I could die). Haha. Kidding, but for now it's secret. It's WIP Name is "Imperealize". And it involves being a community, raising stats, customization at it's fullest and having nearly full control in the games development and progress. Yes, development. This will be restricted to online only, but hey, so is steam. I'm gonna need servers and hosting and web domains and all. But that's what work is for.

I'll keep you all posted as soon as I can.


ResGUI - Update(Posted 2008-09-18)
The module is coming along well. Three types have been created... TResourceHandler, TResource, and TDialog. And you only have to use the first one to create and control all the others.

100% of the MSDN declaired control types have been supported. Plus some extra lucky hidden ones (i.e. "msctls_updown32"). I'm adding custom-class support too. So
those lazy or hand-scripters who don't remember how to add a spinner (MSDN forgot to describe those...) they can just created the GUI element with the class MAXGUI_SPINNER. This way stuff that maxgui can do that editors don't can most likely be used anyways.

So far my example program to launch looks like this...
Global res:TResourceHandler = New TResourceHandler.Create("TempExample.brc")
res.BuildAll()
While True
   WaitEvent
Wend
End

And that code creates and automatically contols all gadgets.

Heres a look at the resource script to see what this module is parsing and handling...


Now I move onto cleaning some of it up, fixing the creation and handling of menus, status bar, and tool-bars (pretty important stuff). Later on is memory-management. The program shows up at around 3-4,000k on the task manager. So it's still none-invasive but some GC could be nice I'm sure.

Well thats all for tonight! Some 3 hours of work huh?

-------------------------------------------------
ANYONE INTERESTED IN THESE PROJECTS CAN EMAIL ME!


ResGUI(Posted 2008-09-16)
Oh jeese. This ones becoming quite the project. It started as a simple tool...

The simple tool allowed you to drag *.rc Resource script files onto it and it would compile it down to a new easier-to-program version I called *.brc ([B]litz [R]esour[c]e).

Then it moved on to a full-fledged module that allows you to easily read *.brc (or even interpret *.rc files) and automatically generate and handle MaxGUI elements based of the given information. Useful cause it means you can use a resource editor (like ResHack or even MSVC) to generate the script files in a WYSIWYG fasion and directly port them over to BMAX.

I currently have the interpreter and compiler finished now I'm working on the module TResourceHandler and TResource to load and generate the TGadget objects in a kind of "template" enviroment. I'm currently adding functions to compile the WinAPI style codes into MaxGUI style codes so I can continue with the first object... DIALOGS!

I've decided to branch it a bit more and enable it so that when you design (as a resource) a dialog, if it is named/id'd with "MAIN" it will be treated as the template for the programs main window. Since MSVC+ doesn't inherently create the main window template it seems, this motive was chosen instead. So now windows are dialogs and dialogs are windows! CHEERS!