Store › Forums › Hackvision › Game Development › TVout Drawing
- This topic has 7 replies, 2 voices, and was last updated 12 years, 3 months ago by trodoss.
-
AuthorPosts
-
September 18, 2012 at 5:40 pm #494moeMember
Hello, I’d like to ask how other developers draw things like arrows, pictures and such…
Is there any program which does this automatically? Or is there a “Cheat Sheet” on how to draw? I’d like to have space ships and such… I also tried to draw a simple “[” but unfortunately I couldn’t bring my mind to screen… It’s a little bit complicated for me, because “TV.draw_line(20,48,100,48,1);” doesn’t say much about the direction and such. I just can’t think of the final product this command gives.
Maybe there’s a coordinate system or a handy little tool for that? I would also be happy with a pseudocode because then I could program it my own (Python, Java, etc.)
Thanks!
September 19, 2012 at 3:29 am #1014trodossMemberHi,
I use the “bitmap” functionality a lot, since it is a little easier (for me) to think that way.
There is some information about the bitmap functions here:
http://code.google.com/p/arduino-tvout/wiki/BitmapsImage2Code is one of the applications you can use to create bitmap graphics. You can find it posted here:
https://forum.crystalfontz.com/showthread.php?5854-Image2Code-bitmap-to-source-code-converterI ended up having to code my own utilities to do the same sort of things. I attached an application that can convert bitmap images into the same sort of format. You may/may not find it useful, depending on what you want to accomplish. It is a simple command-line utility. If you look at the included .bat file you can see how to specify the input image size (default is 8×8).
Hopefully at least some of that helps.
–trodossSeptember 19, 2012 at 3:41 am #1015trodossMemberHi again,
My bad. You were asking about vector graphics and all I mentioned was bitmap graphics…
I don’t know that there are any specific TVOut-oriented vector graphics programs, however I think Inkscape should be capable of what you would want to do:
http://inkscape.org/I am fairly sure you would be able to at least convert the output into the appropriate graphics primimitives used in TVOut.
Hopefully *that* will help.
–trodossSeptember 19, 2012 at 2:46 pm #1016moeMemberWow thanks a lot trodoss for your quick reply and effort!
I’ve already came up with a solution for the “[“, but your answer concerning the bitmaps does help me a lot! I soon will decorate my title screen with a nice picture 😀
So yeah thank you really much, I hope if I’ve got any other question you’ll help me!
Is there any way to contact you via skype or such? Just for talking about Hackvision or little Code related things… I’m also ok if you’d say “No”
September 19, 2012 at 6:00 pm #1017trodossMemberGlad to be of help!
The easiest way to contact would be PM’ing on this site, or, if you could post your questions on the site and you might have a chance of a few more people to help answer your questions. I have created a few Hackvision games, however Michael is by far the expert on the platform, and I am sure he would have good input/advice to give as well.
Sounds like you may have a finished game to show soon, which is great!
–trodossSeptember 19, 2012 at 6:32 pm #1018moeMemberUnfortunately I think the game will take longer than you expect because I just have built the title screen and some little things, and I’ve not started developing the game yet… 😛
I might have a big problem because everything I do have now already takes up 10.000 Bytes of 30.000 Bytes available. I don’t have any feeling for storage on the Hackvision platform, do you think my entire game will have enough free storage? Just asking because you already developed 2… And yeah if this would really happen, how can I save storage (without removing too much) and which things take up the most space?
Thanks!
September 19, 2012 at 6:58 pm #1019trodossMember@moe wrote:
Unfortunately I think the game will take longer than you expect because I just have built the title screen and some little things, and I’ve not started developing the game yet… 😛
That’s ok. It is progress 😉
I might have a big problem because everything I do have now already takes up 10.000 Bytes of 30.000 Bytes available. I don’t have any feeling for storage on the Hackvision platform, do you think my entire game will have enough free storage?
It depends on what you are doing and how you store it.
One thing I would recommend is think about how you can break up your images into re-usable parts (tiles/blocks/etc.). It is easier to store them that way, and works well with the bitmap functions. I try to keep the tiles 8×8 in size, and only store what is needed.
[attachment=0:8yzyfo9k]elf_images.png[/attachment:8yzyfo9k]
(Elf images above, how 3 “blocks” can make up 2 “frames” of animationAre there a few things you can cut out? Sure. If you are not using fonts, then do not include them in your sketch. Technically, I think if they are not “referenced,” AVR-GCC will try to leave them out, however you can just opt not to compile that in and it will save you a little bit of storage.
If you really get in a pinch though, you can resort to compression. Since most of the data needed by TVOut is going to be simple bits, you can use “tricks” like RLE (Run-length encoding) to package a really big image into a much smaller space.
As far as other game data, if you could provide more details on that it might be easier to give a few suggestions.
–trodoss
September 20, 2012 at 3:46 pm #1020trodossMemberHere are a few numbers that might help give you a little better idea of how much space is there (and what might be needed)
Elventure – 18,716 bytes (out of 32,256 bytes)
Poofy Adventure – 18,466 bytes (out of 32,256 bytes)
Either of those games are around 18-19Kb in size, so not terribly huge. There would be lots of “room” to expand them.
#include
#include
#include
#define TVwidth 128
#define TVheight 96
TVout TV;
void setup()
{
TV.begin(_NTSC, TVwidth, TVheight);
TV.select_font(font4x6);
TV.delay_frame(60);
}
void loop()
{
}
Just a “basic” sketch that uses TVOut and includes a font takes up about 5,096 bytes.
Without an included font, the same TVOout sketch takes up about 4,054 bytes.So, to use TVOut there is some overhead (about 4.5-5 Kb), however that is not terrible. The 10Kb size you have right now doesn’t seem to be really out of line for a TVOut-based sketch.
Provided that graphics are stored in code (and not in memory) you have a lot of “space” for graphics/logic. Depending on how you code your programs, you should also have room for logic. Compiled code from the AVR-GCC is relatively compact, so if you expect your game logic to be around 10Kb, then you should have enough space to work with.
Any “game data” that you plan on storing (like maps, text, etc.) you end up having to come up with a storage strategy that “fits” what you are doing. If you know you are going to use a lot of text, breaking it up into re-usable words/fragments is important. If it is just “SCORE” and “GAME OVER”, that likely isn’t necessary 😉 However, if you are making say a text-based adventure (a “Zork”-like game), you are going to want to “pack” text as tightly as possible (tokenizing, or LZW-like compression). There are similar strategies for vector-based graphics or bitmap-based graphics. It is all a matter of finding what “fits” for your particular project.
So, is 32Kb “enough” space? It is for some things, but certainly not everything. For arcade-style (classic 80’s) games it should work fairly well, and with a little planning you can make all sorts of games.
Hopefully that gives you a little more explanation.
–trodoss -
AuthorPosts
- You must be logged in to reply to this topic.