Author Topic: Tutorials or examples for beginners ?  (Read 585 times)

MrTimscampi

  • Newbie
  • *
  • Posts: 3
Tutorials or examples for beginners ?
« on: May 01, 2013, 03:06:53 PM »
Hi :)
I want to start PC Engine development but, honestly, documentation for HuC is quite scarce compared to what I'm used to :D (I'm a university student doing mainly Python and Java.)
I'm able to do VERY basic stuff like a Hello World, but that's as far as I can go with what I found online. Everything is either very basic (Show text) or forum topics discussing topics too advanced for where I am :-s
I'm trying to display a sprite at the moment. My goal is to work my way to a basic shoot em' up and go from there.
I have a 32x64 .PCX file in 16 colors (made in Photoshop) and I'm using this to load it:
Code: [Select]
#incspr(player, "sprites/player.pcx", 6)
#incpal(player_colors, "sprites/player.pcx")
Then I copied some things from example sources I've seen, but nothing shows up.

I don't know if this is correct, because I couldn't find any doc for it online... (I ended up on Obeybrew a long time ago when I tried to start programming for the PC Engine, but the site is now down and I can only access a cached version for parts 2, 6 and 7.)

Any link to a backup of the Obeybrew tutorial, any source that just loads a sprite and shows it (Ideally, with lots of comments :D) would be appreciated ;)

Thanks in advance :)

Edit: I've also tried to convert a 4bit BMP version of the file using bmp2pce in sprite mode and loading the GFX and PAL, but I get an error at compilation saying that my image is too small and needs to be at least 16x16.
« Last Edit: May 01, 2013, 03:09:56 PM by MrTimscampi »

TheOldMan

  • Hero Member
  • *****
  • Posts: 958
Re: Tutorials or examples for beginners ?
« Reply #1 on: May 01, 2013, 03:37:23 PM »
#incspr() and #incpal() only convert the graphics to a pce compatible format - they do not load anything. You have to do that in your code.

Check out the game samples at Aetherbyte. They should show you the basic steps, especially how to set up graphics for use. Most of what you need to do is in initialization functions that are called once before the main loop; step through what they do, and look the function calls up in the HuC documentation. That should give you an idea of how to do what you want.

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: Tutorials or examples for beginners ?
« Reply #2 on: May 01, 2013, 03:37:41 PM »
http://www.aetherbyte.com/pce_proto.html

Here is an open sourced little thing with a few demo games that show alot of things.
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

MrTimscampi

  • Newbie
  • *
  • Posts: 3
Re: Tutorials or examples for beginners ?
« Reply #3 on: May 01, 2013, 06:53:34 PM »
Thanks for the links and quick answers :D
I'll look into all of that and try to make it work :p (I was already loading the sprites using load_sprites() and other functions to set it's position, priority, etc. but the screen was still all black xD )

TheOldMan

  • Hero Member
  • *****
  • Posts: 958
Re: Tutorials or examples for beginners ?
« Reply #4 on: May 01, 2013, 07:43:26 PM »
Quote
...the screen was still all black.

Install and read up on mednafen. It has a debugger where you can see what is in VRAM.
Make sure your sprites are there, where you think they should be.

Also, check your pcx file  (in something like the gimp). Phototshop has been known to flip the palette :(
The Gimp can flip it back for you.

MrTimscampi

  • Newbie
  • *
  • Posts: 3
Re: Tutorials or examples for beginners ?
« Reply #5 on: May 01, 2013, 09:46:45 PM »
Managed to get my sprite on screen and move it with the pad :p
My code was working, but Photoshop screwed with the PCX and it wasn't working :p

I'm now making my sprite shoot other sprites. I think I'll allow 3 shoot, so I'll have 60 sprites left. (Player + 3 shoot = 4, I can have up to 64 on screen according to the documentation.)
I have one shot firing properly, but I can't find how to hide the sprite when it goes past the top of the screen :p
I know about the spr_hide function. My condition just isn't working :)
I'll keep working on it and I'll find where I'm messing up :p (As implied before, I'm familiar with C, but not a lot ^^ This is a good way to learn, though. HuC is fairly straightforward once you've read up a bit about it.)

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: Tutorials or examples for beginners ?
« Reply #6 on: May 02, 2013, 03:28:48 AM »
Don't use Photoshop.

Find yourself a copy of NeoPaint if you want to deal with PCX files the right way.

Or, Grafx2.  http://code.google.com/p/grafx2/wiki/Downloads
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

nodtveidt

  • Guest
Re: Tutorials or examples for beginners ?
« Reply #7 on: May 02, 2013, 07:48:26 AM »
I have one shot firing properly, but I can't find how to hide the sprite when it goes past the top of the screen :p
I know about the spr_hide function. My condition just isn't working :)
What I do is move a sprite to 256,256 when it's "out of range". Make sure you use ints for sprite coordinates, not chars.

TheOldMan

  • Hero Member
  • *****
  • Posts: 958
Re: Tutorials or examples for beginners ?
« Reply #8 on: May 02, 2013, 08:14:49 AM »
We use a sprite_active flag. Init it to 0 (off), set it to 1 when you shoot.
When it goes off the screen, or hits something, change it back to 0.
Then in the sprite draw code, we check the flag: if it's 0, we hide the sprite and return (no use wasting cpu time moving an invisible sprite).

Check through your code and make sure you are not inadvertantly turning the sprite back on somewhere :)


Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: Tutorials or examples for beginners ?
« Reply #9 on: May 02, 2013, 09:00:12 AM »
Yep.  This also allows you to dynamically allocate sprites that are on screen so you don't have finitely set things.

It's pretty awesome.  Atlantean does that.
« Last Edit: May 02, 2013, 09:03:50 AM by Arkhan »
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

dshadoff

  • Full Member
  • ***
  • Posts: 175
Re: Tutorials or examples for beginners ?
« Reply #10 on: May 19, 2013, 02:57:52 PM »
I want to start PC Engine development but, honestly, documentation for HuC is quite scarce compared to what I'm used to :D (I'm a university student doing mainly Python and Java.)
I'm able to do VERY basic stuff like a Hello World, but that's as far as I can go with what I found online. Everything is either very basic (Show text) or forum topics discussing topics too advanced for where I am :-s


Have you looked at the Zeograd.com 'creations' pages ?
http://www.zeograd.com/creation_download.php
Many of those programs were written with comments for the purpose of being tutorials.