123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|719|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> JSE -> JSE - Jay's Scripting Engine

Page : 1 2 3 4 5 6 7 Prev 8 9 Next 10 11 12 13 14
Sun, 27 Jun 2021, 04:47
Dan

The Array Shuffle and Sort commands only work with Single-Dim arrays. I should really make them work with Multi-Dims, too, but .. good lord, the maths involved!!!


Maths ? I would do it with 2~3 loops. (edit: At least for the 2d arrays.)

If you look at the shuffling function, look what it is really doing:

if you look at the 1d array, it is shuffling (switching position) in the vertical direction.

2d array adds a horizontal cells/columns to the 1d array.


For it, all you need to do is to first randomize the columns, for each row, first.
Then randomize the rows.

I guess that would do it, unless some other shuffling method is preferred ?!

Alternatively, you could add a 3rd pass, which shuffles the columns first, then rows.

And do not torture the cgollumns:

View on YouTube
too much

p.s. i've misspelled the columns as collumns almost every time it was written in this post ...
Sun, 27 Jun 2021, 06:14
Jayenkai
Honestly, I just couldn't be arsed doing it at the time..
Some day..
It's on my todo list..

Imagine you have a 4 dim array with 2 cells in each..
Array(2,2,2,2) .. A,B,C,D
And the sort swaps the two A's

It's not just that, is it..
You have to sort all the other values, too.
1,1,1,1 has to swap with 2,1,1,1
Up to
1,2,2,2 swapping with 2,2,2,2

Now imagine Array(256,256,256,256)...

I looked at that and my head went.. .... "fuck it, I'll do it another day.."
It's not "technically" maths, but I couldn't be bothered explaining it, and just put it down to maths.

-=-=-
''Load, Next List!''
Sun, 27 Jun 2021, 12:27
Dan
Yeah i know.

I have found out that, if i want to understand something, and it is hard, then i should start with making it easy first.

Simplifying things ...

For e.g. I would start with 1d arrays, then when i know how to shuffle them, i would go to the 2d array.

Then i would think a bit on how would the code work for that.

A 2d array is a grid. That is easy to understand and imagine.

3d arrays can be imagined as many 2d grids in a notebook.

If you think of it as (x,y,z) then each z would hold one 2d grid.

4d arrays, then, would be many notebooks in a drawer .... ok this is a bit too high for my imagination as well ...

well anyway, the question would be, how much shuffling should be done to each type of array.

I know that you do not need to do everything at once.

But it can be helpful to imagine it today (or some day when you feel energized), and someday the solution may simply 'click'.
Mon, 28 Jun 2021, 13:06
Dan
And something did click, here, yesterday evening about 1am.


I have asked myself (now) how would i implement the array shuffling in that TinyBBasic (see somewhere in the forums).

The shuffling of the 1d array is easy. Just switch positions and it is done.

The shuffling of the 2d/3d/4d arrays is more complex.

Theoretically you can do the random switching of the values, just like the 1d array.

If you have the arrays which are holding numbers (i do not know why would someone need a 3d/4d array full with numbers) then you can simply switch places for certain amount of times.

i wrote (jff) a simple array shuffler (1d/2d) in blitzbasic:


For 3d array i would use 6 variables, and for 4d: 8.

of course, the more dimensions, the longer would the code/script need to shuffle them.


therefore, for the 2d+ arrays, i would use a number of iterations instead of "for x,y,z"

The shuffling for the places is easy.
But ...

2d+ arrays can be used, for example address keeping.

The array would hold data as Twod(index, description)

which would look like


Index, Description >
V

"John", "Smith", "Suggar Lane 10", "Worchester"
"Pal", "Patine", "DeathStar 1", "Starwars universe"

To shuffle this kind of array would produce a funny output, but is it meaningful ?

For this kind of array, it would be practicable to switch the index places.


... anyway ...

I would suggest that you implement simple shuffling methods for 1d and 2d arrays, and the user, if he needs higher dimensional shuffling, should do it by himself.

Well, at least, i would do that.
Mon, 28 Jun 2021, 13:20
Jayenkai
I was actually considering some kind of reference list for the first dimension, so that you could quickly sort that, then it points to the true element in the array.
Whatever method I ultimately end up going for, it's going to have to be super-quick.
Array stuff is already painfully slow in places.

-=-=-
''Load, Next List!''
Mon, 28 Jun 2021, 14:05
Dan
Ah, i see: another array which holds the numbers for the shuffles.


Tue, 29 Jun 2021, 07:49
Jayenkai
  --v

Yeah.. Seems to be working alright...

-=-=-
''Load, Next List!''
Wed, 30 Jun 2021, 07:22
Jayenkai
Over on Twitter, @Retro70sChild posted pictures from one of those 80's Usborne computer books, and within the 3 pages pictured, was one page containing the entire code for a mini BASIC Skiing game.

Mmmmm...



I read through the code and wondered..

  --v

There's a couple of tiny tweaks here and there.
The Inkey$ has been switched with GamePad controls, the "wait for a key" loop has been replaced with a WaitGamePad, and there's been delays added to slow it down from an insane speed.
Another fairly substantial change is in the actual Print command for the gameplay.
The original book relied upon the Tab() command to move the text cursor around the screen, but JSE currently doesn't have one of those.
Instead, I've plonked the character onto a second line of text. It does the job..

But.. Yeah, it works a treat!
Super Retro Coding FTW!!

-=-=-
''Load, Next List!''
Thu, 01 Jul 2021, 09:29
Jayenkai
  --v

You'll note that the uppercase and lowercase letters get triggered together. I couldn't think of a good way to separate them without them breaking, so instead opted to just have everything happen together.
In the future I might "fix" that, but I imagine in most of the cases when you're scanning for "Key Down" then it really shouldn't matter.. Right!?!

Hmm..

.. Which is even odder when the symbols ARE sent as separate buttons, so a ; key is different to a : key, and so on.

Either way, it's probably not a good idea to trust/rely on the results of KeyDown. With all the browser/system/keyboard layouts and more, and without an exact button layout, you really shouldn't ever assume that this command will give the correct outputs.

That said. It does kinda work, so.. there's that.
You can use the above proggy to find numerical values, or you can use ASC("symbol goes here") to .. hopefully.. get the right key.
..
Maybe..
..
.... Sometimes.

Gawd, I wish Javascript was more specific about this stuff.

For Blitz2D/3D compatibility, the Keydown(200) returns the up cursor, 203 the left, 205 for right and 208 for down.
.. But then KeyDown(57) isn't space any more.. 32 is space, and 57 is the number 9. RAWR!!!!

I tried my best.
It's as good as you're getting!
Stop complaining!!!

Also, if Dan could give this a go, and let me know if it's doing "Chr = Letter on his keyboard" or "Chr = Letter on a QWERTY keyboard", that'd be great.
Maybe hold A and see what shows up!!
I *think* it should be "right", but I did do a lot of stuff to make WASD always function, and I think that might've caused this part to mess up.

-=-=-
''Load, Next List!''
Fri, 02 Jul 2021, 04:33
Jayenkai
  --v

The game above is "Ball Up"
It's not a very good game, but it is a very important step in the progress is JSE.

The game was originally written back in 2005, using Blitz2D. It's the very first entry from the very first Wednesday Workshop.
The original sourcecode can be found here, and you can scan through to see the minimal changes from the original B2D code to the JSE code.

Other entries from the first workshop are still very broken, however. A lot of them use those fancy-pants Types, or even Functions, so don't work in the slightest in JSE.
But I'm definitely heading in the right kind of direction, here.


-=-=-
''Load, Next List!''
Fri, 02 Jul 2021, 08:40
Jayenkai
  --v


Spent most of today optimising the main interpreter stuff. I've managed to shave about 30% off the above test. It used to give an average of 130 mills per loop, but now averages around 90. (Incidentally, let me know what average you get on your system)

It's still nowhere near ideal, and definitely isn't Blitz-fast, but it's faster than it was.

I don't *think* I've broken anything along the way. There was some pretty out-there optimisations done, and lot of hacking away at (hopefully!) unnecessary bits of code.
Let me know if you see anything wrong.

-=-=-
''Load, Next List!''
Fri, 02 Jul 2021, 09:05
Pakz
Here it goes from high 130's to up to 160 ms. This on the amd 4800H laptop.
Fri, 02 Jul 2021, 09:19
Jayenkai
Hmm.. Not ideal, but .. Alright I suppose.
I'm sure I can get it faster, if I try.

Try it on your iPad. You should get much faster results!

|update| Tested it on my MacMini (2015), and it's averaging about 280.. |update|

-=-=-
''Load, Next List!''
Fri, 02 Jul 2021, 09:43
Pakz
Yeah, on the m1 ipad it is around 57.
Fri, 02 Jul 2021, 09:50
Jayenkai
Woohoo!!!!
Fri, 02 Jul 2021, 12:14
Dan
@Jayenkai: The y and z are currently swapped.

Btw, is there a key kombo which lets you to save the image of the canvas ?

(I was trying to hit as many keys as i could, jff and there were few images queued for download)
Fri, 02 Jul 2021, 12:37
Jayenkai
; or ' take screenshots. I set up two keys in case people's keyboards were too different.
[ and ] also have the same function, but trigger video capture. Hit once to start. Hit again to end and save.
I could do with adding an onscreen "recording" icon, but it'll have to be overlaid, or it'll end up capturing. Currently the FPS display and the Onscreen controller both get captured. D'oh..

-=-=-
''Load, Next List!''
Sat, 03 Jul 2021, 04:18
Jayenkai

New Domain - Moving Projects


JSE has done a Pakz, and gone and moved to a new house!!

There's now a GotoJSE.com domain!!

If you want to switch over to using that, you'll first want to export your code that you currently have stored at AGameAWeek.com/JSE.

Pop back to the latter, export your current projects, then head on over to the new domain and import the file.

Everything "SHOULD" work, but if anything imports incorrectly, let me know.
Perhaps even email over the exported .jse file so I can take a look at it.

Happy moving day!

-=-=-
''Load, Next List!''
Sun, 04 Jul 2021, 10:46
Dan
I have just tried to export all projects to the file.
It does not work.

The console window is displaying following error:


(index):1287 Uncaught DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
at ExportProjects (https://agameaweek.com/JSE/:1287:18)
at HTMLImageElement.onclick (https://agameaweek.com/JSE/:3112:161)
ExportProjects @ (index):1287
onclick @ (index):3112

Sun, 04 Jul 2021, 14:58
Jayenkai
Bugger..
OK.. But you also need to tell me the browser and OS so I can help here..

-=-=-
''Load, Next List!''
Mon, 05 Jul 2021, 01:30
Jayenkai
OK, I've uploaded a temporary fix, but it'll "lose" any projects which have atob issues.
.. But it won't be losing anything that apparently isn't already lost.
I'm not sure why/if/how it might've corrupt in the first place.
... Hmm...

-=-=-
''Load, Next List!''
Mon, 05 Jul 2021, 09:19
Dan
Ok just came back home.

System: Windows 10, browser SrWare iron.

Looks like few projects haven't been exported. But i guess they were all copy'n'paste from here.
Tue, 06 Jul 2021, 07:36
Jayenkai
  --v

Some basic screen effects..
They're quite intensive, since they redraw the entire canvas, so are best used when you have tons of free CPUTime to spare.
The last "soft" effect seems to have the worst slowdown of them all, since it's redrawing the entire canvas over itself, 4 times!
Yikes!!

-=-=-
''Load, Next List!''
Wed, 07 Jul 2021, 15:27
Jayenkai


One of the biggest complaints, so far, has been how I made that little Symbol editor, and nobody can be arsed drawing sprites with it.
The Symbol editor now has an import button on the top right, which can load spritesheets of 32x32 pixel sprites.
It'll convert them to the default symbol palette, and save them as those handy Symbol-Code lines.

Magenta 255,0,255 will become transparent, and if your image already has Alpha in it, anything below half-transparency becomes fully transparent and anything above, solid.

Try not to go crazy with this feature, those Symbols get smegging huge when you use this!
And as always, the more imaginative you are, the better.
I don't want to see a bazillion bland dull and uninteresting sprite-rip games!!

Be creative.

-=-=-
''Load, Next List!''
Thu, 08 Jul 2021, 03:23
Pakz
Have you taken a look at the competition? Those fantasy consoles have gotten really good. Lots of features inside those. Bigger ones like Gamemaker and Godot might also have some things that might be interesting to add to yours.

I like it that yours can simply be posted inside this forum and be run with the press of a button.
Thu, 08 Jul 2021, 03:34
Jayenkai
This whole endeavour was pretty much spawned when you posted a Godot Example, back in February.
In order to get it to run on the "simple online version" there was a whole bunch of struggling with files, downloading things, naming them correctly, putting them back into a zip, uploading the zip to their server..

It just didn't work for "a quick example"
That's pretty much why this whole thing was created, and I've done my best to keep everything "Forum postable" as a result.

Other than that one experience, I haven't actually looked into anything newer, and I'm trying not to give myself too much "work".. Everything, so far, has been "the thrill of figuring things out", and I think that's what's kept me interested in the project.

Heck, when was the last time I worked on something for .. MONTHS!?!?!

I'm currently still having fun adding oldskool stuff.
Right now, I'm trying to decide the best way to do Paper, Pen and Ink commands. C64, BBC, Speccy and CPC all seem to do those commands in subtly different ways, so I need to pick and choose the best methods and figure out how best to implement them, so that .. for the most part.. code can be copy+pasted from old 80's examples and mostly work.

-=-=-
''Load, Next List!''
Page : 1 2 3 4 5 6 7 Prev 8 9 Next 10 11 12 13 14