A Forum all about DOS Batch
It is currently 24 Jun 2017 23:14

All times are UTC-06:00

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

Joined: 02 May 2016 18:20
Posts: 269
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.

PostPosted: 17 Nov 2016 10:27 

Joined: 05 Apr 2015 13:06
Posts: 163
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.

PostPosted: 19 Dec 2016 22:43 

Joined: 02 May 2016 18:20
Posts: 269
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:



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.

Last edited by misol101 on 16 Apr 2017 13:25, edited 4 times in total.

PostPosted: 10 Jan 2017 06:23 

Joined: 02 May 2016 18:20
Posts: 269
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):


3dgui.bat 3dgui2.dat

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

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:



PostPosted: 23 May 2017 04:20 

Joined: 02 May 2016 18:20
Posts: 269
Not a new release (yet), just some notes :) I've noticed that this program has been downloaded a bit more frequently lately, so just to make clear:

1. The current version in the repo and Mediafire does not have any server capabilities. It came to my attention lately that on many machines, many of the scripts in the current archive run quite slowly. This will be remedied in the new version by using server functionalIty (though I don't think I will have the patience to convert all scripts to running with server (and in fact it is not possible in all cases at the moment either)
For an (undocumented) version with server support, you can currently use the cmdgfx executable in the Blockout archive (it may differ slightly from later "officially" released version)

2. It also came to my attention that on Win10 machines (at least), the "setfont" operation of cmdwiz.exe does not work. This means that on some machines, the scripts in the current cmdgfx archive will use the wrong font and/or window size. To remedy this (in the meantime), modify scripts to use carlos utility bg.exe instead (so where it says e.g. "cmdwiz setfont 1" change to "bg font 1" )

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

All times are UTC-06:00

Who is online

Users browsing this forum: Google [Bot] and 7 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