Author Topic: The Slime  (Read 17409 times)

0 Members and 1 Guest are viewing this topic.

Offline thydowulays

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 184
  • Rating: +12/-1
  • Don't gimme dat lip
    • View Profile
    • Thy Gaming Forum
Re: The Slime
« Reply #30 on: March 08, 2012, 08:56:35 pm »
Oh I just now saw that in the OP... I will definitely have to agree with you on the slime trail...
Current Projects:
-Sparta GUI Library: 25% - Alpha Stage
-Grapher - 75% - Beta Stage *on hiatus




Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: The Slime
« Reply #31 on: March 08, 2012, 09:30:13 pm »
How did you get such good grayscale??

Offline chattahippie

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +27/-0
  • Super Member! :D
    • View Profile
Re: The Slime
« Reply #32 on: March 08, 2012, 09:47:21 pm »
How did you get such good grayscale??

I am running the game at 15 MHz, which helps, and also use a total of two DispGraphrr commands (one was way to slow), but I had to slow it down with a Pause (about 10) to really get it good, as the double DispGraph made the greyscale update too fast.  Honestly, it would be even better if I used interrupts, but I will mess with those later.

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: The Slime
« Reply #33 on: March 08, 2012, 09:54:07 pm »
So is this a tile-map or pixel-perfect? Would making it pixel-perfect slow it down a lot?

Offline chattahippie

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +27/-0
  • Super Member! :D
    • View Profile
Re: The Slime
« Reply #34 on: March 08, 2012, 09:58:27 pm »
So is this a tile-map or pixel-perfect? Would making it pixel-perfect slow it down a lot?

For the collision? It is a mixture.  It checks to see if the tiles in a 2x2 grid surrounding the character are solid, and if they are, only checks pixels in the direction the character is accelerating
If it was completely pixel-perfect and constantly checked collision in every direction, it would be a lot slower than it is, and the greyscale would mess up more (like it does when you run into walls)

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: The Slime
« Reply #35 on: March 08, 2012, 10:02:31 pm »
Well I am making a game, and right now it is pixel perfect. Basically right now it checks if above, below, left, and right of the player are solid, and saves it to variables. Another task (thread) checks those variables to see if it can move (The player only collides with the bottom left corner which stinks :P). Is there a better, more efficient way to do this? The grayscale is not as good as yours because of the time it takes to draw all the stuff and check pixels.

Offline chattahippie

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +27/-0
  • Super Member! :D
    • View Profile
Re: The Slime
« Reply #36 on: March 08, 2012, 10:04:19 pm »
Well I am making a game, and right now it is pixel perfect. Basically right now it checks if above, below, left, and right of the player are solid, and saves it to variables. Another task (thread) checks those variables to see if it can move (The player only collides with the bottom left corner which stinks :P). Is there a better, more efficient way to do this? The grayscale is not as good as yours because of the time it takes to draw all the stuff and check pixels.
If you are using acceleration, you can improve it by only checking the ways your character is moving
Ex:
If you are going down and right, only check those two directions

That should speed it up some, if not a lot

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: The Slime
« Reply #37 on: March 08, 2012, 10:17:43 pm »
I tried it, but I can't really tell if it helped or not. Is there any other way?
EDIT: But doesn't it always have to check down? Because it has to check if it collides?
EDIT2: Do you use buffers for your game?
« Last Edit: March 08, 2012, 10:20:15 pm by nxtboy III »

Offline chattahippie

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +27/-0
  • Super Member! :D
    • View Profile
Re: The Slime
« Reply #38 on: March 08, 2012, 10:20:56 pm »
If you also switched to a tilemap system, you can figure out whether or not to even check collision (if everything around you is transparent, no collision is needed, and therefore doesn't need to be tested for).  Also, I suggest throwing an extra display routine in your program. Try to place a fair ways away from the other, but make sure the picture is still the same (as in nothing has moved)

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: The Slime
« Reply #39 on: March 08, 2012, 10:22:51 pm »
???
I'm confused with your last 2 sentences. Extra display routine? fair ways away? Nothing moved in picture? Do you think you could maybe show some psuedo?

Offline chattahippie

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +27/-0
  • Super Member! :D
    • View Profile
Re: The Slime
« Reply #40 on: March 08, 2012, 10:27:40 pm »
Sure, and I will explain further:
Extra display routine - update the screen more than once per loop of the engine
By a fair ways away, I mean make sure that there is lots of time between the updates, to better the effect
And by nothing moved, I mean no sprites have been erased from the screen

And here's my example:

Game loop start:

Update the screen with the current picture
Calculate movement
Calculate Collision
Update the screen again -- nothing has changed since the last screen update
Now change your sprites, and update the tilemap, etc.

Game loop end

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: The Slime
« Reply #41 on: March 08, 2012, 10:29:09 pm »
But there are 2 threads, not one.
And also wouldn't it have to update the screen 3 times since it is 4 lvl grayscale?

Offline chattahippie

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +27/-0
  • Super Member! :D
    • View Profile
Re: The Slime
« Reply #42 on: March 08, 2012, 10:32:47 pm »
But there are 2 threads, not one.
And also wouldn't it have to update the screen 3 times since it is 4 lvl grayscale?
Not necessarily - sometimes that will break the greyscale even further

Basically, the way to get it perfect is just to mess around with the number of screen updates and time between updates -- I spent an hour just playing with different places for the second screen update, how long the pause in between the updates should be, and just getting everything set up nicely

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: The Slime
« Reply #43 on: March 08, 2012, 10:34:41 pm »
???
That doesn't make sense. Why would it only update twice if there are 4 colors? Shouldn't it update 3 times?? Because 4 level grayscale has 3 pictures.

Offline chattahippie

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +27/-0
  • Super Member! :D
    • View Profile
Re: The Slime
« Reply #44 on: March 08, 2012, 10:43:31 pm »
???
That doesn't make sense. Why would it only update twice if there are 4 colors? Shouldn't it update 3 times?? Because 4 level grayscale has 3 pictures.
True, but if you updated three times per loop, it could look like nothing is happening at all if there is not a delay between the third and first update:

1st update: 001001001

2nd update:010010010

3rd update:100100100
1st update: 001001001

With two updates per loop, even if the second update is close to the 1st, it will always change every loop of the engine:

1st update: 001001001
2nd update:010010010
1st update: 100100100

It really just depends on how fast/slow your engine is... If you are still having problems, I would suggest making a new thread so that other people can help you, because I've seen people make 4 scale even better than me