Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #431

Re: ideas for super mario bros?

Newsgroups comp.sys.apple2.programmer
Date 2012-08-29 16:07 -0700
References (1 earlier) <aa9d119a-f65e-401c-aa20-b7acba951219@googlegroups.com> <8a0a7a48-e956-4f4b-ad95-e2677a68767b@googlegroups.com> <94327602-28af-4fcf-81ae-62f5ceb836c3@googlegroups.com> <46024113-85e4-4981-9977-7416d940c3b9@googlegroups.com> <e05bcfbe-d0a2-4e55-9409-61493adce218@googlegroups.com>
Message-ID <2d95b1f7-af85-4351-9244-6c60e763e92e@googlegroups.com> (permalink)
Subject Re: ideas for super mario bros?
From BLuRry <brendan.robert@gmail.com>

Show all headers | View raw


I like that approach.  After studying the redraw routines from Prince of Persia, I understand that it makes tons of sense to group things into their own buffers, where each buffer has its own sort of priority for screen updates or tracks elements that exhibit different behavior (fixed vs. moving, background vs foreground, etc.)  This allows you to track what is supposed to be redrawn very effectively and make your code a bunch of single-shot loops (which can be unrolled for more speed if needed) rather than a bunch of conditional logic.

Jordan Mechner was a bloody genius.

-B

On Wednesday, August 29, 2012 12:35:42 PM UTC-5, Antoine Vignau wrote:
> You should consider having several buffers:
> 
> - the one with the whole map
> 
> - the one with the region to display (a moving clipped background)
> 
> - another one with the animation steps (it will move like the previous one)
> 
> 
> 
> If you have enough memory, consider having three buffers of the same size and use an index (let's call it X) as the indicator to the first column to display.
> 
> 
> 
> On Tinies or Blockade (despite the fact that there are no moves because everything is displayed on a single screen), there are different buffers:
> 
> - one for the background
> 
> - one for the objects
> 
> - one for the animation steps of each object
> 
> 
> 
> Separating the last two buffers is useful because it limits your sprite collision detection to comparing only few values. The ones from the objects buffer. That way you separate the view from the logic. Logic being the sprite collision detection and the view what you display on the monitor.
> 
> 
> 
> Let's take a shortened example: my sprites have the index 1 to 5, each one with five steps of animation:
> 
> ob (object buffer) :01 XX XX 02 XX 03 XX 04 05
> 
> asb (animation step buffer): 01 XX XX 01 XX 01 XX 04 05
> 
> scd (sprite collision detection):
> 
>   x1, y1: indexes of Mario
> 
>   for x=0 to sizeof(ob)
> 
>     if x1=x then 
> 
>       if ob(y1) has an object then
> 
>         collision, life--, etc.
> 
>   next x
> 
> 
> 
> next cycle:
> 
> 01 XX XX 02 XX 03 XX 04 05 <= same sprites
> 
> 02 XX XX 01 XX 02 XX 02 03 <= animation steps updated
> 
> 
> 
> how to left-scroll?
> 
> 1st- how is my map buffer organized? by column or row?
> 
>   consider a map is 500 blocks wide and 20 rows tall
> 
> 
> 
> by column means the first 20 bytes are column 1, then 20 bytes for column 2...
> 
> by row, the first 500 bytes are for row/line 1, at buffer+500, I'll have the next row.
> 
> 
> 
> calculating the index of the map buffer will be totally different according to the way you store it. Tell me how you do it (I think it is by column like the BASIC version) and I'll make a pseudo-code of the scroll. You'll see if that matches your requirements.
> 
> 
> 
> antoine

Back to comp.sys.apple2.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

ideas for super mario bros? aiiadict@gmail.com - 2012-08-16 22:20 -0700
  Re: ideas for super mario bros? BLuRry <brendan.robert@gmail.com> - 2012-08-17 08:20 -0700
  Re: ideas for super mario bros? aiiadict@gmail.com - 2012-08-20 14:07 -0700
    Re: ideas for super mario bros? Antoine Vignau <antoine.vignau@laposte.net> - 2012-08-21 01:10 -0700
      Re: ideas for super mario bros? BLuRry <brendan.robert@gmail.com> - 2012-08-21 09:44 -0700
        Re: ideas for super mario bros? D Finnigan <dog_cow@macgui.com> - 2012-08-21 17:12 +0000
  Re: ideas for super mario bros? aiiadict@gmail.com - 2012-08-21 22:48 -0700
  Re: ideas for super mario bros? Egan Ford <datajerk@gmail.com> - 2012-08-22 08:34 -0600
    Re: ideas for super mario bros? aiiadict@gmail.com - 2012-08-22 09:49 -0700
  Re: ideas for super mario bros? aiiadict@gmail.com - 2012-08-23 16:59 -0700
    Re: ideas for super mario bros? aiiadict@gmail.com - 2012-08-28 20:24 -0700
      Re: ideas for super mario bros? aiiadict@gmail.com - 2012-08-29 07:55 -0700
        Re: ideas for super mario bros? Antoine Vignau <antoine.vignau@laposte.net> - 2012-08-29 10:35 -0700
          Re: ideas for super mario bros? aiiadict@gmail.com - 2012-08-29 13:03 -0700
          Re: ideas for super mario bros? BLuRry <brendan.robert@gmail.com> - 2012-08-29 16:07 -0700
          Re: ideas for super mario bros? aiiadict@gmail.com - 2012-08-29 18:04 -0700
            Re: ideas for super mario bros? aiiadict@gmail.com - 2012-09-08 09:03 -0700
              Re: ideas for super mario bros? Antoine Vignau <antoine.vignau@laposte.net> - 2012-09-09 14:21 -0700
          Re: ideas for super mario bros? aiiadict@gmail.com - 2012-08-30 09:15 -0700
          Re: ideas for super mario bros? Antoine Vignau <antoine.vignau@laposte.net> - 2012-09-02 13:10 -0700
            Re: ideas for super mario bros? BLuRry <brendan.robert@gmail.com> - 2012-09-02 14:30 -0700
              Re: ideas for super mario bros? aiiadict@gmail.com - 2012-09-03 17:02 -0700
            Re: ideas for super mario bros? aiiadict@gmail.com - 2012-09-03 10:02 -0700
              Re: ideas for super mario bros? Antoine Vignau <antoine.vignau@laposte.net> - 2012-09-03 14:30 -0700
      Re: ideas for super mario bros? aiiadict@gmail.com - 2012-09-05 15:50 -0700
  Re: ideas for super mario bros? aiiadict@gmail.com - 2012-08-29 07:59 -0700

csiph-web