Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flicker free alternative to application.screenupdating

Status
Not open for further replies.
Apr 14, 2004
13
0
0
NL
Hi,

I'm building a 3D first person shooter in Excel at the moment, using autoshapes to draw the environment background (ground, air) and objects (buildings, bad guys, shadows). To get the framerate smooth, i have tried several options, with poor results:

Application.ScreenUpdating

Gives me the speed, but all shapes get repainted when toggling the screen on. Result: blink!blink! etc...

LockWindowUpdate (some API)

Doesn't repaint when toggled off (=good!) but is much slower than .ScreenUpdating.

I'm looking for some code (API?) that gives me the speed of .ScreenUpdating without the repaint.

Any ideas?

Gijs

 
erm - coding a game in VBA - if it's any more than very simple, you'll be lucky. It just isn't designed to do this. Having said that, if you do find a way, I'd love to see it ;-)

Rgds, Geoff

Never test the depth of water with both feet

Help us to help you by reading FAQ222-2244 before you ask a question
 
Agree with Skip. I would like to see it as well. I am not sure if VBA can do similar API manipulation of DCs as VB itself. It certainly would be faster to use a CreateCompatibleDC function (Lib "gdi32") and do your manipulation there, in memory, and then dump it back to the screen in toto. This is much much faster than drawing directly to the window DC.

Some of this is covered in Steve Brown's book "Visual Basic Developer's Guide to the Win32 API".

Good luck. Game development in Excel? Do let us know.


Gerry
 
Well, I've made some improvement with this combination:

LockWindowUpdate (FindWindow("XLMAIN", vbNullString))
Call SendMessage(FindWindow("XLMAIN", vbNullString), _
WM_SETREDRAW, 0&, ByVal 0&)

UpdateObjects

Call SendMessage(FindWindow("XLMAIN", vbNullString), _
WM_SETREDRAW, 1&, ByVal 0&)
LockWindowUpdate 0

However, as you said, using more than say 40 visible objects at once, really slows the framerate.

Using system wide API calls also doesn't pass any beauty contests.

The reason that i am doing this: I want to make games that can be played in a corporate environment without being detected. So:
- No executables, No registry editing
- Only office-extensions (like .xls, .ppt etc)
- Max filesize 200 KB
- All game resources (sounds, maps, etc) should be inside the file or be pre-installed on a corporate machine (such as the sounds from C:\Windows\Media)

So far, i've developed some grid-based games (Tetris, Snake and Mines) for Excel.

Next week i'll try to experiment with virtualDC's etc.

BTW I'd be happy to show you the results of my attempts so far, but i don't see any possibility to mail / attach the file from here. I can point you to a download location or mail the .xls (120 KB) to you. Let me know.

Regards, Gijs

 
using more than say 40 visible objects at once, really slows the framerate.
It's perhaps why DirectX exists...
 
I'm into VBA only for half a year or so, so I've not yet figured out how to call / use DirectX from it. Suggestions are welcome!
 
Interesting - didn't manage to get far and you may have to work on the frame rate a bit but considering it's all in VBA, very impressive !!

Rgds, Geoff

Never test the depth of water with both feet

Help us to help you by reading FAQ222-2244 before you ask a question
 
cewl,

dont know if this is any help but a few other excel games here


I know there is a thread somewhere on this forum where someone posted a few more, but for the life of me cant find it.

Also there is a very weird person out there who does spreadsheet art!

and you thought excel was just for adding up numbers.

Filmmaker, gentleman and [#Error]

 
Excel can do a number of things.

Games?? Have a look here for some of my Japanese friends
games......you would be surprised.


Ivan F Moala
xcelsmall.bmp
 
Hi All,

Thanks for your tips! I liked most of the games you pointed me to. More of my own inventions (or better: re-creations) can be found at:

More games (but as I recently discovered, other people did the same and better)
home.1asphost.com/gijsterbeek/SnakeXL.xls
home.1asphost.com/gijsterbeek/TetrisXL.xls
home.1asphost.com/gijsterbeek/MinesXL.xls

Some Bitmap To ASCII converter
home.1asphost.com/gijsterbeek/AsciiDrawXL.xls

And a BitmapViewer/Editor
home.1asphost.com/gijsterbeek/BitmapXL.xls

>> About this last one i have a question. It takes quite some time to get the image onscreen, because it seems to be impossible to copy an array containing the pixel colors into the .Interior.Color attribute of multiple cells at once. Any solutions?

btw: The BitmapViewer as well as the Ascii converter only swallow 24-bit Bitmaps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top