Friday, May 6, 2011

Creating the first map layout of Ultima 1 Revisited!!!

Hello everyone,
Back again with new info and new photos…
I just posted some photos of my initial Ultima 1 map layout plus some Basic programming code to go along with it!  This initial layout is only the display screen filled with shapes.  Right now I don’t have the movement completely figured out but I understand how to create shapes, how the shapes are placed on the screen, and how you erase the shapes to move them.
1.    Creating shapes - I don’t recommend you try to create shapes by inputting the data in binary method!  This is way too slow and cumbersome.  Get yourself a good graphics program.  I recommend, and I will be reviewing some of these programs in the future, “Shapes in Colors”, “The Graphics Magician”, and/or “The Complete Graphics System I or II”.  These initial programs are great for creating and storing shapes, shape tables, and full screen pictures.  You can’t edit a shape once it is created but you can erase and recreate with some of these programs.  NOTE – when you create a new shape table be sure to use a large number for the amount of shapes that will be in the table, this way you won’t run out of spaces for shapes and have to create a new table.
2.    Placing Shapes on the screen – There is a lot to this function!  You need to understand the following commands: DRAW, XDRAW, POKE, BLOAD, HCOLOR, DIM(a,b), ARRAYS, ROT, and SCALE.  These commands are directly related to placing, moving, and manipulating shapes on the screen.  If you have a good understanding of these commands and how they work, you will be able to start creating some cool displays that look just like the maps in the Ultima games!!!  These commands also help streamline your program to keep it simple and small.  You should also learn about HGR and HGR2, these two graphics modes let you place shapes in two different screens, which will allow you to show one screen full on shapes or an image while another set of shapes or images are being created in the background.  This helps create smooth animation or shapes movement.
3.    Erasing shapes – To erase a shape you need t use the XDRAW command.  This command will basically “draw” the shape in its opposite color.  In essence, shift it to the opposite color that isn’t being shown on the screen.  When you create a shape you have color limitations due to the TV screen pixel format.  In the Apple  II you don’t get to use any color you want, you are limited to color combinations such as Blue/Orange or Green/Purple.  These color are plotted on odd and even columns within the shapes you create.  So the trees are created in the alternate White because it is made up of green and purple pixels, which you only use the green columns to create the trees.  I know this is weird but it is how you have to deal with the color issue in the Apple computer.  It sucks but you have to get use to it. So, in the tree shape example, when you draw the tree shape to the screen you use white as the color reference and it shows up as green trees on the screen.  Remember that you only used the green pixels when you created the shape in the first place.  To erase the tree shape you have to XDRAW the shape, which draws the shifted shape using the purple pixels.  Since the purple pixels aren’t meant to be seen, they don’t show on the screen and WHAM, no shape! If you want a better explanation then this you can find it in any of the graphics manuals or books that cover it.
There is a lot that goes into shapes and shape tables, and this is the key concept of Graphic Tiles used all of the first five Ultima games! 
With regard to the attached program, I posted and will continue to post all the code I create for this project.  It may not be correct and there could always be a better way but this is how I have learned to do the things you see so far.   Remember that I am learning too as we go along and as I learn things will change and new ideas may come up so be prepared to be pushed into different directions.  I’m not a structured programmer and I like to try different things out when I am testing, this makes for some strange programming examples.  Also remember that this is a project to recreate the entire Ultima 1 game from scratch and since I have no idea how it was created in the beginning, I have no ideas how it will turn out in the end.  We are all at the mercy of Applesoft Basic and my brain!  Be afraid, be very afraid!
Play with the program and experiment by changing thing around.  As I said before, if you create a shape table with a name different than my name of ULTIMA1 then you need to change line 5 do show your shape table name and not mine.  Also, play with different data lines and create your own map layout!  All of the lines within the 5000 block are for the shape image and they represent the order in which they were created.   So when you see a 2 or a 1 or a 5 you should now which shape that number represents.  In my shape table the numbers equate to the following shapes:
1 = plains
2= trees
3 = mountains
4 = dungeon entrance
5 = castle
6 = your character the fighter
7 = Troll
8 = water
Then reason I created the water shapes last is because the first 7 shapes use the alternate WHITE color i.e Green/Purple and you can use 3 as the HCOLOR assigned number.  With the water shape you can’t use white and have to use the Blue/Orange color coding.  All you do is pick the blue pixels when you create the shape and the orange pixels won’t show up when you draw the shape on the screen.  Also its easier to remember that in the 8 shape table, the last shape is blue!  So in the data base section under the 6000 line block, you need to remember to use a 6 “Blue” color code when placing this shape!  So enter the program and play with the data lines and create your own Ultima 1 map layouts!  I would love to see some photos of Ultima Map layouts created by others; you can post them here for display!  Just have fun with it and you will be learning in the process!
So to reiterate, Graphic Tiles in Ultima games are SHAPES, which are placed in SHAPE TABLES!  Research this if you want to find out more on these two key concepts.
COLOR concept understanding is critical when creating new shapes; you must understand which color combos you can use when you create each new shape.  If you get this wrong then your shape will look strange on the screen or show up in a different color than you expected!  Plus, in Ultima the shapes must be create to a size 14 wide by 16 high!  This is a must!  If you don’t create your shapes to this size they will not fit the screen correctly or be spaced incorrectly.  You also need to be consistent when you pick your starting point.  You must use the same starting point for each new shape and they have to start on an odd number.  I use 1 for X and 16 for Y, this seems to work out fine.  If you count the number of tiles on the Ultima 1 map you will see that there are 20 tiles side to side and 10 tiles top to bottom!
The next concept I will be working on is how to create the master map layout.  This means creating the entire map for the Ultima 1 world and then trying to figure out the programming involved to move around the world.  I know this involves using multi dimensioned arrays, i.e MAP(a,b) and large data base lines!  Wish me luck!
As always, if you have any ideas or info that can help me and others please post it here and we can all work together on it.

No comments:

Post a Comment