DosTips.com

A Forum all about DOS Batch
It is currently 22 Mar 2017 18:08

All times are UTC-06:00




Post new topic  Reply to topic  [ 79 posts ]  Go to page Previous 1 2 3 4 5 6
Author Message
PostPosted: 11 Nov 2016 03:19 
Offline

Joined: 02 May 2016 18:20
Posts: 227
By the way, that pretty much wraps up the tool as far as new features go, none are left on my list now (some were thrown out rather than implemented). I consider it version 0.99, as I still have a list of 6-7 optimisation and bug fixes to (hopefully) do.

I'm actually a little perplexed that nobody seems to be using this stuff :?: I mean, it might not be that great but it's certainly not that bad. Of course I know far from everybody is doing graphics stuff, but if you do, then why not try it? And if you did, what was it you didn't like about it? Too cryptic, too difficult, not working properly, not fast enough, prefer another external tool (why?), or you simply don't like "non-pure" batch?

Anyway, just some thoughts. If you do decide to try it and run into issues, feel free to let me know.


Top
   
PostPosted: 17 Nov 2016 10:27 
Offline

Joined: 05 Apr 2015 13:06
Posts: 157
Location: MA South Shore, USA
misol101 wrote:
I'm actually a little perplexed that nobody seems to be using this stuff :?: I mean, it might not be that great but it's certainly not that bad. Of course I know far from everybody is doing graphics stuff, but if you do, then why not try it? And if you did, what was it you didn't like about it? Too cryptic, too difficult, not working properly, not fast enough, prefer another external tool (why?
I have applied quite a few of your cmdwiz operations for my new text oriented graphics script, MChoice.bat, at Mouse-Selectable Menu from a data file - a/la CHOICE. where I found some of your collaborator Antonio's "Auxiliary .exe" programs easier to work with, especially when dealing with text. I do like the smooth changes to the screen and buffer properties using cmdwiz. But, again, this was not really a graphics application. My compliments anyway.

John A.


Top
   
PostPosted: 19 Dec 2016 22:43 
Offline

Joined: 02 May 2016 18:20
Posts: 227
Time for a little update, even though I haven't implemented any of the stuff on my previous todo-list :) The repo and the zip file were updated.

One day I realized the simplest thing: why not run cmdgfx with start "" /B ? This starts a separate process in the same window, leaving the batch script to run uninterrupted while the graphics is rendered. It is certainly not without its problems doing things this way, but it does increase FPS radically in many cases.

Here is plasma3.bat:

Image

Image

Not only does this script run at a much higher frame rate than plasma2.bat (which does not use the start /B technique), but it can even load/draw a complex 3d model such as hulk.obj over the plasma and still retain a very high framerate!

So, what are the problems/things to think about with this method?

1. First of all, since start /B runs cmdgfx in the background and returns immediately, you will not be able to get the errorlevel from the program. This means that you cannot check for keys and mouse input this way. There are a few ways to deal with this:

1.1 Right after calling cmdgfx with start /B, call "cmdwiz getch noWait", and get the errorlevel. Remember not to use the k flag in the previous call to cmdgfx

1.2 For even more speed, you can use Aacini's "Getkey.exe /N" instead. Unfortunately it doesn't use the same errorlevel output as cmdwiz, but for "basic" standard keys the codes are the same.

1.3 It is also possible to specify the new flag 'o' in the start /B call to cmdgfx. This will save the errorlevel to a file called EL.dat. You can then get the input in the script using something like: set /p KEY=<EL.dat 2>nul . This is the fastest of all these methods since no extra external program needs to be called, but it is unfortunately not reliable. Several cmdgfx might execute simultaneously and overwrite EL.dat, which means key presses might get lost. If maximum speed is needed and input is not needed at the moment, this can still be used. As an example, "bezier-col-hires-nowait.bat" uses this (you may have to press Escape a few times to quit)

1.4 To get both input AND the possiblity to synch better, a slightly cryptic call to cmdgfx_gdi is needed, see (2).


2. One problem with the start /B method is that things now sometimes runs *too fast*! The old 'W' flag was unfortunately rather useless since it measured only the time from the beginning of starting cmdgfx to the end. I changed this so that the W flag now writes a file called CGXMS.dat with the current tick count on each frame, and the wait value is then re-read on the next frame, which means the entire processing is regarded in the wait, providing a much smoother result. This way we can ensure both smooth animation and that it doesn't run too fast on faster machines.

So, to use this, this is needed (after the start /B call with cmdgfx):
cmdgfx_gdi "" kf0:0,0,0,0W10
This means: "" use no operations, report key (k), don't actually write any output (by specifying a screen with width and height of 0), and wait a MAXIMUM of 10 ms (counting from the last time the tick count was saved to file), and finally write the current tick count to file.


One more thing to note: pretty much all scripts get a higher speed using this "start /B" technique, EXCEPT the ones that need to use the non-gdi version of cmdgfx, because the effect builds the current screen output based on the previous one (like fire.bat and rotate-expr.bat). This seems to be because of my old nemesis Windows API WriteConsoleOutput, which is just soo slow when the output has many colors that the frame rate is not noticeably improved by running cmdgfx concurrently).


Many of the old scripts were updated to run with start /B, some with synching (W), some not. For some comparisons, run 3dmaze.bat then 3dmaze-noWait.bat, or bezier-col-hires.bat compared to bezier-col-hires-noWait.bat. Other new scripts are hulk.bat (spinning quite nicely in 1280x680 resolution), loader.bat, curve.bat, plasma2.bat, plasma3.bat


Final important note: Start /B can be dangerous! Even more so if combining with the /High or /realtime switches. I have managed to freeze my computer using this, forcing a reboot. In general, only use this technique as a final optimization step (if extra speed is needed) when everything else is functioning in the script, not during development.


Top
   
PostPosted: 10 Jan 2017 06:23 
Offline

Joined: 02 May 2016 18:20
Posts: 227
I added a new 3d GUI script, and a bunch of other new scripts. Archive was updated.

The only new functionality of cmdgfx.exe is the possibility to make a second translation/move for the 3d operation.

Below is 3dGUI.bat. It was primarily meant to be mouse-controlled (drag left-right to scroll among items, click to select an item), but keys are also supported (left/right to scroll, SPACE to select the item in focus). If you get tired of the "swinging" effect of the items while scrolling, press RETURN to disable/enable.

Screens (it obviously looks better when actually moving):

Image
3dgui.bat

Image
3dgui.bat 3dgui2.dat

The script takes as input a data file of the form:
Code: Select all
backgroundimage ; scale
image ; scale ; text ; action
*n

Example file with 3 items:
img\dos_shade4.pcx ; 45
emma.txt ; 9      ;Emma;      echo Emma
fract.txt ; 9     ;Fractal;   echo Fractal
glass.txt ; 9     ;Glass;     echo Glass



Also, I've experimented more with the block operation and managed to get multiple 2d objects moving independently, which means it's posssible to do e.g. bob-flags without precalculation. Also, I tried out jelly-like effects with images, also using the block operation.

See scripts: bob3d2.bat, bob-flag2.bat, bob-flag3.bat, dot-flag2.bat, wave-cube.bat, wave-face.bat, wave-face2.bat

Some screenshots:

Image
bob-flag3.bat

Image
wave-face2.bat


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 79 posts ]  Go to page Previous 1 2 3 4 5 6

All times are UTC-06:00


Who is online

Users browsing this forum: Bing [Bot], ShadowThief and 9 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited