Author Topic: [Ndless] nKaruga  (Read 93671 times)

0 Members and 3 Guests are viewing this topic.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [Ndless] nKaruga
« Reply #15 on: May 15, 2014, 09:05:02 am »
Maybe he accidentally posted in the wrong topic? :P

Also this looks very promising Matref, especially speed-wise O.O

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Ndless] nKaruga
« Reply #16 on: May 15, 2014, 12:31:39 pm »
Maybe he accidentally posted in the wrong topic? :P
Well that's a possibility ;D

Also this looks very promising Matref, especially speed-wise O.O
Thanks :) and yeah, I'm trying my best to execute only micro-operations that takes a very small amount of cycles. Though, let me stop being lazy and change the ugly cos()/sin() calls into a cosine table and that will be even faster :P I hope it won't do like with IkarugaX and keep bullets super-fast while making enemies an extreme hit to speed (because bullets are just 2 additions, 4 tests and one sprite drawing, and each enemy has its own AI).

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: [Ndless] nKaruga
« Reply #17 on: May 15, 2014, 12:32:30 pm »
Hehe Eiyeron. :P
Also it does look awesome indeed. Do you plan to add a background cause white looks pretty plain. :/

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Ndless] nKaruga
« Reply #18 on: May 15, 2014, 12:33:58 pm »
<_< I already talked about that :

Of course I will [add backgrounds]. I will also add an option to disable them though, both for performance and for TI-Nspire non-CX support (for now the .tns works on every Nspire, but backgrounds will make the game difficult to see).

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: [Ndless] nKaruga
« Reply #19 on: May 15, 2014, 12:48:31 pm »
Whoopsie. ::)

Offline AnToX98

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 107
  • Rating: +10/-0
    • View Profile
Re: [Ndless] nKaruga
« Reply #20 on: May 15, 2014, 02:20:30 pm »
One simple word :

wow :p





My Lua projects :

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: [Ndless] nKaruga
« Reply #21 on: May 17, 2014, 03:59:52 pm »
Maybe he accidentally posted in the wrong topic? :P

NO, in case you want to switch to Fixed Point, here is a mini library for it. It greatly increase the speed.

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Ndless] nKaruga
« Reply #22 on: May 17, 2014, 05:33:37 pm »
So in the original Ikaruga, this enemy that you can see in the previous screenshots - the most basic enemies - rotates. First, I wanted to recreate that by using SDL_gfx's rotozoomSurface function, but as the framerate dropped by nearly 60 FPS (!!!) I decided to create my own custom_rotosprite function. As a result, the speed loss is hardly noticeable :



So the sprite rotation is *nearly* perfect, obviously because of the use of fixed-point cos and sin, but as you can see it does the job pretty well. Also, I really didn't try to make it optimized, so I'm sure I can *at least* double the speed of the rotation routine (I do 4 multiplication per loop, and I'm sure I can instead do 2 additions).

EDIT (ninja'd by Eiyeron, yes I took 45 minutes to write that post) : I'm already using fixed-point, what were you thinking, that I could get that speed with floating-point ? <_<
« Last Edit: May 18, 2014, 10:34:32 am by Matrefeytontias »

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Ndless] nKaruga
« Reply #23 on: May 18, 2014, 04:05:10 pm »
Minor improvements, I greatly sped up the rotosprite routine, throwing 4 multiplications and 2 additions out of the main loop at the (minor) cost of 4 additions. Although that worked well, that's not really worth a screenshot.

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: [Ndless] nKaruga
« Reply #24 on: May 19, 2014, 04:43:24 am »
EDIT (ninja'd by Eiyeron, yes I took 45 minutes to write that post) : I'm already using fixed-point, what were you thinking, that I could get that speed with floating-point ? <_<

I didn' t say that, I supposed you were sticking with floating point. I just wanted to help you.

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Ndless] nKaruga
« Reply #25 on: May 19, 2014, 12:40:50 pm »
Yeah well, thanks for trying to help and sorry if I sounded rude, but I really can't find any post where I said that I needed anything else than a binary cosine LUT :P
« Last Edit: May 19, 2014, 12:49:19 pm by Matrefeytontias »

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Ndless] nKaruga
« Reply #26 on: May 19, 2014, 01:27:08 pm »
On a more positive note, update !

I've implemented level streams ! :D That means that enemies can now arrive on-screen in an organized manner, without me having to declare several enemies in the code - a single array of enemies is enough for the whole game, as there will be a definite maximal number of enemies on the screen at once. :)

The "levels" are scripted, and easy enough to design. Here is the current example level script :

Code: [Select]
int levelStream[] = {
enemy(110, 0, image_LUT_enemy_ship_0_light, image_LUT_enemy_bullet_1_light, callback_LUT_0, LIGHT, 1),
enemy(220, 0, image_LUT_enemy_ship_0_shadow, image_LUT_enemy_bullet_1_light, callback_LUT_0, SHADOW, 1),
cmd_killed,
LVLSTR_END
};

Here, an enemy() instruction adds an enemy to the scene. The prototype is the following :
Code: [Select]
enemy(x, y, imgID, bulletImgID, callbackID, polarity, hasRotation)Due to the project using LUTs to speed up ... well, everything that can be speeded up, no images or pointers to functions are passed. Everything is handled by IDs that are looked up in the corresponding tables. So yeah, for now that makes level editing impossible to anyone but me, but at that point of development, who cares, really :P

Next, there's the cmd_killed instruction. It's a level stream command, waiting for every active enemy to be killed or having exited the map before carrying on the level stream. I also implemented the cmd_wait(frames) instruction, whose purpose is obvious, but it's not used yet.

Then, the end of the level stream is marked by LVLSTR_END. When this point is reached, the game waits for every enemies to be killed, then quits - although for now you can't kill enemies so we'll see if that works when I'll implement collisions :P

Here's a screenshot of the above level stream :



This time, I'll really work on collision detection :P I just hope it won't slow things too much - although I'm certain that it will.
« Last Edit: May 19, 2014, 01:32:13 pm by Matrefeytontias »

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: [Ndless] nKaruga
« Reply #27 on: May 19, 2014, 01:30:38 pm »
Fasten = attached.
* Streetwalrus runs

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Ndless] nKaruga
« Reply #28 on: May 19, 2014, 01:31:53 pm »
Oh yeah forgot that. Vocabulary corrected.

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: [Ndless] nKaruga
« Reply #29 on: May 19, 2014, 01:32:42 pm »
Hehe. :P
Anyway nice update ! :D