Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
21 May, 2013, 12:20:50 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: 1 [2] 3   Go Down
  Print  
Author Topic: Owl — A fast, lightweight, and flexible game engine for the TI-Nspire -  (Read 1843 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
Nick
LV9 Veteran (Next: 1337)
*********
Offline Offline

Gender: Male
Last Login: Yesterday at 20:44:19
Date Registered: 05 June, 2011, 20:01:07
Location: 51° 12′ 34″ N, 3° 13′ 31″ E
Posts: 1178


Total Post Ratings: +158

View Profile WWW
« Reply #15 on: 03 January, 2012, 09:17:11 »
0

i know the scrolling issues with lua, for now it's too slow, maybe some improvement on the that in the future? let us hope Smiley

but it's really nice, why did you change the name to owl (i like it, just to know)?
Logged

adriweb
Editor
LV9 Veteran (Next: 1337)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 00:38:33
Date Registered: 13 April, 2011, 18:42:59
Location: South of France
Posts: 1196


Total Post Ratings: +185

View Profile WWW
« Reply #16 on: 03 January, 2012, 13:59:06 »
0

Looks quite nice so far. By the way although smooth scrolling cannot be implemented, have you tried 8 pixel scrolling or even 4 pixel scrolling?
No but I have tried some sort of smooth scrolling in the past. Way too slow for what it gives back, not worth the pain of implementing it. Well, at least not a this point, maybe if Lua gets a bit faster in the future, then why not.
Smooth scrolling for the character's sprite is easily possible... just a for loops over the coordinates from source to destination (maybe with actually a partial window:invalidate() to accelerate the specific screen part refresh)
But yeah, smooth scrolling for the rest (background and tiles) would indeed be slow.
« Last Edit: 03 January, 2012, 13:59:24 by adriweb » Logged


TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation
hoffa
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Yesterday at 15:54:50
Date Registered: 28 May, 2011, 20:26:32
Posts: 302


Topic starter
Total Post Ratings: +115

View Profile
« Reply #17 on: 03 January, 2012, 14:08:14 »
0

but it's really nice, why did you change the name to owl (i like it, just to know)?
I like owls and it's shorter, and somehow feels a lot less clumsy.

Looks quite nice so far. By the way although smooth scrolling cannot be implemented, have you tried 8 pixel scrolling or even 4 pixel scrolling?
No but I have tried some sort of smooth scrolling in the past. Way too slow for what it gives back, not worth the pain of implementing it. Well, at least not a this point, maybe if Lua gets a bit faster in the future, then why not.
Smooth scrolling for the character's sprite is easily possible... just a for loops over the coordinates from source to destination (maybe with actually a partial window:invalidate() to accelerate the specific screen part refresh)
But yeah, smooth scrolling for the rest (background and tiles) would indeed be slow.
My experience with partially updating the screen is that it is pointless. The thing is the TI-Nspire stupidly clears the whole screen before calling on.paint, which means I am required to "draw" (or rather, copy the stuff into some buffer) the whole screen every single time anyway. That's what takes a lot of CPU time, not the actual flipping of the screen. So, just scrolling the characters would be just as slow as scrolling the background (unless I had some blank background).
« Last Edit: 03 January, 2012, 14:15:02 by hoffa » Logged
Jim Bauwens
Lua! Nspire! Linux!
Editor
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 00:39:35
Date Registered: 28 February, 2011, 22:32:12
Location: Belgium
Posts: 1733


Total Post Ratings: +180

View Profile WWW
« Reply #18 on: 03 January, 2012, 14:19:57 »
0

This is not the case if you only invalidate a certain spot (by giving arguments to invalidate() ).
I've made some stuff with it (smooth scrolling) and it works very good.
Logged

hoffa
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Yesterday at 15:54:50
Date Registered: 28 May, 2011, 20:26:32
Posts: 302


Topic starter
Total Post Ratings: +115

View Profile
« Reply #19 on: 03 January, 2012, 14:38:22 »
0

This is not the case if you only invalidate a certain spot (by giving arguments to invalidate() ).
I've made some stuff with it (smooth scrolling) and it works very good.
I'd like to see how you do that, as this simple example does clear the whole screen whenever I press the enter key:

1
2
3
4
5
6
7
8
9
10
11
12
13
sprite = image.new("some 318*212 ti image")
drawn = false

function on.enterKey()
    platform.window:invalidate(10, 10, 10, 10)
end

function on.paint(gc)
    if not drawn then
        gc:drawImage(sprite, 0, 0)
        drawn = true
    end
end
« Last Edit: 03 January, 2012, 14:38:40 by hoffa » Logged
Nick
LV9 Veteran (Next: 1337)
*********
Offline Offline

Gender: Male
Last Login: Yesterday at 20:44:19
Date Registered: 05 June, 2011, 20:01:07
Location: 51° 12′ 34″ N, 3° 13′ 31″ E
Posts: 1178


Total Post Ratings: +158

View Profile WWW
« Reply #20 on: 03 January, 2012, 14:41:08 »
0

well, you make drawn true when painting, so when you press enter, the drawn isn't false anymore and the sprite won't get drawn, just change that drawn=true in =false (or just delete it) and it should work
you still have to say what it has to paint on the screen..

the rest of the code is correct imo
« Last Edit: 03 January, 2012, 14:44:05 by Nick » Logged

hoffa
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Yesterday at 15:54:50
Date Registered: 28 May, 2011, 20:26:32
Posts: 302


Topic starter
Total Post Ratings: +115

View Profile
« Reply #21 on: 03 January, 2012, 14:44:29 »
0

well, you make drawn true when painting, so when you press enter, the drawn isn't false anymore and the sprite won't get drawn, just change that drawn=true in =false (or just delete it) and it should work

the rest of the code is correct imo
Well that was to show that it does clear the screen every time, which is absolutely dumb speed-wise (i.e. I am forced to recopy all the data to the screen no matter what).
EDIT: If only TI had made their library simple and hassle-free like SDL, it would loads better.
« Last Edit: 03 January, 2012, 14:49:52 by hoffa » Logged
Jim Bauwens
Lua! Nspire! Linux!
Editor
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 00:39:35
Date Registered: 28 February, 2011, 22:32:12
Location: Belgium
Posts: 1733


Total Post Ratings: +180

View Profile WWW
« Reply #22 on: 03 January, 2012, 14:51:22 »
0

Your code works with me, although I did not use a fullscreen picture (32*32).
When pushing enter only a 10*10 square is cleared.

Edit:
Also, you can expect improvement in the next OS release.
TI did not create Lua for game programming, so its not hard to understand that its not optimized for games.
Anyway, I don't have any problem with TI.Image.
« Last Edit: 03 January, 2012, 14:53:38 by jimbauwens » Logged

hoffa
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Yesterday at 15:54:50
Date Registered: 28 May, 2011, 20:26:32
Posts: 302


Topic starter
Total Post Ratings: +115

View Profile
« Reply #23 on: 03 January, 2012, 15:10:25 »
0

Your code works with me, although I did not use a fullscreen picture (32*32).
When pushing enter only a 10*10 square is cleared.

Edit:
Also, you can expect improvement in the next OS release.
TI did not create Lua for game programming, so its not hard to understand that its not optimized for games.
Anyway, I don't have any problem with TI.Image.
Actually I tried it on the official emulator, maybe the behavior is different on the actual hardware. Once I return home I'll try it on the calculator, so hopefully that was the reason why it didn't seem to work. Thanks for clearing that up anyway.
Hopefully they will indeed improve it in the next OS!
Logged
Jim Bauwens
Lua! Nspire! Linux!
Editor
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 00:39:35
Date Registered: 28 February, 2011, 22:32:12
Location: Belgium
Posts: 1733


Total Post Ratings: +180

View Profile WWW
« Reply #24 on: 03 January, 2012, 15:13:11 »
0

Ah, yes. I never use the official emulator because I can't trust it Smiley

And about improving stuff, they are adding some nice stuff Smiley
Logged

hoffa
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Yesterday at 15:54:50
Date Registered: 28 May, 2011, 20:26:32
Posts: 302


Topic starter
Total Post Ratings: +115

View Profile
« Reply #25 on: 05 January, 2012, 20:55:05 »
0

Just to let you know, Owl now runs at a good 50 FPS (from a previous 9 FPS) when not scrolling (thanks to jimbauwens for clearing me up).
Here is a small demo you can try out yourself to see how it runs speed-wise: http://bb.xieke.com/files/1/owl_test.tns
(The code itself is crappy, but I quickly did something dirty so I have a good base from which to write clean code)
It won't work on the official TI-Nspire emulator though, so you have to try it on the actual hardware if you want to actually see something. Also I changed Link to a Link that is the size of a tile (16x16 in this case), as it is currently too much of a mess to deal with arbitrary sized sprites.
« Last Edit: 05 January, 2012, 22:55:21 by hoffa » Logged
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Today at 08:22:03
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50208


Total Post Ratings: +2613

View Profile WWW
« Reply #26 on: 05 January, 2012, 22:03:53 »
0

Interesting. Could you sum up how you got to improve the speed? Also does it use any undocumented tricks? Because maybe that won't work in future OSes then Sad

EDIT Weird I don't notice much of a frame difference. Is it just due to the getkey speed limitation and lack of smooth character movement?
« Last Edit: 05 January, 2012, 22:07:00 by DJ_O » Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
hoffa
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Yesterday at 15:54:50
Date Registered: 28 May, 2011, 20:26:32
Posts: 302


Topic starter
Total Post Ratings: +115

View Profile
« Reply #27 on: 05 January, 2012, 22:10:04 »
0

Interesting. Could you sum up how you got to improve the speed? Also does it use any undocumented tricks? Because maybe that won't work in future OSes then Sad
Well it basically keeps track of tiles that need to be redrawn and only refreshes that part of the screen (which doesn't work on the official emulator). That speeds things up a lot. No undocumented stuff.
Edit: that also means that at some point I'll be able to add a feature to use animations for the characters, as it won't really slow things down.
« Last Edit: 05 January, 2012, 22:20:04 by hoffa » Logged
Jim Bauwens
Lua! Nspire! Linux!
Editor
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 00:39:35
Date Registered: 28 February, 2011, 22:32:12
Location: Belgium
Posts: 1733


Total Post Ratings: +180

View Profile WWW
« Reply #28 on: 05 January, 2012, 22:35:35 »
0

Glad I could be of a help Smiley
Logged

hoffa
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Yesterday at 15:54:50
Date Registered: 28 May, 2011, 20:26:32
Posts: 302


Topic starter
Total Post Ratings: +115

View Profile
« Reply #29 on: 05 January, 2012, 22:59:18 »
0

EDIT Weird I don't notice much of a frame difference. Is it just due to the getkey speed limitation and lack of smooth character movement?
Actually I just noticed that that TNS used the timer to refresh the screen every 0.01s (I was measuring the FPS), rather than updating after moving Link (I uploaded again and updated the link). I think why it doesn't seem to be that much faster is because of the key repeat limitation indeed. Also if I had used a map with loads of sprites you would have seen a huge improvement, but even now it should be quite a bit more responsive.
« Last Edit: 05 January, 2012, 22:59:39 by hoffa » Logged
Pages: 1 [2] 3   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.359 seconds with 31 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.