Author Topic: [Lua] Hill Climb Racing  (Read 25973 times)

0 Members and 1 Guest 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: [Lua] Hill Climb Racing
« Reply #30 on: September 29, 2014, 07:10:18 pm »
Awesome :D, too bad the lobsters didn't work out :P

Offline CinusMinus

  • LV3 Member (Next: 100)
  • ***
  • Posts: 43
  • Rating: +4/-0
    • View Profile
Re: [Lua] Hill Climb Racing
« Reply #31 on: October 01, 2014, 12:58:49 pm »
Well lobster still haunt the code, but that's not such a big deal >B) .
A much more severe problem is that the file I uploaded yesterday doesn't work ::) . I didn't notice because the error is caused by restoring a saved document. When using the built-in editor of the student software this doesn't matter, so I didn't notice until I tried to run it on my calc and failed. So I upload the working version here
Projects:
Chicken Invaders [Finished]
TI.Image Tools [Finished]
MC2D Texture Pack Creator [Finished]
HillClimbRacing [In Development]

Offline CinusMinus

  • LV3 Member (Next: 100)
  • ***
  • Posts: 43
  • Rating: +4/-0
    • View Profile
Re: [Lua] Hill Climb Racing
« Reply #32 on: October 22, 2014, 10:13:27 am »
The next version is available now :)
New Features:
- pause function
- popups when you attempt to buy something
- three different graphics modes
  - Abstract - only outlines, no sky - fastest on handheld
  - Medium - underground is not drawn
  - Full Everything is drawn
- new game-over screen
- a new track
- better performance on the handheld
- data is now stored in a variable to survive updates. To prevent cheating it's obfuscated

VV Download now VV
Projects:
Chicken Invaders [Finished]
TI.Image Tools [Finished]
MC2D Texture Pack Creator [Finished]
HillClimbRacing [In Development]

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: [Lua] Hill Climb Racing
« Reply #33 on: October 22, 2014, 11:41:00 am »
Awesome :D, do you think the abstract graphic mode would work well on OS 3.1?

Offline CinusMinus

  • LV3 Member (Next: 100)
  • ***
  • Posts: 43
  • Rating: +4/-0
    • View Profile
Re: [Lua] Hill Climb Racing
« Reply #34 on: October 22, 2014, 11:57:55 am »
It would, if there was a physics engine in 3.1. Unfortunately it isn't available on 3.1 and it's essential for running the game. So basically there earliest supported version is OS3.2, because of the physics engine. It would be possible to include the physics engine via ndless, but that would be a lot of work only to add a feature, that's already available on newer versions that also support ndless. I'm sorry, but it won't work on OS 3.1
Projects:
Chicken Invaders [Finished]
TI.Image Tools [Finished]
MC2D Texture Pack Creator [Finished]
HillClimbRacing [In Development]

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: [Lua] Hill Climb Racing
« Reply #35 on: October 22, 2014, 12:02:06 pm »
Ah right, I forgot about the physics engine. I thought about the idea since LDStudios allows people to disable the background in his medieval platformer to increase speed.

Offline CinusMinus

  • LV3 Member (Next: 100)
  • ***
  • Posts: 43
  • Rating: +4/-0
    • View Profile
Re: [Lua] Hill Climb Racing
« Reply #36 on: October 22, 2014, 12:45:32 pm »
That's quite similar to what I do here. I don't use sprites for the background though. On of the most costly operations is to recalculate the positions of the vertices every frame. That's necessary though a blind mode would probably be quite funny :) But by disabling the soil it gains some performance. The abstract mode just avoids filling shapes, which makes it faster, too.
Projects:
Chicken Invaders [Finished]
TI.Image Tools [Finished]
MC2D Texture Pack Creator [Finished]
HillClimbRacing [In Development]

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: [Lua] Hill Climb Racing
« Reply #37 on: October 22, 2014, 01:23:33 pm »
About the score/data saving without (for 99.99% users) a cheating possibility, I suggest taking a look here : http://inspired-lua.org/index.php/2011/08/save-a-high-score-without-cheating-possibility/ :)
(the code at the end, if you want to skip the rest)
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline CinusMinus

  • LV3 Member (Next: 100)
  • ***
  • Posts: 43
  • Rating: +4/-0
    • View Profile
Re: [Lua] Hill Climb Racing
« Reply #38 on: October 22, 2014, 01:31:48 pm »
I know about on.save and on.restore. but data saved in these methods doesn't survive an update. That's not that tragic, when you don't update at all or your game doesn't depend on previous sessions. but if you unlock something and then there is an update with a lot of new features, or even a small bugfix update all your data is lost. That's what I tried to avoid by storing the data into a variable. It's still not easy to cheat, because the text in the variable in unreadable. And as I want to maintain the possibility of updating without users losing their progress I implemented it that way.
Projects:
Chicken Invaders [Finished]
TI.Image Tools [Finished]
MC2D Texture Pack Creator [Finished]
HillClimbRacing [In Development]

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: [Lua] Hill Climb Racing
« Reply #39 on: October 22, 2014, 03:36:15 pm »
Hum, I'm not sure to understand what you mean...
By "update" you mean people downloading a new version of your tns, right ?

If so, then the "hcrdata" of the user wont' exist anymore since the .tns will be replaced by your file...

Or maybe what you mean is that people who update will have to copy/paste the lua code into their own tns file (which contains their hcrdata), and then, yes indeed only the lua code will be updated and the data will be still there :)

(Also, security by obscurity isn't really secure :P But yeah, it sure will prevent most cheaters I suppose ^^)

Also, just tested, it's pretty cool, good job.
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline LDStudios

  • Coder Of Tomorrow
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 388
  • Rating: +41/-1
    • View Profile
    • LD Studios
Re: [Lua] Hill Climb Racing
« Reply #40 on: October 22, 2014, 05:05:18 pm »
Hum, I'm not sure to understand what you mean...
By "update" you mean people downloading a new version of your tns, right ?

If so, then the "hcrdata" of the user wont' exist anymore since the .tns will be replaced by your file...

Or maybe what you mean is that people who update will have to copy/paste the lua code into their own tns file (which contains their hcrdata), and then, yes indeed only the lua code will be updated and the data will be still there :)

(Also, security by obscurity isn't really secure :P But yeah, it sure will prevent most cheaters I suppose ^^)

Also, just tested, it's pretty cool, good job.

He might mean a way to copy the file data from the file without opening the script editor, and then ability to paste it into a future version. (or something like that)



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: [Lua] Hill Climb Racing
« Reply #41 on: October 22, 2014, 05:12:41 pm »
I know that on the HP Prime, variables created by a specific program will not work with newer versions of that program. Maybe he meant something similar but with the Nspire?

Offline CinusMinus

  • LV3 Member (Next: 100)
  • ***
  • Posts: 43
  • Rating: +4/-0
    • View Profile
Re: [Lua] Hill Climb Racing
« Reply #42 on: October 22, 2014, 05:52:59 pm »
My main intention was not to prevent cheating. And yes, when the user updates the new file doesn't contain the variable anymore. But there are at least three ways of updating without data loss:
1: Use the script editor and copy-paste the new lua code into the old program. 2:Copy the page of the new version to the file of the old version. 3: Overwrite the var in the new file with the old state, close the file and reopen it. As I said my main intention was to provide a way to keep your old highscores and your unlocked cars and tracks. If you really want to cheat you can always do it. It's easier when the savestate is accessible but that's acceptable. The problem is that any kind of data saved via on.save will be bound its script. The only other way would probably be to let the user insert the old state directly in the script. That wouldn't be much more safe though. Obfuscation will prevent most attempts to cheating, but other methods won't ban cheating completely, too.
Projects:
Chicken Invaders [Finished]
TI.Image Tools [Finished]
MC2D Texture Pack Creator [Finished]
HillClimbRacing [In Development]

Offline Alex Twigg

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 6
  • Rating: +0/-0
  • This is not personal...
    • View Profile
Re: [Lua] Hill Climb Racing
« Reply #43 on: October 22, 2014, 07:02:59 pm »
looks awesome! mind id i look at the code?
I use a calculator as a substitute for a book and I am still cool in school...

Offline LDStudios

  • Coder Of Tomorrow
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 388
  • Rating: +41/-1
    • View Profile
    • LD Studios
Re: [Lua] Hill Climb Racing
« Reply #44 on: October 22, 2014, 07:23:37 pm »
looks awesome! mind id i look at the code?

The project is open source (as are pretty much all nspire lua projects), so I'm sure he wouldn't have a problem with it.
Click Script Editor, Edit Script in the student software, while that document is open.