QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: madscijr on May 28, 2021, 03:37:03 pm

Title: Invalid handle error on Screen command after 5 minutes
Post by: madscijr on May 28, 2021, 03:37:03 pm
My program works for about 5 minutes, and then it dies with
Quote
Unhandled Error #258
Line: 7164 (in main module)
Invalid handle
Continue?

where line 7164 is:
Code: QB64: [Select]
  1.     Screen imgScreen&

I've looked through the code and it isn't doing a _FREEIMAGE or otherwise resetting the image handle (that I can see), so I am not sure what's causing this.

I'm attaching my program, in case anyone would like to take a look or try running it.

To reproduce the error, just choose option 3 or 4 (animation test) and wait. You can move around the screen with the arrow keys and if you get tired of waiting press ESC to exit.

Any help or advice much appreciated!

Screen shot:
  [ This attachment cannot be displayed inline in 'Print Page' view ]  

Error message after it runs for 5 minutes:
  [ This attachment cannot be displayed inline in 'Print Page' view ]  

The code and tile sheets it uses:
  [ This attachment cannot be displayed inline in 'Print Page' view ]  

Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: SpriggsySpriggs on May 28, 2021, 03:43:35 pm
I'd recommend doing an _ECHO to a console window periodically and see what the image handle's value is.
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: Richard on May 28, 2021, 04:20:15 pm
Just for fun, I tried running your program with the development build v1.51 5e05664 and error occurs at line 7080 for me (also 28 warnings of unused variables) using menu option 3.

EDIT  and the error came up immediately!
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: MasterGy on May 28, 2021, 04:22:45 pm
I've been looking at the code for half an hour, but I can't see through it. (why don't you use more arrays?)
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: FellippeHeitor on May 28, 2021, 04:31:04 pm
I didn't dive deep enough to understand why you'd need to set SCREEN so often, but just in case try this:

Code: QB64: [Select]
  1. IF imgScreen& < -1 THEN SCREEN imgScreen&

Could it be you're after _DEST instead?
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: FellippeHeitor on May 28, 2021, 04:32:08 pm
Or even:
Code: QB64: [Select]
  1. IF imgScreen& < -1 THEN SCREEN imgScreen& ELSE EXIT SUB
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: FellippeHeitor on May 28, 2021, 04:35:59 pm
Digging a bit further:

Code: QB64: [Select]
  1. imgScreen& = _COPYIMAGE(imgBackground&, 32)

That's generating several copies of imgBackground&, without ever freeing the previous iteration. Your program is leaking memory, like a lot. Check Task Manager while it's running.
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: madscijr on May 28, 2021, 05:21:33 pm
I'd recommend doing an _ECHO to a console window periodically and see what the image handle's value is.
Not a bad idea, thanks.
Dumb question though, how do you open a second console window and _ECHO to it?
I've never done anything like that in QB, but I can see that would be very helpful while debugging.
Thanks again.
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: madscijr on May 28, 2021, 05:28:24 pm
Just for fun, I tried running your program with the development build v1.51 5e05664 and error occurs at line 7080 for me (also 28 warnings of unused variables) using menu option 3.

EDIT  and the error came up immediately!

I wonder what that's all about... did anything in the language change with that version?
I'm just using this version
Quote
QB64 Version 1.5
Stable Release
From git 3043116

Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: madscijr on May 28, 2021, 05:31:04 pm
I've been looking at the code for half an hour, but I can't see through it. (why don't you use more arrays?)

Apologies for the ugly code, this is very much a work in progress.
I'm using arrays, is there anything in particular that isn't using arrays but should?
I am very much a novice programmer (even though I've been programming for close to 40 years in one form or another!)
Thanks...
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: madscijr on May 28, 2021, 05:35:55 pm
Digging a bit further:

Code: QB64: [Select]
  1. imgScreen& = _COPYIMAGE(imgBackground&, 32)

That's generating several copies of imgBackground&, without ever freeing the previous iteration. Your program is leaking memory, like a lot. Check Task Manager while it's running.

Aha! I didn't realize that _COPYIMAGE was actually making a whole new copy,
I thought it was just copying the contents of the source image to the destination image
if it's already instantiated (and would only create a new copy if not).
But we know what assuming does!
What if I put something like
Code: QB64: [Select]
  1. IF imgScreen& < -1 THEN _FREEIMAGE imgScreen&
before that line?

Thank you for the heads up.
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: FellippeHeitor on May 28, 2021, 05:42:50 pm
I thought of suggesting you to do that call to _freeimage before making the copy, but the problem is exactly the line you're getting an error with now: SCREEN imgScreen& will lock the image as the current display image and will error if you try to free it.

Consider having a canvas image onto which you put all your layers, instead of setting SCREEN over and over.

It's usually 1- set screen once; 2- clear and reuse in a loop; 3- set a new SCREEN only if changes are made to size (if $resize is being used).
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: madscijr on May 28, 2021, 05:51:33 pm
I thought of suggesting you to do that call to _freeimage before making the copy, but the problem is exactly the line you're getting an error with now: SCREEN imgScreen& will lock the image as the current display image and will error if you try to free it.

I think I have a lot to learn!

I tried
Code: QB64: [Select]
  1. IF imgScreen&< -1 THEN _FREEIMAGE imgScreen&
  2. imgScreen& = _CopyImage(imgBackground&, 32)
  3.  

and it failed, because it locked the image like you said.

This code doesn't blow up
Code: QB64: [Select]
  1. IF imgScreen&< -1 THEN
  2.         SCREEN imgBackground&
  3.         _Dest imgBackground&
  4.         _FREEIMAGE imgScreen&
  5. imgScreen& = _CopyImage(imgBackground&, 32)
  6. _Dest imgScreen&
  7.  

but it looks awfully clunky.

Quote
Consider having a canvas image onto which you put all your layers, instead of setting SCREEN over and over.

It's usually 1- set screen once; 2- clear and reuse in a loop; 3- set a new SCREEN only if changes are made to size (if $resize is being used).

I am so clueless. What's a canvas image? I thought they were all just images?
The reason I set SCREEN above, is to simply unlock the imgScreen& so I can _FREEIMAGE it, so when I copy the layers onto it, there aren't all those copies.
I am really confused.

Would you maybe be able to post a simple example or point me to one?

Thanks again

UPDATE:
Maybe I am using _CopyImage when I really need to be using _PutImage ... When I get back on the computer I will look that up. Thank you all for being so kind and patient with one so thick headed.

UPDATE #2:
Yep, _PutImage was what I should have been using. Thanks to OldMoses for explaining!
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: madscijr on May 28, 2021, 06:03:01 pm
Your program is leaking memory, like a lot. Check Task Manager while it's running.

Well, at least it isn't crashing after putting in the _FREEIMAGE code.
The amount of memory it's taking up is holding steady at 106 MB in Task Manger.
Thanks for your help!

I still don't understand the difference between a canvas and an image, or how to copy something to the screen without doing _FREEIMAGE on the screen's image handle first (so it doesn't make a new copy) and temporarily changing SCREEN to a different image handle (so it isn't locked up when I do the _FREEIMAGE), but at least the prog isn't leaking memory and crashing anymore.
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: SpriggsySpriggs on May 28, 2021, 06:09:27 pm
Not a bad idea, thanks.
Dumb question though, how do you open a second console window and _ECHO to it?
I've never done anything like that in QB, but I can see that would be very helpful while debugging.
Thanks again.

To make a console in QB64 you need to use the metacommand $CONSOLE. You toggle it ON or OFF with _CONSOLE ON or _CONSOLE OFF. _ECHO allows you to output to the window. So _ECHO "Window Handle: "; STR$(imgScreen&)
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: madscijr on May 28, 2021, 06:48:37 pm
To make a console in QB64 you need to use the metacommand $CONSOLE. You toggle it ON or OFF with _CONSOLE ON or _CONSOLE OFF. _ECHO allows you to output to the window. So _ECHO "Window Handle: "; STR$(imgScreen&)
I'm definitely going to try this, as soon as I am back on the PC.
Thank you!
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: OldMoses on May 28, 2021, 07:51:14 pm
I am so clueless. What's a canvas image? I thought they were all just images?
The reason I set SCREEN above, is to simply unlock the imgScreen& so I can _FREEIMAGE it, so when I copy the layers onto it, there aren't all those copies.
I am really confused.

Would you maybe be able to post a simple example or point me to one?

Thanks again

UPDATE:
Maybe I am using _CopyImage when I really need to be using _PutImage ... When I get back on the computer I will look that up. Thank you all for being so kind and patient with one so thick headed.

Yes, _PUTIMAGE is your friend. You should only have to set SCREEN once and then put images on it, CLS, _DISPLAY, etc.

I think what Fellippe is referring to as a "canvas" would be like the image 'underlay' in the crude example below:

Code: QB64: [Select]
  1. DIM underlay AS LONG
  2. DIM overlay AS LONG
  3.  
  4. underlay = _NEWIMAGE(400, 400, 32)
  5. overlay = _COPYIMAGE(underlay)
  6.  
  7. _DEST underlay
  8. LINE (50, 125)-(75, 275), &HFF00FF00, BF
  9. LINE (325, 125)-(350, 275), &HFF00FF00, BF
  10.  
  11. _DEST overlay
  12. LINE (175, 50)-(225, 350), &HFFFF0000, BF
  13.  
  14. box = -50
  15. SCREEN _NEWIMAGE(400, 400, 32)
  16.  
  17.     _PUTIMAGE , underlay, 0
  18.     box = box + 1
  19.     IF box > 400 THEN box = -50
  20.     LINE (box, 175)-(box + 50, 225), &HFF0000FF, BF
  21.     _PUTIMAGE , overlay, 0
  22.     _DISPLAY
  23.     _LIMIT 50
  24. _FREEIMAGE underlay
  25. _FREEIMAGE overlay
  26.  
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: madscijr on May 29, 2021, 12:04:19 am
Yes, _PUTIMAGE is your friend. You should only have to set SCREEN once and then put images on it, CLS, _DISPLAY, etc.
I think what Fellippe is referring to as a "canvas" would be like the image 'underlay' in the crude example below:

Your example was fine - I replaced all the extra _COPYIMAGE commands with _PUTIMAGE and it works.
Thanks for explaining!
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: madscijr on May 29, 2021, 12:07:11 am
To make a console in QB64 you need to use the metacommand $CONSOLE. You toggle it ON or OFF with _CONSOLE ON or _CONSOLE OFF. _ECHO allows you to output to the window. So _ECHO "Window Handle: "; STR$(imgScreen&)

I tried it, and it's a good way to quickly and easily monitor / debug a program.
Thanks for the tip!
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: TempodiBasic on May 31, 2021, 07:15:11 pm
@madscijr
What is the state of art of your program?
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: madscijr on June 01, 2021, 01:52:51 pm
@madscijr
What is the state of art of your program?

I'm not sure what you mean.
I wouldn't say it's the state of THE art, if that's what you mean, lol.
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: bplus on June 01, 2021, 01:57:48 pm
Yeah, I think he's just asking if you have an update.
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: madscijr on June 01, 2021, 02:07:17 pm
Yeah, I think he's just asking if you have an update.

Aha. Well, the problem this thread was about is definitely resolved, and I will be posting the fixed code, it's just in an "inbetween" state right now... Stay tuned!
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: madscijr on June 01, 2021, 02:54:12 pm
@TempodiBasic @bplus @SpriggsySpriggs @FellippeHeitor @OldMoses

Here is the latest, which no longer crashes now that the _COPYIMAGE has been replaced with _PUTIMAGE.

To try it, choose option 5 from the menu. It now has scrolling!
The exits to the next level (ladders down) are not yet implemented,
so to advance to the next level of the game (not really a game yet, all you can do is walk around),
press <ESC> to return to the menu, then select option 5 again, and it will open to the next level,
with different monsters and a progressively harder maze.

Currently there's a minor but annoying bug where for some reason, a water tile is being rendered to the top left (1,1) space in the game window.
What's weird is that the normal terrain for that space gets rendered, and this other tile gets superimposed over it!
I have no idea what is doing this, will have to track that down.

Note that the code is due for some major cleanup, and there is duplicate code such as 2 main loops -
a mostly disabled main loop from the "50 line Roguelike", and the original main loop from the demo.
All that needs to be merged together, and the game logic needs to be enabled & made working.

Thanks to all of you for your help.
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: TempodiBasic on June 02, 2021, 02:02:42 pm
I'm not sure what you mean.
I wouldn't say it's the state of THE art, if that's what you mean, lol.
Thanks madscijr you have showed me that the same phrase has two different meanings in English and in Italian.
What Bplus says about my message is what the state of the art meaning into italian language... at what point is your work
and here I have learned what this phrase meaning in English  language and its evolution from 1800 to now.
https://www.linkiesta.it/2016/09/lo-stato-dellarte-dallinglese-allitaliano-spiegato-dalla-crusca/ (https://www.linkiesta.it/2016/09/lo-stato-dellarte-dallinglese-allitaliano-spiegato-dalla-crusca/)

It is always a pleasure to learn something new.
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: TempodiBasic on June 02, 2021, 02:17:01 pm
@madscijr
about game... fine, I see you prefer to use black color for background of images.

I you're interested to use different colors as background and you want don't cover background image of the screen with the background of the image by _PUTIMAGE I suggest to you to give a look to _RGBA32 colors and to the related commands for Alphacolor tecniques  here http://qb64.org/wiki/Keyword_Reference_-_By_usage#Colors_and_Transparency (http://qb64.org/wiki/Keyword_Reference_-_By_usage#Colors_and_Transparency).
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: madscijr on June 02, 2021, 03:40:33 pm
@madscijr
about game... fine, I see you prefer to use black color for background of images.

I you're interested to use different colors as background and you want don't cover background image of the screen with the background of the image by _PUTIMAGE I suggest to you to give a look to _RGBA32 colors and to the related commands for Alphacolor tecniques  here http://qb64.org/wiki/Keyword_Reference_-_By_usage#Colors_and_Transparency (http://qb64.org/wiki/Keyword_Reference_-_By_usage#Colors_and_Transparency).

Thanks for the info - that will come in handy. I am using black for the _screen_ background, but the tilesets are actually PNG with transparent backgrounds, and when I was using a non-black (graph paper) background, I think you could see the background underneath the parts that were transparent.
I'm going to look at this again, because I want to layer tiles depending on what is in a given space (eg if someone is walking in a wooded area (trees) that terrain would be rendered _over_ the player tile, versus if they are walking on grass, those tiles would be rendered _under_ the player, etc.)

This is a ways off, right now I'm dealing with more the basic mechanics of making the game playable and fixing bugs.

Thanks again, I am sure I will have some follow up questions when I get to it...
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: madscijr on June 02, 2021, 03:45:25 pm
Thanks madscijr you have showed me that the same phrase has two different meanings in English and in Italian.
What Bplus says about my message is what the state of the art meaning into italian language... at what point is your work
and here I have learned what this phrase meaning in English  language and its evolution from 1800 to now.
https://www.linkiesta.it/2016/09/lo-stato-dellarte-dallinglese-allitaliano-spiegato-dalla-crusca/ (https://www.linkiesta.it/2016/09/lo-stato-dellarte-dallinglese-allitaliano-spiegato-dalla-crusca/)

It is always a pleasure to learn something new.

Indeed it is, that's very interesting.  No worries!
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: Cobalt on June 03, 2021, 01:14:14 pm
One thing you might look into doing that might help the read-ablitiy of your program is creating a data file and loading that rather than setting all the data with in your main program.
For example:
Code: QB64: [Select]
  1.     arrNPC(1, 1).Name = "Child"
  2.     arrNPC(1, 1).TileNum = cTileChild1%
  3.     arrNPC(1, 1).Frequency = 100
  4.     arrNPC(1, 1).Behavior = "it"
  5.     arrNPC(1, 1).Talk = "Are you going to save the people?"
  6.     arrNPC(1, 1).Yell = ""
  7.  
you have over 1000 lines of your main program made up of this data alone, if you moved all that to a second program that saved it to a file you could load from that file with 3 lines as follows
Code: QB64: [Select]
  1. OPEN "NPCDATA.DAT" FOR BINARY AS #1
  2. GET #1, ,arrNPC()

and there you save over a 1000 lines of code, reduce the length of your main program so it is easier to navigate and read, while too allowing easier changing of data at a later date by having it all in one location rather then scattered through out the main code.

You can do that with any BULK data that you use within your game, which could probably reduce your main code by several thousand lines and tens of thousands of bytes. 
A good example of this is my Dragon Warrior clone, if you check it out you will see I have 2 program source files;
--DW1_FullSource.bas  which is the main program,
and a second
--DRAGONWARRIORDATA.BAS which is all the data for the game.

Your project looks very interesting though, can not wait to see it finished.
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: madscijr on June 03, 2021, 02:46:30 pm
One thing you might look into doing that might help the read-ablitiy of your program is creating a data file and loading that rather than setting all the data with in your main program.
For example:
Code: QB64: [Select]
  1.     arrNPC(1, 1).Name = "Child"
  2.     arrNPC(1, 1).TileNum = cTileChild1%
  3.     arrNPC(1, 1).Frequency = 100
  4.     arrNPC(1, 1).Behavior = "it"
  5.     arrNPC(1, 1).Talk = "Are you going to save the people?"
  6.     arrNPC(1, 1).Yell = ""
  7.  
you have over 1000 lines of your main program made up of this data alone,

Thanks for the tip.
I have considered moving the data to separate files, just haven't got there yet (same with reusable functions, separated into libraries).
I always liked code that is "type in friendly" or copy+paste friendly (who in their right mind is going to type in 15,000 lines?!)
and putting everything in one file makes it simpler from that standpoint.
I don't even like having the tilesets & bitmap fonts in separate PNG files!

I get that in some ways it's easier to navigate smaller files,
but it is also more complicated when you have to worry about multiple files and formats,
and manage a project and dependencies. I know one big file with 20,000 lines gives people a headache,
but a project with 50 subfolders and a million files gives ME a headache, lol.
So anyway, that's why it's one big file and my approach so far has been geared toward "all in one".

if you moved all that to a second program that saved it to a file you could load from that file with 3 lines as follows
Code: QB64: [Select]
  1. OPEN "NPCDATA.DAT" FOR BINARY AS #1
  2. GET #1, ,arrNPC()
and there you save over a 1000 lines of code, reduce the length of your main program so it is easier to navigate and read, while too allowing easier changing of data at a later date by having it all in one location rather then scattered through out the main code.
You can do that with any BULK data that you use within your game, which could probably reduce your main code by several thousand lines and tens of thousands of bytes. 

I see your example uses a binary format, which is more compact.
For my purposes, I would prefer to use plain text in a human readable, easily editable format.
Multiple files aren't off the table, but I would prefer for them to be editable as plain text - even the tilesets!

I considered JSON, but I haven't yet seriously looked for any QB64 / QBasic jsonify / stringify functions
(and I don't really want to write them!)
A while back I found Jsonify/Stringify for VBScript and I have used them in VBA,
but they rely on nested Dictionary objects (associative arrays).
I tried creating my own associative array in QB64 few months back,
but it was buggy and clunky, and I haven't been too excited about slogging through that.

Also, although JSON is a simple format for us programmers, it might be too complicated for kids and their parents.
I want this to be editable by non-programmers and kids. I just feel like JSON is simple, but not simple enough.

I might go with your basic DOS config file format, something like
Code: [Select]
Level=1
Name=Child
TileNum=cTileChild1%
Min=1
Max=1
Behavior=it
Talk=Are you going to save the people?
Yell=

Level=1
Name=Child
TileNum=cTileChild2%
Min=1
Max=2
Behavior=it
Talk=Please save us from the monsters!
Yell=


I haven't gotten there yet.
A lot of this program is messy and ugly and inefficient and a WIP, and I'll clean it up as I go.
For now I am just working to get a basic playable game.

A good example of this is my Dragon Warrior clone, if you check it out you will see I have 2 program source files;
--DW1_FullSource.bas  which is the main program,
and a second
--DRAGONWARRIORDATA.BAS which is all the data for the game.

Thanks, I will give it a look!
The next thing I think I need to really figure out is D&D or Ultima style combat,
calculating hit/miss, damage, etc. based on player attributes (strength, agility, etc.),
different weapons, armor, skills, etc.
It's been a loooooong time since I played basic D&D and I don't remember how it worked,
but this should work kind of like classic Ultima or D&D.
There's an article I found
https://datadrivengamer.blogspot.com/2019/09/the-basic-mechanics-of-ultima.html (https://datadrivengamer.blogspot.com/2019/09/the-basic-mechanics-of-ultima.html)
that might help.

Your project looks very interesting though, can not wait to see it finished.

Thanks - so far it isn't that remarkable, but the ultimate goal of this is to create something
that's lets people EASILY and SIMPLY create games that are a mix between classic Ultima and Infocom text adventures
(where they can control how much of the one or the other),
in the form of a construction set - think Electronic Arts' Adventure Construction Set,
but with simpler editing, using text files instead of the clunky joystick interface and the proprietary hidden data file formats that ACS used.
Title: Re: Invalid handle error on Screen command after 5 minutes
Post by: madscijr on June 05, 2021, 12:38:24 pm
@TempodiBasic  @bplus  @SpriggsySpriggs  @FellippeHeitor   @OldMoses

Well, here is the latest version.
It is "playable" in that it lets you walk around the dungeon.
There are still some features that need to be implemented to make it a "real" game.
But my life is getting busy lately and I have to put this down for a bit, and get away from this computer!
So as "closure" I am putting this out there for you to hopefully enjoy.

Controls:
arrow keys = move n/s/e/w
K = climb down ladder to next dungeon
T = talk to NPCs / monsters
L = look (at monsters + objects)
G = get items (currently just treasure chests with random items)
R = ready weapon
W = wear armor
U = use item (currently just healing potion)
0-9 = set up for various temporary test/debugging (reset inventory, increase/decrease hp, etc.)

Not implemented yet:
D = drop item
A = attack
Z = teleport (just to replicate the 50 line Rogue game, won't be in final game)

TO DO:
Drop item is probably the most important since your inventory can become "full".

It's still missing one main feature, which is combat.
The first version would just be a simple Attack command.
If the player has a weapon, they can do damage.
Later the different weapons would cause varying amounts of damage (along with the player's attributes).
If the player has armor, they survive an attack which lowers their hit points.
Without armor, any attack kills the player.
Later the different armors would protect the player differently (along with the player's attributes).

There are a million other features, which are listed in the comments in the code.

The big thing is that it should eventually be a construction set, that lets someone EASILY create their own world and characters and puzzles and quests, kind of a mix between classic Ultima and Infocom text adventures. The Infocom part is not implemented yet at all, but each square on the map should eventually have the same kind of features a "room" does in an Infcom game, with puzzles and triggers, and a simple (2-word verb+noun) parser.

However, another way I might go with this (or concurrently) is that it could serve as a simple "animated map" for pen + paper D&D games. That way the players can walk around in the virtual world on a screen. Maybe 2 laptops hooked together with simple networking would let the DM see the whole map, and the players just see what their characters see. Maybe it would have tools to keep track of the inventory, stats, etc. and do the die rolls and all that. So instead of a full-fledged RPG, it would be more like a D&D "helper" to remove the drudgery? Just an idea.

Enjoy and thank you guys for your help.