Omnimaga

General Discussion => Technology and Development => Web Programming and Design => Topic started by: Eeems on April 30, 2010, 06:33:00 pm

Title: jBasic
Post by: Eeems on April 30, 2010, 06:33:00 pm
http://future_history.freehostia.com/jBasic/jBasic.html
I am working on making a JavaScript library to help people transition from TI-Basic to JavaScript. I have only made a text() command and a dispScrn() command. dispScrn() is used to create the screen area so all other commands work.
I'll work on a tutorial soon, well after I make a few more commands.
Title: Re: jBasic
Post by: DJ Omnimaga on April 30, 2010, 06:34:58 pm
nice will this be some new language that is parsed as javascript but has a syntax like TI-BASIC? It would be nice to be able to do web apps this way
Title: Re: jBasic
Post by: Eeems on April 30, 2010, 06:39:14 pm
no, its a JavaScript library, so kind of like added commands that are more familiar to TI-Basic users. It will also have it's own look and everything that will remind you of the TI-Screen.

EDIT: added a pixelOn() command, so now you have basic drawing capabilities :D
EDIT2: added a sprite() command for displaying images anywhere and at any size.
Title: Re: jBasic
Post by: Eeems on April 30, 2010, 07:12:57 pm

Tutorial

Code: [Select]
<html>
 <head>
  <title>
   Page Title
  </title>
  <script src="jBasic.js"></script>
  <script>
   function setup(){
    //Place code here.
   }
  </script>
 </head>
 <body onload="gScreen = document.getElementById('window');setup();">
  <div id="window">
  </div>
 </body>
</html>
Use this basic setup and place any JavaScript in the '//Place code here.' line. Add any content you want between the <body> tags

Commands

dispScrn(w,h,x,y)
creates the window that the content is displayed in.
w = width in pixels
h = height in pixels
x = x location from the left of the screen in pixels
y = y location from the top of the screen in pixels

text(x,y,size,text)
Writes text on the screen.
x = x location from the left of the screen in pixels.
y = y location from the top of the screen in pixels.
size = text size in pixels
text = text content, can include html code for more advanced purposes.

pixelOn(x,y,color,w,h)
creates a block on the screen.
x = x location from the left of the screen in pixels.
y = y location from the top of the screen in pixels.
color = color of the block, can be in hex or named.
w = width in pixels
h = height in pixels

sprite(x,y,w,h,src)
places an image on the screen.
x = x location from the left of the screen in pixels.
y = y location from the top of the screen in pixels.
w = width in pixels
h = height in pixels
src = the source of the image, can be a relative URL or a direct link.

jBasic.js can be found here:  http://future_history.freehostia.com/jBasic/jBasic.js
Title: Re: jBasic
Post by: DJ Omnimaga on April 30, 2010, 07:37:30 pm
Nice, seems like it could do some interesting stuff :)
Title: Re: jBasic
Post by: Eeems on April 30, 2010, 08:07:13 pm
Thanks :) I've put way too much time into figuring out the basic stuff x.x
I'll be adding more later, and I'll probably make an extended set for more functionality as well
Title: Re: jBasic
Post by: DJ Omnimaga on April 30, 2010, 08:46:23 pm
Cool :D
/me hopes Eeems didn't kill his calc projects including ADE, tho o.o
Title: Re: jBasic
Post by: Eeems on April 30, 2010, 10:00:33 pm
Well ADE kind of already died, but i haven't killed my mario physics engine yet. I'm just focusing on projects that get me marks at school right now.
Title: Re: jBasic
Post by: DJ Omnimaga on April 30, 2010, 10:08:30 pm
aw sorry to hear :/ why did you kill it btw? I hope you aren't slowly quitting calc stuff x.x
Title: Re: jBasic
Post by: Eeems on April 30, 2010, 10:25:02 pm
I killed it because i needed to get on to more projects so i can get my full credits in computers. I may come back to it later though.
No I'm still into programming calcs, but i dont have the time to do it much right now.
Title: Re: jBasic
Post by: DJ Omnimaga on April 30, 2010, 11:04:31 pm
Oooh ok phew, I was getting worried since most of your posts in the last month were non calc related. I hope when school is finished that you can do calc stuff again (and get your calc back)
Title: Re: jBasic
Post by: Eeems on May 01, 2010, 12:52:38 am
Don't worry, I'll code for calcs for a very long time. Its what got me started on programming after all :p

I just added a line() command and a clrGraph() command as well.

line(Ax,Ay,Bx,By,w,color)
Draws a line on the screen.
Ax = the initial x location in pixels
Ay = the initial y location in pixels
Bx = the second x location in pixels
By = the second y location in pixels
w = the width of each line piece on the line
color = the color of the line. Can be hex or color name.
Title: Re: jBasic
Post by: DJ Omnimaga on May 01, 2010, 01:16:25 am
nice :D
Title: Re: jBasic
Post by: Galandros on May 01, 2010, 03:25:44 am
Interesting. For now the code will look much like JavaScript but later when you added most stuff, it will be similar to BASIC, I think.
Don't forget to bring the Math.functions to a normal function.

I will keep updated about this.
Title: Re: jBasic
Post by: DJ Omnimaga on May 01, 2010, 11:05:54 am
I wonder, in Javascript, are there any possibility of interaction from the user by pressing keys? Otherwise I guess a point and click game could be awesome too when it has more commands
Title: Re: jBasic
Post by: Eeems on May 01, 2010, 11:35:09 am
Actually i intend to add getkey() and randInt() and maybe more later. Im currently trying to figure out how to let you clear specific areas of the screen and i just might end up making each thing you draw have id's so you can do things with them without clearing the whole screen each time. I'll try my best to make it like TI-Basic, but there are going to be differences due to the object orietatedness (sp?) of JavaScript.
Hopefully it isnt too hard to pick up though.
I may make a XUL app to help you with it too. Who knows, this could be big :p
Title: Re: jBasic
Post by: DJ Omnimaga on May 01, 2010, 11:45:04 am
an editor would be nice, so we dont have to use notepad, save, test, etc.

But yeah it's some nice stuff you have already. The cool thing is that those games can be played in a browser. I could easily embeed some into posts I think.
Title: Re: jBasic
Post by: Eeems on May 01, 2010, 12:20:51 pm
Yeah that was my thought :)
I'd also give you menu based addition of code, so it will give you a color selector and you enter all the other stuff and it would give you a preview of the element, then it would insert the code at the pointer in the text area. I would also give you the option of running the code withought saving. And when i get good enough maybe a visual designer...who knows :p
I have big plans for it right now :p
Title: Re: jBasic
Post by: DJ Omnimaga on May 01, 2010, 12:24:04 pm
Nice :D

I also wonder if JS execution heavily depends of computer speed... on newer computers, would it be possible to setup timers to make sure code wont run too fast?
Title: Re: jBasic
Post by: Eeems on May 01, 2010, 01:05:57 pm
Well speed can be a problem, but yes you can set up timers :p setTimout("code",milliseconds) can be used to run something once setInterval("code",milliseconds) can be used to have it run every however milliseconds.

I have just made a randomInt() command. Click on the screen area in the demo to see it in action

randomInt(a,b);
Returns a random integer between two numbers.
a = the lower boundary
b = the upper boundary
Title: Re: jBasic
Post by: DJ Omnimaga on May 01, 2010, 04:15:29 pm
ook nice to hear ^^

About speed my guess is that the timer would just need to be set at lower framerate

Btw I hope you are planning for cross browser compatibility?
Title: Re: jBasic
Post by: Eeems on May 01, 2010, 04:35:32 pm
actually, it measures its time based on the computers clock, so it will only have slowdown with the code running, but that probably shouldn't become a problem except on really slow computers.

actually it should work on all browsers that support JavaScript right now. I may run into problems with allowing people to make circles, but that will only be with browsers that don't support CSS5 (only FF and Webkit browsers support it right now) but I haven't tried to make them yet. Right now I'm focusing on figuring out how I'm going to let people delete specific objects on the screen but in a way that makes it seem like it is TI-Basic...
Title: Re: jBasic
Post by: DJ Omnimaga on May 01, 2010, 04:46:34 pm
Aaaah I see. Good luck!
Title: Re: jBasic
Post by: Eeems on May 01, 2010, 05:02:38 pm
thanks!

ok, I've added a way to delete objects, currently it will return the pointer to the object that you draw, so all you have to do is:
Code: [Select]
objectPointer = Line(0,0,100,200,10,"black");
pixelOff(objectPointer);
to remember the object and to delete it :) simple as that :)
I've updated the demo with the commands.
New commands:

pixelOff(pointer);
deletes an object on the screen
pointer = a variable pointing to the object. You can save variables to objects by adding a
Code: [Select]
objectPointerName =before each object you draw that you want to be able to delete.

screenOff();
Makes the screen and all its contents invisible.

screenOn();
Makes the screen and all it's contents visible.

EDIT: just aded the circle command, so this only works on FF, and webkit browsers, but as soon as CSS5 becomes standard, this will still work :D

circle(x,y,radius,color);
draws a circle on the screen.
x = the x location of the top left corner of the circle in pixels
y =  the y location of the top left corner of the circle in pixels
radius = the radius of the circle in pixels (half the width)
color = the color of the circle. Can be hex or colorname.
Title: Re: jBasic
Post by: DJ Omnimaga on May 01, 2010, 05:22:56 pm
i need to start messing around with this when I get some time. I assume there'll also be the control commands, right? (if/else/endif/while/repeat/etc)
Title: Re: jBasic
Post by: Eeems on May 01, 2010, 05:34:26 pm
well if/else/endif/while are all the built in javascript ones. This is because I have no idea how to make them from scratch x.x
I'm going to add in keycontrol commands soon.

New Commands:
object(type,css,html,x,y);
creates an object on the screen, good for prebuilt characters and such.

type = the tag name. Must be a string. eg: 'div' or 'span'.
css = the css of the object. Note that position is changed to absolute and that top/left are changed to y/x respectively.
html = the innerHTML of the object, must be a string.
x = the x location of the top left corner in pixels
y = the y location of the top left corner in pixels

getkey();
returns the most recent key to be pressed is returned in string form. the command is not completed yet.
Title: Re: jBasic
Post by: DJ Omnimaga on May 01, 2010, 05:42:04 pm
i am confused by what you mean by character, do you mean char sprites or text?
Title: Re: jBasic
Post by: Eeems on May 01, 2010, 06:34:38 pm
I mean like animated characters and such, things that you built using HTML and you want to just include that.

also, getKey() doesn't work...but I'm working on it.
Title: Re: jBasic
Post by: DJ Omnimaga on May 01, 2010, 06:58:30 pm
ooh ok I see but what's the link between HTML and animated chars? Do you mean for example displaying an animated gif with <img>?
Title: Re: jBasic
Post by: Eeems on May 01, 2010, 07:01:27 pm
well that and if you have a pre-designed character built with html (using tables and such) then you can use this to add them.
ok, GetKey() and getKeyCode() works now :D they require the addition of
Code: [Select]
<form name="keyform">
  <input id="getkey" style="visibility:hidden;" readonly="readonly" type="text" value=""></input>
  <input id="getkeycode" style="visibility:hidden;" readonly="readonly" type="text" value=""></input>
</form>
between the <body> tags

try pressing the arrow keys in the demo :P
Title: Re: jBasic
Post by: DJ Omnimaga on May 01, 2010, 07:37:19 pm
aaaah ok ^^, I'll try later I guess. I hope you write some tutorials that comes with this later ^^
Title: Re: jBasic
Post by: Eeems on May 01, 2010, 11:07:52 pm
Yeah I intend to write some tutorials :) hopefully they will help :)

Now to figure out how to get multiple keypresses.
Title: Re: jBasic
Post by: Eeems on May 04, 2010, 04:27:49 pm
ok, I've been making some progress on jBasic, so far I have just added some support for getting and setting the x and y position of objects, so this will make it easier to move stuff on the screen. It's hard to make an object orientated language work like TI-Basic, so there will be some differences, mainly, it's still object orientated. I'll probably be adding more object manipulators, like something that checks if it is still within the screen, etc.
For the Key's I have text identifier support for the arrow keys, shift, ctrl, alt, pause/break and enter, any more I should make easily accessible? Keep in mind I still have the Key-codes so you can check for all the keys :P Multiple key-presses are still not supported, but I will be adding them possibly soon.

New Template:
Code: [Select]
<html>
 <head>
  <title>
   Title
  </title>
  <script type="text/javascript" src="jBasic.js"></script>
  <script type="text/javascript">
   function setup(){
    //put code here
   }
  </script>
 </head>
 <body onload="gScreen = document.getElementById('window');setup();" >
  <div id="window" >
  </div>
  <form name="keyform">
   <input id="getkey" style="visibility:hidden;" readonly="readonly" type="text" value=""></input>
   <input id="getkeycode" style="visibility:hidden;" readonly="readonly" type="text" value=""></input>
  </form>
 </body>
</html>
Title: Re: jBasic
Post by: DJ Omnimaga on May 04, 2010, 04:43:22 pm
is the language mostly meant for game development? If so, I guess not too many keys might be needed. Just some easy to reach ones with fingers for general 2D games
Title: Re: jBasic
Post by: Galandros on May 04, 2010, 04:50:32 pm
I wonder, in Javascript, are there any possibility of interaction from the user by pressing keys? Otherwise I guess a point and click game could be awesome too when it has more commands
Yes, gladly you can get mouse and keyboard input. I think it is not very cross-browser so it requires some code for each browser.
Title: Re: jBasic
Post by: Eeems on May 04, 2010, 04:50:41 pm
yes, this will be meant for game development, so which key's would you want?
Title: Re: jBasic
Post by: DJ Omnimaga on May 04, 2010, 04:57:07 pm
Shift, Z, X and C might be good. A lot of PC games use those for platformers, especially Game Maker games. Else, some games use SPACEBAR for jumping.
Title: Re: jBasic
Post by: Eeems on May 04, 2010, 05:22:44 pm
yeah..well I got multiple keypresses working, but now I can't support the way I had it before, so:
http://www.webonweboff.com/tips/js/event_key_codes.aspx keycodes are here, and the new format for getKey() is:

getKey(e)
returns true if the key is pressed and false if it is not

e =  the keycode you are checking for
Title: Re: jBasic
Post by: DJ Omnimaga on May 04, 2010, 05:25:25 pm
seems like I might go with shift and the nearby keys then. Idk if I feel like using pageup/down or the like since both my hands would be on top of each others while playing x.x

Btw I like how getkey looks like axe
Title: Re: jBasic
Post by: Eeems on May 04, 2010, 11:18:26 pm
Thanks :) yeah, its the best way to use it :p
I'll try to add string based testing later for the more used keys, but its not a priorety.
Title: Re: jBasic
Post by: Eeems on May 05, 2010, 08:19:44 pm
ok, I've added a keySim() command for all of those who want to give the users out there without a proper keyboard a way of using it :P

keySim(key);
simulates a key-press. key is down for 100 milliseconds, then the key is "released".

key = the key-code of the key pressed

EDIT: added objLocWidth() objLocHeight() and objCheck(). they are untested though, so I don't know if they work.

objLocHeight(obj);
returns the y location of the bottom of the object
obj = the pointer to the object

objLocWidth(obj);
returns the x location of the right side of the object
obj = the pointer to the object

objCheck(obj);
checks to see if the object is within the window
obj = the pointer to the obj
Title: Re: jBasic
Post by: Galandros on May 06, 2010, 04:42:33 pm
Keys for JavaScript:
Shift, Ctrl, Space,
arrows keys, W,A,S,D,
Q,W,E,R,A,S,D,F,Z,X,C,V

This is my choice having in count usual games and emulators.
Title: Re: jBasic
Post by: ztrumpet on May 06, 2010, 04:49:35 pm
This is a neat project Eeems!  ;D
Good luck with this! :D
Title: Re: jBasic
Post by: Eeems on May 06, 2010, 05:11:58 pm
Thanks!
I'll be making some more progress later on today as i have time to work on it.
Title: Re: jBasic
Post by: DJ Omnimaga on May 06, 2010, 07:48:41 pm
keep up the good work!
Title: Re: jBasic
Post by: Eeems on May 06, 2010, 07:56:37 pm
thanks!
I just added an easter egg btw for all those who want to see it ;)
Title: Re: jBasic
Post by: DJ Omnimaga on May 06, 2010, 10:05:13 pm
yeah I saw it was pretty great. People should check out
Title: Re: jBasic
Post by: Eeems on May 07, 2010, 04:28:21 pm
I updated the demo to flow smoother, and I also added a command, collision().

collision(obj,obj2,a);
returns true if obj and obj2 are overlapping.

obj =  pointer to the first object.
obj2 = pointer to the second object.
a = area around obj2 to include.
Title: Re: jBasic
Post by: DJ Omnimaga on May 07, 2010, 05:08:58 pm
nice to see collision detection. However, when you have about 15-20 objects, does it measn you need to check for each objects one by one? I wonder if that would be kinda slow
Title: Re: jBasic
Post by: Eeems on May 07, 2010, 07:39:49 pm
well, it's not working quite yet, but it's almost done.
yes, with this command it will be, but it wont be as slow as on calc, in fact 15-20 shouldn't be that bad of a slowdown.
Title: Re: jBasic
Post by: DJ Omnimaga on May 07, 2010, 07:41:33 pm
aaah nice ^^

so what kind of games would be possible for this btw? And we can use whatever image we want, right? Could we even use animated gifs?
Title: Re: jBasic
Post by: Eeems on May 07, 2010, 08:20:34 pm
I'm currently working on collision() with builderboy, so it should work very soon. collision() is going to be square collision detection though, so you will have to make your own for circles.

any game would be possible, as long as you have the patience to code it, and the computer has the speed to run it.
yes you can use whatever image you want, as long as the browser supports it.

also collision() is changed to this: collision(obj,obj2,x,y)
x is for the x extension on the check, and y for the y one.

EDIT: fixed it! yay!
Title: Re: jBasic
Post by: DJ Omnimaga on May 08, 2010, 12:10:15 am
By any games, does this includes games with highscores/save data?
Title: Re: jBasic
Post by: Eeems on May 08, 2010, 12:20:50 am
Yes actually, I'll have to make some routines, but making highscores shouldn't be to hard. You just save/recall from a text file, or if you want to store lots of data in one file, an xml file will do the trick. I'll have to do some looking into how to parse xml with javascript due to the fact that i've only done it with php.

Hmm, any other good ideas? I want to be able to stuff as much as I can into this :p
Title: Re: jBasic
Post by: DJ Omnimaga on May 08, 2010, 12:24:07 am
Aaah ok. Wouldn't highscores be very easy to hack that way, tho? Again, the user could code some sort of encryption himself so if the user modify a highscore the wrong way, they're deleted
Title: Re: jBasic
Post by: Eeems on May 08, 2010, 12:26:31 am
Hmm, true...well I'll have to figure a good way to encrypt it and such.

If anybody has a command idea let me know, I'm open to suggestions.
Title: Re: jBasic
Post by: DJ Omnimaga on May 08, 2010, 12:30:10 am
lists and strings would be cool, and for the later, a Sub() command. Those would come handy for data storage, text convos and tilemapping.
Title: Re: jBasic
Post by: Eeems on May 08, 2010, 11:53:43 am
Actually they already exsist in javascript. To make a string you just do: var varname = "string";  they have a few more powerful and different versions of sub as well. How you use them is varname.command(); I'll include them in the tutorial when I make it.
To make an array you can do:
Code: [Select]
1: var myCars=new Array();
myCars[0]="Saab";
myCars[1]="Volvo";
myCars[2]="BMW";

2:
var myCars=new Array("Saab","Volvo","BMW");

 3:
var myCars=["Saab","Volvo","BMW"];
and to call from an array you can do this:
Code: [Select]
myCars[#]; and do whatever you want with it. Arrays can hold any data type, even another array! This will make multidimensional arrays :)
Title: Re: jBasic
Post by: DJ Omnimaga on May 08, 2010, 12:21:09 pm
Aaaah ok I see. It would be nice to have the command integrated in a TI-BASIC-like syntax in your stuff
Title: Re: jBasic
Post by: Eeems on May 08, 2010, 03:28:22 pm
Thars true, although i feel like im reinventing the wheel, for tge arrays, its pretty much TI-Basic syntax, but I guess I'll make a command for sub()
Title: Re: jBasic
Post by: DJ Omnimaga on May 08, 2010, 11:07:45 pm
Idk I just had a bad experience with arrays in Js before, now that I remembered the syntax, it seemed too confusing for me and I could never get anything to work. :/

Sub() would be enough for me, though, because this is what I used in VB for tilemapping :P
Title: Re: jBasic
Post by: Eeems on May 09, 2010, 01:57:44 am
Yeah arrays are a little annoying at first. I usually forget to define then before i start assining things to them.
Ill work on sub() because it isnt thay hard to make.

I am working on a small physics demo to show off how easy it is to make things with jBasic.
Title: Re: jBasic
Post by: DJ Omnimaga on May 09, 2010, 04:23:39 am
Cool to hear, can't wait for the demo
Title: Re: jBasic
Post by: Eeems on May 09, 2010, 08:01:04 pm
http://tinyurl.com/jBasicPhysics
take a look :P
also, it's not quite done, but there are some physics :P and they are bouncy!
Title: Re: jBasic
Post by: Builderboy on May 09, 2010, 08:12:12 pm
Its not working for me :( The url just turns into about:blank, and nothing loads.  Im in chrome btw, although it was working earlier when we were testing things.
Title: Re: jBasic
Post by: Eeems on May 09, 2010, 08:15:42 pm
try this: http://future_history.freehostia.com/jBasic/jBasicPhysics.html
Title: Re: jBasic
Post by: meishe91 on May 09, 2010, 08:17:28 pm
Ya, same here. Tried it on Firefox, IE, Safari, and Chrome and got nothing. :(

Oh ok, that one worked.
Title: Re: jBasic
Post by: Eeems on May 09, 2010, 08:18:01 pm
same...stupid tinyurl...
Title: Re: jBasic
Post by: meishe91 on May 09, 2010, 08:24:56 pm
Ya, but the direct link works. That is pretty cool only glitch I found was that if you hold down right when on the ground the boxes will continue outside the box and will just keep going.

Chrome: Runs to fast.
Firefox/IE: Runs at a speed that seems like the intentional speed.
Safari: Runs in the middle of the two speeds.

Great job though :)
Title: Re: jBasic
Post by: Eeems on May 09, 2010, 08:38:37 pm
yeah it should be fixed now, I've been working one that...
I made it on FF so that's why it works right, and it shouldn't run any faster on chrome/safari, because it's timed...it only runs the movement every 1ms...wait....that must be because they are a little faster at parsing JavaScript...

EDIT: just fixed some problems, check it out.
Title: Re: jBasic
Post by: meishe91 on May 09, 2010, 11:29:53 pm
Ah ok. Ya, it seems to still run fast in those to and still doesn't work in IE for what ever reason ???

But ya, the going right issue seems to be directly fixed though it is still possible to get them out while jumping (I think, its harder to recreate). Also, it went through the floor once too though I don't know how that happened. Um, last thing I noticed is that when you hold right you will come to a stop but holding left will still make it do "jumps."

Title: Re: jBasic
Post by: DJ Omnimaga on May 10, 2010, 12:00:23 am
wow nice!

Later I'll give this a try on my old computer just to see how it loads :)
Title: Re: jBasic
Post by: Eeems on May 10, 2010, 02:09:35 am
Yeah i havent quite figured out all the kinks, what errors does IE give?
DJ: let me know how fast it runs, I might decide to try and add more objects if it runs fast :p
Title: Re: jBasic
Post by: meishe91 on May 10, 2010, 03:00:42 am
Well for me it will show the boxes dropping at the beginning but then it isn't recognizing any key presses so you can't move the boxes. also it doesn't seem to be loading the right and bottom of the box (like the edge).
Title: Re: jBasic
Post by: Eeems on May 10, 2010, 09:24:37 am
Hmm, strange...I'll have to look into it. Does it report any javascript errors? (bottom left corner open it if it does and let me know).
Title: Re: jBasic
Post by: Stephan on May 10, 2010, 12:10:38 pm
I never liked JBasic, too tough to use. Plenty of other langauges.
Title: Re: jBasic
Post by: DJ Omnimaga on May 10, 2010, 01:08:56 pm
You might want to be careful to when you reply to people projects, though. I think you are thinking of another jBasic project somewhere else Stephan. Also I think what Eeems did is quite good because it allows people to make some JS stuff easier. I gave you a thumbs down for that comment.
Title: Re: jBasic
Post by: Eeems on May 10, 2010, 07:44:08 pm
I'm making some changes to the Physics demo, now it will give you a prompt to start the demo and to set the gravity/friction/bounce friction :) I'll upload it in a little bit.

EDIT: uploaded! I haven't finished the objects amount yet, but it will be fun to play with :P it will randomly place them as well as make them random sizes, and if you add more it will keep the ones you have already :P

I also found out why it doesn't like IE, for some reason it doesn't like what I do for multiple kepresses, I'll do some work and figure out how to fix it.
/me grumbles at IE's lack of ability to follow the standard
Title: Re: jBasic
Post by: ztrumpet on May 10, 2010, 09:30:51 pm
This is looking great!  Nice job Eeems! ;D
Title: Re: jBasic
Post by: Eeems on May 10, 2010, 09:51:05 pm
thanks! ok, big update, you can add objects now! it can handle around 300 fine on my computer (slight slowdown) and I've had 5000 before :P but it was about a frame a second x.x maybe less.
I've added a command randomColor()

randomColor(format);
returns a random color
format = format of the returned number. 'hex' or 'rgb'

EDIT: You can delete now! yay if you ever get 10,000 objects on the screen now (I did that it was fun :P) you can get rid of them all without waiting for a reload! (which is actually faster for that many x.x). I might add a colour scramble button tomorrow....
Title: Re: jBasic
Post by: Geekboy1011 on May 10, 2010, 11:09:21 pm
@ eeems wow awsome and what did you need >9000 objects for XD

@ stephan yeah please be sure your not confusing what you are talking about so far i think this is a great project . so i had to vote you down as well
Title: Re: jBasic
Post by: DJ Omnimaga on May 10, 2010, 11:11:47 pm
lulz nice stuff. However, for most values I typed the boxes would go off the screen and keypresses would quit responding :(

Opera btw. Also I get about 3 fps in that browser with 10000 boxes, 2 fps and sometimes 3 with 100000
Title: Re: jBasic
Post by: Eeems on May 10, 2010, 11:16:40 pm
Lol, i was just testing the slowdown :p
Have you encountered any random bugs? Other then the random moving out of bounds one (no idea why it does that...)
Dj: thanks! Hmm, well what values were you putting in? Also, dont put gravity to 1 or friction to 0, and try to keep gravity below 7. Also, of course it would be that slow x.x thats quite a lot of objects x.x i dont expect to have more then 100 in any game i make with this (I'll first have to make object collisions x.x).
Title: Re: jBasic
Post by: DJ Omnimaga on May 10, 2010, 11:33:07 pm
No other bugs I think, so far. And lol with 10000 I just wanted to see. I personally will never use more than 200 I think, and even then, it might just be a bit above 100.

As for values, I had 2 and 3 for gravity the last two times, same for friction
Title: Re: jBasic
Post by: Eeems on May 10, 2010, 11:37:14 pm
Ah ok lol
Well, if friction is the same as gravity, no movement will occur, and if friction is more then gravity, then wierd stuff happens x.x I'll have to add some checks later.
Title: Re: jBasic
Post by: meishe91 on May 10, 2010, 11:56:23 pm
Well the going out of bounds thing seems to be fixed now :) Well that is until you mess with the friction and make it above the gravity, in which case you sink into the floor lol. Um, other bugs, lets see...if you delete either the gravity or friction value while in the air it will disable the ability to jump, once values are entered, and you will be hovering in the air. Oh, and the only other thing I see is that sometimes when you land you are constantly jittering. Sometimes you're at rest but not always. Great progress though :)
Title: Re: jBasic
Post by: Eeems on May 11, 2010, 01:23:27 am
Yeah the friction is understandable, and the jittering is wierd, but i've expirienced it.
(btw, you dont jump, its apply gravity elsewhere ;) ) yeah, its because it grabs the value from the text area every 10 checks, so thats why it stops.
Title: Re: jBasic
Post by: meishe91 on May 11, 2010, 02:25:37 am
Oh ok. And wouldn't it be more like taking away gravity from everywhere? It just looked like jumping to me haha. And ok, gotcha.
Title: Re: jBasic
Post by: ztrumpet on May 11, 2010, 04:21:44 pm
Sorry to sound like a noob, but where can I try this?  Thanks! :)
Title: Re: jBasic
Post by: Eeems on May 11, 2010, 04:39:51 pm
just type in http://tinyurl.com/jBasic and it will be there :)
Title: Re: jBasic
Post by: DJ Omnimaga on May 11, 2010, 04:41:00 pm
http://future_history.freehostia.com/jBasic/jBasicPhysics.html

I think the tinyurl failed for some people
Title: Re: jBasic
Post by: Eeems on May 11, 2010, 04:57:59 pm
that was the other tinyurl, it just lead to a blank page for some reason x.x this one works though.
Title: Re: jBasic
Post by: DJ Omnimaga on May 11, 2010, 05:14:18 pm
Oooh ok I see
Title: Re: jBasic
Post by: Eeems on May 11, 2010, 07:36:12 pm
I just uploaded a new version. When you turn off/on the screen it will also halt/start the physics engine, so you can "save" what is happening and not have to close the tab if it is using too much ram.
Title: Re: jBasic
Post by: DJ Omnimaga on May 11, 2010, 07:37:59 pm
Aaaah nice to hear :D
Title: Re: jBasic
Post by: ztrumpet on May 11, 2010, 10:16:36 pm
Thanks!  I can't wait to try it! :)
Title: Re: jBasic
Post by: Stephan on May 12, 2010, 08:21:33 am
Sorry about that DJ. Yes I was thinking of a totally different project not related to here. I was thinking of Visual J++, which I did not like. I don't know how I got the two confused. Project recognition is NOT my forte. XD I am a complete moron and I feel like an ass for saying that. Sorry Eeems, I did check it out a little bit, it actually is very good. Again, I mixed up jBasic and Visual J++, and thats why I said that. Sorry. :(
Title: Re: jBasic
Post by: Eeems on May 12, 2010, 09:22:19 am
Its ok stephan, just try and read the first post first before you assume :)
Title: Re: jBasic
Post by: Stephan on May 12, 2010, 09:54:02 am
I did, I just didn't follow because I mixed the two things up. My bad :D.
Title: Re: jBasic
Post by: Galandros on May 12, 2010, 01:03:19 pm
I think I found a bug:
Some objects fall out of the screen with gravity 4, friction 2 and 100 objects after playing a bit.
I can't repeat but first I tried a massive number of objects, stopped the script in Firefox changed the settings and after playing a bit some objects exit start to exit the screen.
Title: Re: jBasic
Post by: DJ Omnimaga on May 12, 2010, 01:36:44 pm
Aaah ok I see, yeah it's good to read the first post carefully to make sure to know what's the topic about, espeically when it's large, otherwise there can be misinterpreting x.x
Title: Re: jBasic
Post by: Eeems on May 12, 2010, 07:18:05 pm
the bug would be due to friction, it's a bug I haven't figured out how to solve... I'll probably have to add a small check to each movement part of the code to fix it.
does anybody have some good object collision detection pseudo code? I kind of have no idea where to start x.x

EDIT: oh yeah, I've been working on adding in some built in debug console stuff so far you can set it up, send variable changes to it, send a normal message to it, and send errors to it. keep in mind though, you have to set up your own error traps :P
I also fixed the randomly deleting one more object then necessary bug. I also might be revamping the screen creation so you don't have to have the tag's already in the HTML and it will build it for you :P.
Title: Re: jBasic
Post by: Eeems on May 13, 2010, 12:44:21 pm
I've taken out the ability to edit friction, because it really messes up the collision detection, instead now just use gravity to effect the speed...
also I'm adding in checks to help with gravity change.
Title: Re: jBasic
Post by: DJ Omnimaga on May 13, 2010, 04:31:15 pm
aaah ok, I'll check later
Title: Re: jBasic
Post by: Eeems on May 13, 2010, 05:41:01 pm
ok, now you can not make your gravity smaller then 2 and the debugger on the bottom is fully functional btw, it will spit out errors if you get them...which you shouldn't I've made a lot of checks.
I'm going to make a check to make sure that the debugger doesn't get too large, because it slows down if it does. how lines should it max out at?
Title: Re: jBasic
Post by: Builderboy on May 13, 2010, 08:54:48 pm
Hmm how are you doing the friction?  Maybe i can see why weird things are happening
Title: Re: jBasic
Post by: Eeems on May 13, 2010, 09:03:45 pm
Take a look at the source its commented enough.
Title: Re: jBasic
Post by: Builderboy on May 13, 2010, 09:07:31 pm
Urm, where can i find that?  I can only find the links to the webpage.
Title: Re: jBasic
Post by: bwang on May 13, 2010, 09:10:13 pm
Look at the page source in your browser (View > Page Source in Firefox).
Title: Re: jBasic
Post by: Eeems on May 14, 2010, 04:39:29 pm
ok, I've updated some of the commands, and I think that my fps counter works...tell me what you think :)
Title: Re: jBasic
Post by: DJ Omnimaga on May 14, 2010, 05:42:16 pm
it works but not consistently. SOmetimes it will stop working completly, then suddently it will start working again. I had many times where it was 0 fps
Title: Re: jBasic
Post by: Eeems on May 14, 2010, 06:27:01 pm
hmm, strange... I haven't experienced this yet. It sounds like the browser is lagging a little bit, how many objects and what's the gravity set at?
Title: Re: jBasic
Post by: DJ Omnimaga on May 14, 2010, 07:30:17 pm
1 object and gravity was 3 (tried with 4 too)
Title: Re: jBasic
Post by: Eeems on May 14, 2010, 07:42:45 pm
Hmm, how long did it stop for?
Title: Re: jBasic
Post by: DJ Omnimaga on May 14, 2010, 08:58:25 pm
about 2 seconds I think
Title: Re: jBasic
Post by: Eeems on May 18, 2010, 04:55:59 pm
That seems like your browser is trying to catch up with JavaScript execution, mine sometimes does this for about half a second.
I just uploaded a new version with object collision detection, which you can turn off or on, but it drastically slows down the framerate with it on.
Title: Re: jBasic
Post by: DJ Omnimaga on May 18, 2010, 05:23:16 pm
aaah I see, maybe that's why. Weird, though, considering I'm on a quad core computer with 8 GB of RAM :P
Title: Re: jBasic
Post by: Eeems on May 18, 2010, 06:29:49 pm
Yeah, well it doesnt Mean it wont pause, i dont have anything that powerful, but i know my ram and cpu arent fully loaded down at all when it happens
Title: Re: jBasic
Post by: Builderboy on May 18, 2010, 11:32:32 pm
Hey DJ, does it happen on other browsers?  Maybe its Opera :O
Title: Re: jBasic
Post by: DJ Omnimaga on May 18, 2010, 11:35:50 pm
I'm not sure, haven't tried yet. That said it would be good to make sure it's cross-browser compatible, else it might not be useable by many people D:
Title: Re: jBasic
Post by: Builderboy on May 18, 2010, 11:38:08 pm
Mmm thats true, although it could see if its a computer problem, a browser problem, or a code problem.  I dont see any jump on my side though, using Chrome ^^
Title: Re: jBasic
Post by: DJ Omnimaga on May 18, 2010, 11:43:47 pm
well just tried in Firefox and same problem
Title: Re: jBasic
Post by: Builderboy on May 18, 2010, 11:50:37 pm
Interesting, somehow your super computer is having the opposite effect on the applet ;D Silly windows. 
Title: Re: jBasic
Post by: DJ Omnimaga on May 18, 2010, 11:58:03 pm
it might be Windows. I know Opera had issues with WIndows 7 64 bit.
Title: Re: jBasic
Post by: meishe91 on May 18, 2010, 11:59:55 pm
Hey, just checked out the new update.

Things I noticed (only skimmed what you guys said so if I repeat and such sorry):
-The little delay thing that, I believe, you guys discussed earlier.
-When landing objects on others they won't land properly. Always at a jitter.
-Some how managed to get two blocks to go though one another.
-When you have multiple objects sometimes they don't all come to rest, at constant jitter.
-Not sure how, but with multiple objects and kinda just moving them around I not only got a couple to go through one another, and stay there (like small box then big box behind it), but they went out of bounds to.

Great progress though, I really like it :)

Oh ya, I'm using Chrome.
Title: Re: jBasic
Post by: Eeems on May 19, 2010, 12:25:12 am
Yeah ive had all the same problems. Im still unsure how to solve them, but im working on them.
Title: Re: jBasic
Post by: meishe91 on May 19, 2010, 12:45:49 am
Ah ok. Well good luck.
Title: Re: jBasic
Post by: Eeems on May 25, 2010, 07:16:54 pm
ok, I'm unsure how to solve the problems with the object collision...but I have changed up how you make the screen, now it will draw it for you! also I have made a project page for jBasic on my site here is a link (http://future_history.freehostia.com/jBasic).
I will now start writing a tutorial :D hopefully some of you will pick it up and maybe program one or two things with it :)
Title: Re: jBasic
Post by: DJ Omnimaga on May 25, 2010, 07:54:12 pm
If you want I could give you some diskspace on this webspace so you can host the tutorials and the page, because I can't load your URL atm (due to crappy Freehostia). All I get is a blank page
Title: Re: jBasic
Post by: Eeems on May 25, 2010, 07:55:12 pm
hmm, strange...well the tutorial is here: http://future_history.freehostia.com/jBasic/tutorial.html
and it works for me...and the other link works for me too... strange...
Title: Re: jBasic
Post by: ztrumpet on May 25, 2010, 07:55:47 pm
It came in for me.  Wow, Eeems. your site looks really nice! ;D
Title: Re: jBasic
Post by: Eeems on May 25, 2010, 07:56:49 pm
thanks :D
Title: Re: jBasic
Post by: DJ Omnimaga on May 25, 2010, 07:57:23 pm
aaah ok that one works fine. But yeah it would be nice to include all of those in one place at one point in case Freehostia shutted down their free service or something

Looks nice btw. I can't guarantee I'll program much for it yet, though, since I'm still learning Axe and have trouble learning multiples languages at once
Title: Re: jBasic
Post by: Eeems on May 25, 2010, 07:59:06 pm
ah ok, well I don't think they'll shut down for a while, and I have a hard copy on my usb stick, and soon I'll put it on my laptop.

thanks! well maybe after you master AXE :P
Title: Re: jBasic
Post by: meishe91 on May 25, 2010, 08:58:38 pm
So I just tried out the physics demo again today. Looking good still. Odd things were going on though. First thing is that when I added more blocks it just created the new ones and stopped using the original (like it created the right amount of blocks and such). Then with more blocks I was just able to pass though the bounds really easily.

The website looks really cool by the way :)
Title: Re: jBasic
Post by: DJ Omnimaga on May 25, 2010, 09:38:42 pm
Well it definitively looks like your new version now breaks in Opera so I will prbly quit testing until compatibility is back :(
Title: Re: jBasic
Post by: Eeems on May 25, 2010, 10:10:47 pm
Hmm, what are the errors? I'll have to get a copy of opera to keep compatability.
Title: Re: jBasic
Post by: DJ Omnimaga on May 25, 2010, 10:12:05 pm
I just see a blank page :/

No loading bar or something, just an empty blank page

Source is
Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<head>

<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type" />
<meta content="minimum-scale=1.0, width=device-width, maximum-scale=0.6667, user-scalable=no" name="viewport" />
<!----!>
<!--default--!>
<link rel='stylesheet' type='text/css' href='http://future_history.freehostia.com/iWebkit/themes/default/css/navbar.css' media='screen' />
<script src="../iWebkit/javascript/functions.js" type="text/javascript"></script>
<link rel="apple-touch-startup-image" href="../iWebkit/startup.png"><title>Future History - jBasic -</title>

</head>

<body>
<div id="topbar">
<div id="title">
jBasic
</div>
</div>
<div id="navbar">
<div id="leftnav">
<a href="..">
back
</a>
</div>
<div id="navbar">
<div id="rightbutton">
<a href="../themechoose.php">
themes
</a>
</div>
</div>
</div>

<div id="content">
<ul class="pageitem">
<li class=textbox" style="text-align:center;">
 jBasic is a Javascript transitional library for anyone use to TI-Basic. It incorperates many commands that TI-Basic has, as well as more commands making it easier to make games. jBasic specializes in games, but anything is possible with it.
</li>
</ul>
<ul class="pageitem">
<li class="menu">
<a href="tutorial.html">
<img alt="php" src="http://icons3.iconfinder.netdna-cdn.com/data/icons/lingo/Game.png" />
<span class="name">Tutorial</span>
<span class="comment">A jBasic tutorial to get you started with it.</span>
<span class="arrow"></span>
</a>
</li>
<li class="menu">
<a href="jBasic.html">
<img alt="php" src="http://icons3.iconfinder.netdna-cdn.com/data/icons/lingo/Game.png" />
<span class="name">jBasic Demo</span>
<span class="comment">A basic demo of jBasic</span>
<span class="arrow"></span>
</a>
</li>
<li class="menu">
<a href="jBasicPhysics.html">
<img alt="php" src="http://icons3.iconfinder.netdna-cdn.com/data/icons/lingo/Game.png" />
<span class="name">jBasic Physics Demo</span>
<span class="comment">A small physics engine (ish) made with jBasic</span>
<span class="arrow"></span>
</a>
</li>
<li class="menu">
<a href="jBasicPhysics.html">
<img alt="php" src="http://icons3.iconfinder.netdna-cdn.com/data/icons/lingo/Game.png" />
<span class="name">Gunner</span>
<span class="comment">A small point and shoot game using the jBasic Physics Engine.</span>
<span class="arrow"></span>
</a>
</li>
</ul>
</div>
Title: Re: jBasic
Post by: Eeems on May 25, 2010, 10:17:45 pm
Ok, thats not jBasics fault...but that webpages fault...no idea why its doing that....ill have to find a way around it.....
That page does not use jBasic its just my project page with all my links and such. Hmm, opera mini on my ipod is havibg the same problem...
Title: Re: jBasic
Post by: DJ Omnimaga on May 25, 2010, 10:20:41 pm
aaah ok I hope you can find a solution x.x
Title: Re: jBasic
Post by: Eeems on May 25, 2010, 10:26:49 pm
Yeah...i thi k it will be as simple as adding a none mobile version of the page....but that will require a lot of css coding D:
Title: Re: jBasic
Post by: DJ Omnimaga on May 25, 2010, 10:33:56 pm
ouch x.x

Good luck! I hate CSS. TOok me so long to get that forum skin to work
Title: Re: jBasic
Post by: Eeems on May 26, 2010, 11:02:17 am
thanks...hopefully it's easy to fix. I think what is throwing off opera is setting the screen...
Code: [Select]
<meta content="minimum-scale=1.0, width=device-width, maximum-scale=0.6667, user-scalable=no" name="viewport" />so I'll have to find a way to make it work with that. I'll probably have to make a whole new style-sheet but who knows...I might even just make a new template for a none-mobile site and use that...
Title: Re: jBasic
Post by: DJ Omnimaga on May 26, 2010, 12:18:28 pm
mhmm that might be that. I never seen that code before. Maybe it's not really a W3C compliant command?
Title: Re: jBasic
Post by: Eeems on May 26, 2010, 06:33:49 pm
Well it should be from what I know, it's defining the view screen...
Title: Re: jBasic
Post by: Eeems on May 28, 2010, 05:19:03 pm
ok, I've updated the tutorial a bit, and made a really nice menu :P have fun playing around with that ;P
I'll have some more updates next week as I am at a Youth Conference all weekend.
Title: Re: jBasic
Post by: DJ Omnimaga on May 28, 2010, 11:42:44 pm
Cool ^^

And can't wait to see you back! Have fun there!
Title: Re: jBasic
Post by: Eeems on May 29, 2010, 02:15:09 am
Thanks :D it took me about half an hour to perfect it.
I am :D same with Beautiful Ending :)
Title: Re: jBasic
Post by: DJ Omnimaga on May 29, 2010, 02:23:28 am
Oh btw I'm glad you got round borders to work in Opera in your tutorial (on Unsyntaxsoft site they don't D:)
Title: Re: jBasic
Post by: Eeems on May 29, 2010, 08:43:51 am
Yeah i looked at the code and was wondering why i only had mozilla css there and so then i added in webkit, iwebkit and standard css3 border-radius values, so it should work on all major browsers but IE
Title: Re: jBasic
Post by: Eeems on June 04, 2010, 05:24:34 pm
Ok I have released a game in jBasic, just a basic point and click shoot the blocks in 30 seconds and hope for the best :P try it out here:
http://future_history.freehostia.com/jBasic/gunner.html
Title: Re: jBasic
Post by: DJ Omnimaga on June 04, 2010, 05:29:41 pm
Oooh nice :D

I scored 37541
Title: Re: jBasic
Post by: Eeems on June 04, 2010, 07:01:32 pm
lol, really? that doesn't seem right...it should only give you 30 seconds...it might be because you are on a slower computer though...
Title: Re: jBasic
Post by: DJ Omnimaga on June 04, 2010, 07:16:19 pm
I was kidding :P

I got 38 :P

And lol, a Intel i7 2.80 GHz quad core computer with 8 GB of RAM slow? No way :P
Title: Re: jBasic
Post by: Eeems on June 04, 2010, 07:28:54 pm
lol :P well the best I got is 56 right now. lol wow that is nice :P
Title: Re: jBasic
Post by: meishe91 on June 04, 2010, 11:19:22 pm
I got 60. Woo :P

What is with the blue box that surrounds the cross hair part way through?
Title: Re: jBasic
Post by: {AP} on June 04, 2010, 11:32:06 pm
Your game causes issues for resolutions that can't fit the whole screen at once. If you scroll down, it won't accept any clicks on the boxes as hits. =(
Title: Re: jBasic
Post by: Eeems on June 05, 2010, 12:37:41 am
Yeah I've noticed that, you can fix it by zooming out though.
@meishe91: what blue box?
Title: Re: jBasic
Post by: DJ Omnimaga on June 05, 2010, 12:39:03 am
Do you think the game can be made so it's stretched based on your resolution?

Title: Re: jBasic
Post by: meishe91 on June 05, 2010, 12:56:22 am
Oh, well then something happens when a filled blue box will surround the cross hair.

Here is a picture. I just secluded it to that for size reasons.
Title: Re: jBasic
Post by: Eeems on June 05, 2010, 01:06:27 am
What browser and system are you on?
I have not encountered this...does the shooting look normal, like a gunshot effect? What steps did you take to re-create this?
Title: Re: jBasic
Post by: meishe91 on June 05, 2010, 01:11:43 am
I'm on XP using Chrome. Ya, the shooting looks fine. Everything just has the blue tint when that is over it. All I did was play again. I'm not sure what I do when it happens.
Title: Re: jBasic
Post by: Eeems on June 05, 2010, 01:19:01 am
Hmm, strange...I can't replicate that in FF...so i don't know whats causing it...:/
Title: Re: jBasic
Post by: meishe91 on June 05, 2010, 01:20:19 am
Hmmm, ok. Well I'll test it in other browsers in a little bit and tell you what happens.
Title: Re: jBasic
Post by: Eeems on June 05, 2010, 01:30:21 am
ok thanks :) hopefully I can find the issue.
Title: Re: jBasic
Post by: meishe91 on June 05, 2010, 02:02:04 am
Ok, so here is what I got:

IE: Cross hair works but the game it self does not. Like no blocks fall down or anything and doesn't time out after 30 seconds. The "bang" works though.
Safari: Same result as here on Chrome. The blue box shows up. Only thing wrong is that it doesn't pop the score up, you have to look in the debugging box for it.
FireFox: Seemed to work perfectly fine.
Title: Re: jBasic
Post by: DJ Omnimaga on June 05, 2010, 02:07:47 am
So i guess it works fine in both Firefox and Opera then?
Title: Re: jBasic
Post by: Eeems on June 05, 2010, 02:53:19 am
It should.