View previous topic - View next topic |
Author |
Message |
janus Mage
Joined: 29 Jun 2002 Posts: 464 Location: Issaquah, WA
|
Posted: Fri Jul 16, 2004 8:58 am Post subject: |
[quote] |
|
Happy wrote: | LordGalbalan wrote: | If you put this code in a place where it'll work, then you'll see the blank image flicker in and out of view at 20 fps, and with it a LOT of flicker because the screen update in most browsers is not tied to the vertical sync. I've looked it up and JS can't tie in with the v-sync manually. You'd might as well program a QB clone in Java, complete with its turtle-slow graphics routines, and program it that way. :P I don't think, then, that JS is a good idea for an engine base, although for that reason only. It is possible to use cookies to communicate data between client JS and a server, using only a W3C compliant web browser as the communication medium, although you may have to go through a few hoops to keep the server scripts running along with their clients. Now it is very possible to write a server in Java and a graphical display in Java, and the game engine proper in Javascript, and that is what I recommend. JS is functional enough for interpreter design, by the way. |
I really don't think you know what you're talking about, LordGalbalan. |
http://www.rpi.edu/~laporj2/test/media/javascript/polygon.html
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
|
Back to top |
|
|
Happy JonA's American snack pack
Joined: 03 Aug 2002 Posts: 200
|
Posted: Fri Jul 16, 2004 3:37 pm Post subject: |
[quote] |
|
janus wrote: | http://www.rpi.edu/~laporj2/test/media/javascript/polygon.html |
LordGalbalan wrote: | http://lordgalbalan.tripod.com/RefreshTest.html |
Yeah. See, those links don't do anything?
So, yeah. I don't think you've convinced me that you know what you're talking about.
|
|
Back to top |
|
|
janus Mage
Joined: 29 Jun 2002 Posts: 464 Location: Issaquah, WA
|
Posted: Sat Jul 17, 2004 2:21 am Post subject: |
[quote] |
|
Um, that page doesn't do anything...
Anyway, if you look at the source to the page I linked, it's quite possible to render shapes and animated graphics in Javascript with minimal flickering.
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Sat Jul 17, 2004 6:55 am Post subject: |
[quote] |
|
What I don't think you realize, is that the flashing box is the example. :\ Notice the shear...?
But to make the point perfectly clear (your arrogance has gotten to me by now) I suggest that you alter your prized rotation demo to switch colors at 20 fps.... Then we'll see what happens, won't we? ;)
...You'll see it anyway when you start trying to animate your images. Whatever, do as you please. :P
|
|
Back to top |
|
|
janus Mage
Joined: 29 Jun 2002 Posts: 464 Location: Issaquah, WA
|
|
Back to top |
|
|
Adam Mage
Joined: 30 Dec 2002 Posts: 416 Location: Australia
|
Posted: Sat Jul 17, 2004 9:57 am Post subject: |
[quote] |
|
All your demo shows is that javascript does not have vsync. I don't see why this is a huge problem with a tiled based engine that has people walking around. _________________ https://numbatlogic.com
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Sat Jul 17, 2004 11:48 am Post subject: |
[quote] |
|
1) pandabunny avoids flicker by moving the parts. (yeah DHTML does work pretty well like that, never would have tried making a virtual screen from tables if it didn't) This won't translate well into a sprite-based engine.
2) I tried this sorta thing years ago: make 65536 cell table and arrange routines to switch the colors of any single pixel at will, effectively creating a virtual display. Ah nice, DOOM in JS. Not in 2001: I ran just such a script on a top-of-the-line (for the time) server running at 800mhz and got a warning from IE that if I didn't give it up there could be problems. Checking out your own (albiet impressive) script, I discovered a 48% CPU utilization at the height of the script, with only the Trillian instant messenger running in the background. (when the script window did not have focus the utilization was 2%) In light of the fact that my processor is a 1.5Ghz AMD 2200+, I surmise that an entire gigahert is required by your script in the same sense that a 20Mhz 386SX was required of the classic DOOM engine. I admire your optimism, but even I must conclude that that's simply wasteful. FFXI requires a gigahert for decent play and look what you get for it!
An itty bitty plugin that is LiveConnect compliant would do the job, I think. Or Java, which does well even on a PII. I would have already written the plugin and I did look into it, but writing anything with the Mozilla source is something you take a class in or at least read a lengthly book for, I think. :\ You see, I had this idea some years ago, to make a persistent online world controlled by a democratically elected government. If ever you've played Graal Online, you may have heard of it.
3) Ditto for the raytracer. I dare you to run this on anything less than a PIII. Impressive, though, I must say.
Finally, sound. Last I here there is only a single BGSound property in QB. If you want to see it at work, try out my battle demo.
http://lordgalbalan.tripod.com/LilRPG.html
IE is required for the demo and for the flicker test. I would have liked to add sound effects, but given the choice between music and sound I preferred the music.
I have something to add to the project, if it will be accepted. The following script is a task manager that traps events to an array for access by scripting engines. I've not tested it yet due to its complexity... I tend to be pretty good at developing self-contained systems, but when it comes to interfacing several systems with one another I'm lost for months on end. :\
http://lordgalbalan.tripod.com/GameEngineJS.html
And although it's probably irrelevant, here's the interpreter I'm writing, also in Javascript.
http://lordgalbalan.tripod.com/PLASMFinal.html
|
|
Back to top |
|
|
janus Mage
Joined: 29 Jun 2002 Posts: 464 Location: Issaquah, WA
|
Posted: Sat Jul 17, 2004 12:56 pm Post subject: |
[quote] |
|
LordGalbalan wrote: | 1) pandabunny avoids flicker by moving the parts. (yeah DHTML does work pretty well like that, never would have tried making a virtual screen from tables if it didn't) This won't translate well into a sprite-based engine. |
Actually, if you look at the code for all the demos (including Polygon, which draws a polygon pixel-by-pixel in realtime), one of the main tricks is using setInterval instead of setTimeout to cut down on flicker.
Quote: | * setTimeout() allows you to DELAY the execution of an expression or evaluate a function.
* setInterval() allows you to EVALUATE an expression or a function at set INTERVALS (thus the name - neat eh?).
|
(from http://www.evolt.org/article/comment/17/36035/ )
That, and what exactly would you do to render sprites, other than show them using IMG tags and moving the images around?
I'm not exactly arguing in favor of a JS/PHP implementation of this, but you're giving JS/DHTML far too little credit. ;)
Triglav is an obvious example of JS being somewhat suitable for this. Triglav has many issues, but Flicker is not one of them.
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Sat Jul 17, 2004 3:06 pm Post subject: |
[quote] |
|
You're right. Well, I learned something! :)
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Tue Aug 10, 2004 1:02 am Post subject: |
[quote] |
|
Hi, I hope this idea didn't die. It was actually a pretty good one.
I'm developing a demonstration of what a sprite based cell world developed in JS would look like on a browser. I'll put a link to it when I get it working.
Also, I'm wondering if maybe it'd be reasonable to try a non-standard browser, like Arachne for DOS, that would have total control over the display. Then it would be possible to update in time with the verticle pulse and to eliminate flicker?
|
|
Back to top |
|
|
Bjorn Demon Hunter
Joined: 29 May 2002 Posts: 1425 Location: Germany
|
Posted: Tue Aug 10, 2004 5:42 pm Post subject: |
[quote] |
|
I don't think the idea is dead, but it's a wholly complicated thing and it's mostly waiting on people to start experimenting. :-)
I think building it for a DOS browser is useless, if you want total control over the display (which is actually impossible in modern operating systems), you can come close by making a downloadable engine instead. Building the engine on top of dated DOS software just sounds silly to me.
I would prefer something that doesn't take (or at least doens't NEED) full control over the screen. This would be either an executable program that can run windowed, a Java applet or the dynamic html you are describing. I think dynamic html is the worst of the options, because of complexity and bad performance.
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Fri Aug 13, 2004 7:36 am Post subject: |
[quote] |
|
Although Java is the only real solution, JS can be the starting point.
This is a skeleton tile-based engine with full keyboard support. Scripting and sprite frame switching is next on the list.
Code: |
function ActivateCellspace (Sprite, Keyboard, Image, Map) {
if (Keyboard.Present.Grid[Keyboard.Keyset.DirectionalUp] == 1) {
MoveSprite(Sprite, Image, Map);
SetSpriteAxisY(Sprite);
}
else if (Keyboard.Present.Grid[Keyboard.Keyset.DirectionalDown] == 1) {
MoveSprite(Sprite, Image, Map);
SetSpriteAxisY(Sprite);
}
else if (Keyboard.Present.Grid[Keyboard.Keyset.DirectionalLeft] == 1) {
MoveSprite(Sprite, Image, Map);
SetSpriteAxisX(Sprite);
}
else if (Keyboard.Present.Grid[Keyboard.Keyset.DirectionalRight] == 1) {
MoveSprite(Sprite, Image, Map);
SetSpriteAxisX(Sprite);
}
if (Sprite.Movement.Obstruction.Flag == 1) {
Dialogue.Source = Sprite.Movement.Obstruction.Index;
Sprite.Activity.Grid[Sprite.Cell.Incoming.Grid[Sprite.Index];
Dialogue.childNodes(0) = changeNode(Dialogue.Source);
}
Sprite.Axis = 0;
}
function SetSpriteAxisX (Sprite) {
// |*| The SetSpriteAxisX function
//
//
// |!| The SetSpriteAxisX function updates a sprite's X
// coordinate.
//
//
// (+) Set Sprite.Grid.X vector entry at the Sprite.Index to
// the Sprite.Axis.
//
Sprite.Grid.X[Sprite.Index] = Sprite.Axis;
}
function SetSpriteAxisY (Sprite) {
// |*| The SetSpriteAxisY function
//
//
// |!| The SetSpriteAxisY function updates a sprite's Y
// coordinate.
//
//
// (+) Set Sprite.Grid.Y vector entry at the Sprite.Index to
// the Sprite.Axis.
//
Sprite.Grid.X[Sprite.Index] = Sprite.Axis;
}
function MoveSprite (Sprite, Image, Map) {
if (Sprite.Translation.Flag == 0) {
TranslateSpriteCell(Sprite);
TranslateSprite(Sprite);
}
MoveSpriteImage(Image, Sprite);
}
function TranslateSprite (Sprite) {
// |*| The TranslateSprite Function
//
//
// |!| The TranslateSprite function translates a sprite over
// the display pixel by pixel over an axis, until its
// new position reflects the union of its old coordinate
// on the axis with its applied velocity of movement.
//
//
// (+) While the Sprite.Movement.Index is less than the
// Sprite.Movement.Velocity.Grid vector entry at the
// Sprite.Index....
//
// -=> Set the Sprite.Frame.Index to the
// Sprite.Movement.Velocity.Grid vector entry at the
// Sprite.Index divided by the Sprite.Movement.Index.
//
// -=> Increase the Sprite.Frame.Index by combining it with
// the Sprite.Frame.Constant.
//
// -=> Increase the Sprite Axis by combining it with the
// Sprite.Translation.Constant.
//
// -=> Set the Sprite.Translation.Flag.
//
if (Sprite.Movement.Index <= Sprite.Movement.Velocity.Grid[Sprite.Index]) {
Sprite.Frame.Index =
Sprite.Movement.Velocity.Grid[Sprite.Index] / Sprite.Movement.Index;
Sprite.Frame.Index = Sprite.Frame.Index + Sprite.Frame.Constant;
Sprite.Axis = Sprite.Axis + Sprite.Translation.Constant;
Sprite.Translation.Flag = 1;
}
}
Function MoveSpriteImageIE (Image, Sprite) {
// |*| The MoveSpriteImageIE function
//
//
// |!| The MoveSpriteImageIE function is native to Microsoft
// Internet Explorer. It uses DHTML cascading stylesheet
// properties to move a sprite image overtop of either
// an HTML document or an HTML document fragment.
//
//
// (+) Increase the Image.style.posTop property by combining
// it with the Sprite.Grid.Y vector entry at the
// Sprite.Index.
//
//
// (+) Increase the Image.style.posLeft property by combining
// it with the Sprite.Grid.X vector entry at the
// Sprite.Index.
//
Image.style.posTop =
Image.style.posTop + Sprite.Grid.Y[Sprite.Index];
Image.style.posLeft =
Image.style.posLeft + Sprite.Grid.X[Sprite.Index];
}
Function MoveSpriteImageIE (Image, Sprite) {
// |*| The MoveSpriteImageW3C function
//
//
// |!| The MoveSpriteImageW3C function employs World Wide
// Web Consortium (W3C) DHTML cascading stylesheet
// properties to move a sprite image overtop of either
// an HTML document or an HTML document fragment.
//
//
// (+) Increase the Image.style.top property by combining
// it with the Sprite.Grid.Y vector entry at the
// Sprite.Index.
//
//
// (+) Increase the Image.style.left property by combining
// it with the Sprite.Grid.X vector entry at the
// Sprite.Index.
//
Image.style.top =
Image.style.top + Sprite.Grid.Y[Sprite.Index];
Image.style.left =
Image.style.left + Sprite.Grid.X[Sprite.Index];
}
function TranslateSpriteCell (Sprite) {
// |*| The TranslateSpriteCell Function
//
//
// |!| The TranslateSpriteCell function translates a single
// sprite over a cell vector by combining the difference
// between the sprite's old and new X and Y indices on
// the cell vector with its older X and Y coordinates.
//
//
// (+) Update the Cell.Incoming.X entry at the Sprite.Index
// by combining the Sprite.Cell.X entry at the Sprite.Index
// with the Sprite.Cell.Auxillary.X entry at the Sprite
// Index.
//
//
// (+) Update the Cell.Incoming.Y entry at the Sprite.Index
// by combining the Sprite.Cell.Y entry at the Sprite.Index
// with the Sprite.Cell.Auxillary.Y entry at the Sprite
// Index.
//
//
// (+) Compute the sprite's offset on the
// Sprite.Cell.Incoming.Grid vector by multiplying the
// Sprite.Cell.Limit.X by the Sprite.Cell.Incoming.Y vector
// entry at the Sprite.Index and combining the product with
// the Sprite.Cell.Incoming.X vector entry at the
// Sprite.Index.
//
Sprite.Cell.Incoming.X[Sprite.Index] =
Sprite.Cell.X[Sprite.Index]
+ Sprite.Cell.Auxillary.X[Sprite.Index];
Sprite.Cell.Incoming.Y[Sprite.Index] =
Sprite.Cell.Y[Sprite.Index]
+ Sprite.Cell.Auxillary.Y[Sprite.Index];
Sprite.Cell.Incoming.Grid[Sprite.Index] =
Sprite.Cell.Incoming.X[Sprite.Index]
+ (Sprite.Cell.Limit.X * Sprite.Cell.Incoming.Y[Sprite.Index];
}
function TestVsObstacle (Sprite, Map) {
// |*| The TestVsObstacle Function
//
//
// |!| The TestVsObstacle function determines whether or not
// the cell that a sprite is trying to cross into has
// been flagged as an obstacle. Sprites may not cross
// onto obstacle cells.
//
//
// (+) If the Map.Cell.Grid vector entry at the
// Sprite.Cell.Incoming.Grid vector entry at the
// Sprite.Index is equal to 1....
//
// -=> The cell is an obstacle and the sprite remains
// static. Reset the Sprite.Cell.Incoming.Grid vector
// entry at the Sprite.Index to the value of the
// Sprite.Cell.Grid entry at the Sprite.Index.
//
// -=> Alert the sprite to the obstruction by setting
// its obstruction flag.
//
if (Map.Cell.Grid[Sprite.Cell.Incoming.Grid[Sprite.Index]] == 1) {
Sprite.Movement.Obstruction.Index =
Sprite.Cell.Incoming.Grid[Sprite.Index];
Sprite.Cell.Incoming.Grid[Sprite.Index] =
Sprite.Cell.Grid[Sprite.Index];
Sprite.Movement.Obstruction.Flag = 1;
}
}
function ReturnKeyboardState (event, Keyboard) {
Keyboard.Incoming.Grid[event.keyCode] = 1;
Keyboard.Queue.Grid[Keyboard.Queue.Grid.Limit] = event.keyCode;
Keyboard.Queue.Grid.Limit = Keyboard.Queue.Grid.Limit + 1;
}
function RecordKeyboardState (Keyboard) {
var ActiveKey;
for (Keyboard.Queue.Grid.Index = 1;
Keyboard.Queue.Grid.Index <= Keyboard.Queue.Grid.Limit;
Keyboard.Queue.Grid.Index++) {
ActiveKey = Keyboard.Queue.Grid[Keyboard.Queue.Grid.Index];
Keyboard.State.Grid[Keyboard.Incoming.Grid[ActiveKey]] = 1;
Keyboard.Incoming.Grid[ActiveKey] = 0;
}
}
function DeleteKeyboardState (Keyboard) {
// |*| The DeleteKeyboardState Function
//
//
// |!| The DeleteKeyboardState function clears the keyboard
// queue and state vectors by first resetting the keyboard
// state vector indices of the keys in the keyboard queue
// vector, then resetting the indices of the keyboard queue
// vector itself.
//
var QueueIndex;
for (Keyboard.Queue.Grid.Index = 1;
Keyboard.Queue.Grid.Index <= Keyboard.Queue.Grid.Limit;
Keyboard.Queue.Grid.Index++) {
QueueIndex = Keyboard.Queue.Grid.Index;
Keyboard.State.Grid[Keyboard.Queue.Grid[QueueIndex]] = 0;
Keyboard.Queue.Grid[QueueIndex] = 0;
}
Keyboard.Queue.Grid.Limit = 1;
}
|
|
|
Back to top |
|
|
Happy JonA's American snack pack
Joined: 03 Aug 2002 Posts: 200
|
Posted: Sat Aug 14, 2004 3:01 pm Post subject: |
[quote] |
|
LordGalbalan wrote: | Although Java is the only real solution, JS can be the starting point. |
No it's not. And if you're going to use Java why start in JavaScript? They're completely different languages.
|
|
Back to top |
|
|
Sirocco Mage
Joined: 01 Jun 2002 Posts: 345
|
Posted: Sat Aug 14, 2004 5:08 pm Post subject: |
[quote] |
|
Quote: |
No it's not. And if you're going to use Java why start in JavaScript? They're completely different languages.
|
I concur. Don't bother with script if you're going to work up a project in Java.
.
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|