Computer Science Canada Multi-Sprite Loader |
Author: | GreenTiger [ Sat May 01, 2004 7:15 pm ] |
Post subject: | Multi-Sprite Loader |
Okay dudes, this is another kinda obscure question for you dudes. Despite my computer's sorry state, I decided I could at least spend time programming. I was working on my isometric manager, specifically the sprite loader, I've attached the neccessary files in a zip file. <Note how it's coded in STILL 3.11...the only version I had on my C drive before this bad crash...> Anyways, I want to load somewhere in the order of magnitude of under 35*35 tiles of of around 16 differant types. I'll go through this slowly. The three main types of landscape I'll have a blocks, toppings and liquids. Blocks are normal ground that you stand on, liquids you float on and toppings you just walk through. The values for these blocks will be stored in an 35*35 array where the first dimension represents the tileset (ground, ice, water, ect) and the second dimension represents the tiletype (square block, slope, ect) Because there's so many blocks, each block tileset (there's 8) will need to take up two rows, so ground will get both 1 and 2, ect. Although I hope to get liquids to animate, both them and toppings should only take up one tileset...I'll explain that MUCH later because right now, my program isn't even working up to there. Okay, now my isometrics was working just FINE with just ground, or just one tileset, but now I've got to load them all in. Now a step back for a second, why a 35*35 array? The map format I made, perhaps it was a mistake to make it so complex, but it's too late now because I've made some major maps with it already (a sample map has been included, but it's not one of the ones to be used in the game) In the maps, two characters represent a block 001100 would be a square ground block surrounded by air. These characters can go to 1-9 (0 always means nothing) and A-Z, almost like Hexadecimal, but expanded. I've called it OmegaNumerics...but the name really isn't that important. Anyways, so the isometric map reader reads the blocks in the map and draws a sprite in the isometric position of that block with the picture of that block. That all works fine; except sprites get loaded into the wrong position. This is where I need help. The sprite loader, I want to load around 1000 sprites or so with as little coding as possible. So I did loops, and now I've gone loopy over it all and I'm as confused. Something isn't working right. I need a second opinon on what I'm doing wrong. I isolated the SpriteLoad procedure into a seperate file for easier access because getting the finalworldformer to run the isometric.tu (which contains the spriteload proc) takes WAY too long. so yeah, I could use some help. Right now, I'm just interested in getting those two differant landscapes loaded, ground and desert, (which will take up four rows, two each, but neither one take up the entire row either...and they take up differant amounts. It sounds confusing now (any maybe it's just how I wrote it) but it SHOULD (hopefully) make sense when you look through. Thanks in advance. I'll credit you guys for your help. And feel free to use the sprites included or the code as long as you credit me. <EDIT: The attachment thingie wasn't working so I uploaded it to my site (a pain in the butt with my comp as it is...no ftp clients) so it is now available at: www.ccc.horizonhouse.ca/compsci/early_v.zip |
Author: | Delos [ Sun May 02, 2004 8:01 am ] |
Post subject: | |
Actually, your .zip is not available! Well, let's see anyway...I'm no expert in isometrics, but I've had my share of time with pictures. If you are using straight .bmps or .jpgs you can always do the whole pic#.bmp trick to speed up the naming and loading of the pictures. You could setscreen ("offscreenonly") and load pictures to a hidden canvas... From what you've said it seems as though you are having problems loading a large number of pictures/data files? Well, my guess is that you could use types and records to unify each sprite...but I'm sure you're already doing that. You mentioned that you were getting looped out of your mind...if all the loops are doing is to load pictures you shouldn't need more than one or two nested - at most (save for cases of multiple directory levels). And you're in 3.11? Correct? And you are using Turing Sprites? Well...you may not get as much help as wanted as, as you must know, Sprites don't work in 4.0+. So in that respect you may be a bit on your own, but I'm sure some of the more senior ppl around here could give you a hint or two with regards to 3.11. Or just switch to DanSprites. Or make your own. Get your zip up and running and I'll check it out. |
Author: | GreenTiger [ Sun May 02, 2004 8:51 am ] |
Post subject: | |
Ooops...sorry about that...misspell http://www.ccc.horizonhouse.ca/CompSci/early_v.zip keep forgetting the capitals in my websites' folders... Anyways, yeah, my problem isn't with displaying the sprites, they work just perfect. My problem is loading the pictures, because I have a total of three loops around there because the differant tilesets are in differant directories. The zip should give you a pretty good idea now that it's location is spelled properly. |
Author: | Delos [ Sun May 02, 2004 11:22 am ] | ||
Post subject: | |||
Ok...I have the programmes now...(without .t endings, just to make my life difficult!) And I looked at them...and didn't understand much of what I saw... So:
This shouldn't be too difficult to follow. I've commented it to death...so...yeah. Hope that helps...tell me if it does...I've set it up so that you can play around with it quite a bit...I don't think any important parts are hardcoded. Note: I used 3 flexible arrays here as opposed to one 2dim array because I figured that you won't always have equal numbers of each type of pic...thusways you won't have to precheck the contents of every element before use. |
Author: | GreenTiger [ Sun May 02, 2004 12:26 pm ] |
Post subject: | |
Yeah, thanks for that, I"ll try it out. Sorry about the lack of commenting, I usually have really good commenting, but I put it in after my proggy's working PERFECTLY...which is not nearly the case yet... Flexible arrays...why didn't I think of that. Genius, you guys, thanks. <EDIT: Just BTW, I think I figured out another method to do it, kinda halfway between yours and my original one (except it works, unlike my original one!) Thanks again!> |