Saturday, September 29, 2007

Let's make a piano

Ultima Online is now 10 years old and I stumbled upon this post by Damion Schubert. He describes some unplanned uses of the game that gave a "magical" touch to UO.

My attention has been caught by how players found a way to build a piano by using shirts and a chess board. While I never played UO myself, I've seen similar creativity in SWG. In fact, some players dedicate quite some time just to build stuff that wasn't planned in the game. All of this comes down to players' freedom and I realized how I could a bit more freedom in my project.


I use a very rigid x,y coordinates system when it comes down to deal with items positions. You have to see it as a grid and all items are contained in a cell (or more if they're bigger but their positions are relative to the cells). So if I want to see a player made piano in my game one day, I'm not helping players here by restricting how items are shown.

By now, it seems pretty clear that my game will be all javascript and CSS, Flash being just too expensive for my wallet and learning it could be a good way to never see the end of this project. When an item is displayed, I received coordinates from 1 to 15 horizontal and 1 to 10 vertical (just the current size I'm using, this could change). I multiply the coordinate by 50 (cells are 50x50 pixels) and there I have where the item will be displayed. What if I could add an offset notion?

I created a new table containing offsets for each items. The values contained in this table are pixels. This way, I pass the coordinates of each object to the client with the offset. The pixel position is calculated and then I apply the offset, allowing items to be placed wherever the player want it to be. With the pixels offsets, I added an offset for the Z-Index that will affect on which layer the item will be shown.

Players will use the /offset command to change those values. To move a chest 30 pixels to the left, just type /offset x -30 and the chest will appear 30 pixels to the left. Of course, not all items will be allowed to be moved like this. Only items with no elevation (no collision) will be allowed to be moved this way to prevent any abusing.

There it is, a way to build a piano! Not the kind of thing that was part of my priorities list but considering how little time it took me to code, it was well worth it for the possibilities this might open.

3 Comments:

Anonymous said...

Oi, achei seu blog pelo google está bem interessante gostei desse post. Gostaria de falar sobre o CresceNet. O CresceNet é um provedor de internet discada que remunera seus usuários pelo tempo conectado. Exatamente isso que você leu, estão pagando para você conectar. O provedor paga 20 centavos por hora de conexão discada com ligação local para mais de 2100 cidades do Brasil. O CresceNet tem um acelerador de conexão, que deixa sua conexão até 10 vezes mais rápida. Quem utiliza banda larga pode lucrar também, basta se cadastrar no CresceNet e quando for dormir conectar por discada, é possível pagar a ADSL só com o dinheiro da discada. Nos horários de minuto único o gasto com telefone é mínimo e a remuneração do CresceNet generosa. Se você quiser linkar o Cresce.Net(www.provedorcrescenet.com) no seu blog eu ficaria agradecido, até mais e sucesso. (If he will be possible add the CresceNet(www.provedorcrescenet.com) in your blogroll I thankful, bye friend).

Crwth said...

Originally in UO, people had to adjust offsets by using other items beneath that either got occluded by the objects on top, or that could be removed once the topmost object was locked down (locked-down items weren't affected by gravity).

Years later, the developers added an in-game object that could be used to increase or decrease the offset of an item without the need for fancy stacking tricks. Context menus would have been nicer, as raising or lowering an object involved 'use-tool-and-target, use-tool-and-target' over and over.

Over00 said...

Thanks for the info Crwth. Having never played UO myself, I'm always interested to learn more.

I'm currently working on the interface and there's a context menu attached to the right-click on each item with options like /take, /look, ... The offset functions will probably be included in this menu as well to make this manipulation clean, easy and fast.