Wisp Engine (ISO simplified)

BlitzMax Forums/BlitzMax Programming/Wisp Engine (ISO simplified)

Diablo(Posted 2005) [#1]
While I've been working on my current project, I have been developing an ISO engine to go along with it to make creating ISO games much easier.

So this is what i've come up with so far...


So far it is made up of 6 files, most of which contain thier own type. Basically I set out to create an ISO engine which you could use just like a 2D tile engine might be used.

You can get it from here: download

The file contains a simple example so you can see how you might use this engine.

enjoy.

BTW, i also intend to add a simple FOW(Fog Of War) system like the one seen here

EDIT: I will add some form of documentation when I get round to it, but for now just look at the source files.

EDIT 2: The controls for the example are:
NumPad : Move (End, Down, PgDn, Right, PgUp, Up, Home, Left)
Left Click : Increase the tiles wall index
Right Click : Decrease the tiles wall index


deps(Posted 2005) [#2]
Nice work!


Leiden(Posted 2005) [#3]
That's pretty cool. I've been following your worklogs and the progress you're making on it is excellent. Keep up the good work!


Diablo(Posted 2005) [#4]
I've got round to adding the FOW system now:


Download the latest version: Download

The FOW system works by simply adding explorers to a map, which ..er explorer the map given thier position. You can attach these explorers to TISOPoints which means that you can attach one to any sprite (-> position(TISOPoint)).


Perturbatio(Posted 2005) [#5]
Nice, I had recently been considering how to do this so I could mess about with never finishing a very basic UFO clone.


Diablo(Posted 2005) [#6]
Its a simple system - its kinda slow on my machine if you have more then one but after seeing the results from the GLvDX tests I guess it will do for now.

You can make it more accurate by changing the following line in 'WispEngine_ISOMap.bmx' under Method UpdateFOW:
For Local T:Float = 1 To 90 Step .5

Decrease the step to somthing lower then .5 and it will be more accurate but at the cost of speed.


ImaginaryHuman(Posted 2005) [#7]
TISO's and FOW systems?????


Diablo(Posted 2005) [#8]
FOW - Fog of War
ISO - Isometric


xlsior(Posted 2005) [#9]
And as an extension to that: 'Fog of War' = obscuring portions of the map where the players units are not currently present.

e.g. the black or darkened areas on the map in a game where you can't see what's happening or whether or not any enemy units are present.

In real life, 'fog of war' refers to gunpowder smoke during a battle, obsuring the view of the battlefield from the enemy army.


Diablo(Posted 2005) [#10]
I've done some kind of documentation now.

Download the latest version: Download

Also i added a _frame to TISOSprite.render so that you can, you gussed it, render different frames.

Enjoy.


Pavlov(Posted 2006) [#11]
I created a graphics directory for the graphics and a maps directory for the maps and compiled the example on windows and was smooth as butter. Very nice.

Tried it out on the mac and got an "Unhandled Exception:Attempt to index array element beyond array length" error.

After doing some digging I found that in the TISOMap.Load method the

width = ReadInt(Stream)
Height = ReadInt(Stream)

lines both returned 1342177280. Any ideas why?


Diablo(Posted 2006) [#12]
i think it might be todo with the Endian streams or somthing like that. Unfortnaly i dont have a mac so i can only guess. I'll have a read and try and fix it blindly. if you do happen to fix it feel free to release/upload a max version.


Diablo(Posted 2006) [#13]
right, try this:

If Not Stream Then Notify("Could not load '" + _file + "'!"); End
?win32
Stream = LittleEndianStream(Stream)
?mac
Stream = BigEndianStream(Stream)
?


put the above after the line:
Local Stream:TStream = ReadFile(_file$)


i did try out on win32 using bigendianstream and i got the same error so i can only guess this will work (not sure if ?mac is right???)

EDIT: cant upload anything right now but if you say this works then when i can i'll complie and upload a new version later.

EDIT2: Oh and make sure you have the most uptodate version by clicking the link in my sig. (its held on a different service so its direct and you dont get linked to some savefile thingy. i'll change the link at the top right now for conviance.


Pavlov(Posted 2006) [#14]
The change was pretty minor, tried LittleEndianStream on both the Mac and Windows and it worked great.

Local Stream:TStream = ReadFile(_file$)
If Not Stream Then Notify("Could not load '" + _file + "'!"); End
'Stream = BigEndianStream(Stream)
Stream = LittleEndianStream(Stream)

The only other change I had to do to get it working was comment out the BufferedD3D7Max2DDriver command. Kept it as GLMax2DDriver on both Windows/Mac and it worked on both platforms. I got 70 fps on a 1 ghz Mac with 32 meg video.

'SetGraphicsDriver BufferedD3D7Max2DDriver()
If _useOpenGL Then SetGraphicsDriver GLMax2DDriver()

Any idea when the editor can be released?


Diablo(Posted 2006) [#15]
mmm i wasnt realy going to release an editor but if enough request it then i will, remember this is free so i'll only do it if i can get the time.

Changes duely noted and i'll try and upload a new version tomorrow if i can.

The idea behind this was only to make it easier to use an iso coord system and make it easier to render iso.

I got 70 fps on a 1 ghz Mac with 32 meg
Is this good? i got about the same on my nvida SLi setup (2 128mb) but i think thats because max2d doesnt fully support sli, could be wrong.


Pavlov(Posted 2006) [#16]
I like what's been written, it's a real time saver for anyone wanting to do iso on blitzmax for both windows and now the mac. As far as the code/editor being free, in short, if people don't like it and can come up with something better, let them. Looking forward to trying out the editor.

There's two ideas that's been rattling around in my head that involve ISO and this would fit nicely.

TIA


deps(Posted 2006) [#17]
I had the bigendian/littleendian problem too, and this is a prettier solution imo:
Local Stream:TStream = ReadFile("littleendian::"+_file$)

WriteFile needs the littleendian prefix too.


Diablo(Posted 2006) [#18]
i'm having trouble uploading at the mo but thanks for the code deps.


Diablo(Posted 2006) [#19]
ahh finally, i have up loaded the new version. Thanks for that deps, cant test if it works on mac so if you have any problems just say or fix and say so i can update it - i will mention in help docs and in source or somthing.

I think i also fixed a minior other issue that it would make the mouse over tile blue in the actualy render part i just got rid of the line. if you want to higlight a tile use map.tiles[x,y].highlight = true i think :?.

Thanks anyway.

Download


Pavlov(Posted 2006) [#20]
Just curious, if you don't have an editor, how did you make the test level?


Diablo(Posted 2006) [#21]
ez, left click to increase wall index, right click to decrease wall index - s save - l load - I tho i put that at top of source.

if thats all you wanted from editor simply comment out this line
currentMap.CenterOn(mySpriteHolder.sprite.position)

its a couple of lines above the main loop.

BTW i noticed i didnt put that in source, sz.

EDIT:
ummm dont worry if that didnt work i'll fix it later.


this is a bit unstable at the mo. i did code this late at night. i'll get some sleep and try to fix it with a new release.


Dreamora(Posted 2006) [#22]
works good here. Only the control method with direction keys not beeing aligned to the grid direction is a little bit annoying because getting through "doors" is a little hard. (don't have a num pad here on notebook)


Pavlov(Posted 2006) [#23]
Reading docs isn't one of my strenghs but it works and it's pretty nice. Definitely enough to get started.


Diablo(Posted 2006) [#24]
(don't have a num pad here on notebook)

so am i ;)

righto,
well i have begun work on a new version and so far what i have added is a tileset type which each map will have. a tileset basicaly is made up of a imageSet which stores all the tile images (means walls wont have to be in seperate image) and also an array of flags which give each tile properites e.g blocked north entry and so forth.so if you loaded an image with 10 tiles in it, it would size the array to 10 units which you can then alter the flags for.

I think a chage in the map tile data will happen too, the change will make it faster i hope but i'm still working on ideas for that.


Diablo(Posted 2006) [#25]
this new version should be done by the end of the week and at the very latest monday. It should be much faster as well because thiers only one loop through.

I'm thinking of a way to make tiles different heights but that shouldnt be to hard. while i'm doing this version i'm making an editor (which i'm using to test it with).


Snader(Posted 2006) [#26]
Looking good Diablo!


Diablo(Posted 2006) [#27]
heres a screenie of the editor so far...


The window on the front is the tileset editor which you use to change the flags of each tile as given by the two list boxes on the right. you simply select an item on the far right box and then click add and then that flag gets added and thesame to remove a flag. Its taken a bit long to create this 'simple' part of the editor then i thought, the tileset editor is basicaly done tho the next thing i think is the map painting stuff.

As far as the actual ISO engine code, well thats basically done. you can see on the above a list of layers - at the mo thiers no real use to add or remove layers (in fact i'd advise not too) but its there for future developments.

I'm going to hold of having 'heights' and release the new version as it is after some more testing and once the editor is done.

well back to work...


Pavlov(Posted 2006) [#28]
Nice, it's really coming together.


Defoc8(Posted 2006) [#29]
this is looking good...very good :]


alain(Posted 2006) [#30]
I just downloaded it, and it seems to be great, exactly what I need for my project.

thanks for your work!

I'm waiting for the editor ;)


Diablo(Posted 2006) [#31]
*UPDATE*

- Uses the new system
- Some method/function changes
- Hopefully faster
- Includes Editor

Download

I have to update the documentation and create some for the editor but this is what you need.

I know its a bit buggy but i said i'd release it today at the latest so here it is, over the next few days i will iron out the bugs and update it.

enjoy.

EDIT: i should tell you how to navigate the map (forgot) make sure that it has focus(click it) and then hold space and right mouse button, move the mouse and the screen should move with it.


Pavlov(Posted 2006) [#32]
This is interesting, I can see where you're using the default graphics path

	Function DefaultSet:TISOTileset()

		Return Create(defaultGraphicsPath + "defaultTileSet.bmp")
		
	End Function


but for some reason defaultGraphicsPath is set to "C:\Documents and Settings\All Users\Documents\Laptop backup stuff\Blitzmax Projects\Wisp\In Dev\Gfx\defaultTileSet.bmp" (probably from your machine). Can't see where this is hard coded or where this is coming from in the app. Pretty wild, I'm baffled. probably coming from the map file Test1.imd.


Diablo(Posted 2006) [#33]
yup my bet, sorry i try to fix it. its done to request file.


Pavlov(Posted 2006) [#34]
yup, it's in the default.wts and default2.wts.


Diablo(Posted 2006) [#35]
*updated*

I'm really tired now :). Test this quick please and tell me if its fixed.

BTW - You now have to set default paths which hopefully make it all relative (as everything should be ;) - check game test to see what i mean.

download


Diablo(Posted 2006) [#36]
*update*

- fixed save map

Thats your lot for tonight.

Download


Pavlov(Posted 2006) [#37]
The test level worked like a charm on both Windows and Mac. Kudos to you.

How does one create a .wts file to point to a tileset? How do you scroll around in the editor?


Diablo(Posted 2006) [#38]
How do you scroll around in the editor?

EDIT: i should tell you how to navigate the map (forgot) make sure that it has focus(click it) and then hold space and right mouse button, move the mouse and the screen should move with it.



How does one create a .wts file to point to a tileset

Go into the tileset editor - load a tileset and the close it - the map should now use the new tileset.

I just found a bug while seeing if this works, i'll fix it right now.


Diablo(Posted 2006) [#39]
*UPDATE*

- Fixed list update woes(mabey not all of them)
- Added scroll bars to the map main canvas (use them instead of old method - mouse movement is not yet snyced with scroll bars)
- Saves file names instead of paths

Download


alain(Posted 2006) [#40]
thanks for your updates.

I'm building an Iso-RPG and your engine/editor is veeery useful for us.. thanks again.


K@li(Posted 2006) [#41]
link dead


Diordna(Posted 2006) [#42]
Yeah, and I wanted this too...:-(

Anyone have a copy they're willing to send to me?


Diablo(Posted 2007) [#43]
Somone emailed me last night so I thought I might post this here.

You can now download wisp from here:
http://www.fallenmoondesign.com/dump/Wisp.zip

The editor is buggy but the actuall engine works fine. Have fun.


kog(Posted 2012) [#44]
ReUp?