Jump to content



Photo

Experimental Space Shooter Game


  • Please log in to reply
14 replies to this topic

#1 Kilburn

Kilburn

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 491 posts
  • Gender:Male
  • Location:France
  • Interests:Blah

  • Calculators:
    FX-7500 G
    ClassPad 300

Posted 19 September 2008 - 05:57 PM

Okay, since college has been pretty much boring for some weeks, I decided to take out my old ClassPad and play with CPLua. I have recently found out an efficient way to cut a program into several files without the constraints of "require" and "export", very useful for building huge programs without this annoying keypad becoming slower and slower as you type more and more code.

All you have to do is add this line to include any file you want:
doscript("aaa",{E=getfenv()})

And add this line at the very beginning of the included file (here, "aaa"):
setfenv(1,args.E)

And here you go, you don't even have to care about exporting stuff.



Now, about the game itself.

Posted ImagePosted ImagePosted Image

With this efficient way to write long programs, I have tried to create this space shooter, which uses a primitive game engine based on classes and bounding boxes. I may release this game engine later, when it's more reliable and easy to use. Right now, the game is in a very early version, there isn't really any HUD, there is only one short level with few enemies. As you can see, it currently runs at 7-10 fps, which isn't very fast, but heh, it's a calculator, not a Gameboy.

With this forum almost dead, I doubt many people will read this, but well, it's the only one ClassPad forum I know which isn't completely dead. Actually, I need some people who can try this game and give me some ideas for new enemies and gameplay concepts. And eventually some good coder who can look at the code and write some levels.


Get it here: http://kilburn.ftp.f...sPad/space3.mcs
It works only with CPLua 0.8 (you know that games don't run fast at all on CPLua 0.9). I added a fps control, so it should be playable on the emulator as well, though it may take some time to stabilize the framerate.

The main executable is Space\Space.
Commands are simple, use the directional pad to move, press "=" to fire the primary weapon, press "<-" to fire the secondary weapon, and press "0" to exit the level.
If you want to get rid of the FPS counter, comment the line "disp_fps=1" at the beginning of the main file. Same for "disp_mem" if you want to remove the memory counter.

Upgrades can be bought between levels with your score. The better score you get, the more upgrades you can buy. Generator upgrades make your energy charge faster, which is really useful especially if you have heavy weapons and shields that consume much energy.

Oh, also, I had to pack all this stuff quickly, so there may be pictures or other things missing, sorry for that. Just tell me and I'll fix it.


Now have fun, and thanks in advance for helping.

#2 2072

2072

    Casio over god

  • Admin
  • PipPipPipPipPipPipPipPip
  • 1550 posts
  • Gender:Male
  • Location:Somewherebourg
  • Interests:Cinema, Programming, Music and a lot of thing...

  • Calculators:
    AFX2 ROM 1.02, CFX-9940GT+, FX-180P-Plus

Posted 20 September 2008 - 02:05 AM

You should add a link to the file sharing ;)

#3 Kilburn

Kilburn

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 491 posts
  • Gender:Male
  • Location:France
  • Interests:Blah

  • Calculators:
    FX-7500 G
    ClassPad 300

Posted 20 September 2008 - 09:31 AM

Eh, I thought it wouldn't be such a good idea since this isn't even an alpha version. :P

#4 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 24 September 2008 - 02:34 PM

I have recently found out an efficient way to cut a program into several files without the constraints of "require" and "export", very useful for building huge programs without this annoying keypad becoming slower and slower as you type more and more code.

I strongly disagree with splitting a program into several files that way. Main program should not be long. I think you should "modularize" your code, so that each function (or a bunch of functions serving the same purpose) are stored into a file, and communicate with the rest of your program via require and export. This makes your program way more easier to modify, improve, or expand. I really believe that, without require and export, it would be virtually impossible to implement something like my LNA.

With this efficient way to write long programs, I have tried to create this space shooter, which uses a primitive game engine based on classes and bounding boxes. I may release this game engine later, when it's more reliable and easy to use. Right now, the game is in a very early version, there isn't really any HUD, there is only one short level with few enemies. As you can see, it currently runs at 7-10 fps, which isn't very fast, but heh, it's a calculator, not a Gameboy.

Certainly a good idea, and the fps is not bad at all, given it's a calculator.

It works only with CPLua 0.8 (you know that games don't run fast at all on CPLua 0.9), and well, I'm sorry for those who don't have it, but you will need ClassPad Manager 3 to install it. (unless I was blind and didn't find a command to export a VCP as a MCS file)

Unfortunately, I have the latest CPLua version, 0.9.D in my CP, and I don't even have CPManager 3, so I can't even run your program. :(

#5 Kilburn

Kilburn

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 491 posts
  • Gender:Male
  • Location:France
  • Interests:Blah

  • Calculators:
    FX-7500 G
    ClassPad 300

Posted 24 September 2008 - 07:36 PM

I think you should "modularize" your code, so that each function (or a bunch of functions serving the same purpose) are stored into a file [...] This makes your program way more easier to modify, improve, or expand.


The code is perfectly "modularized", as you say, there is a short main program that loads and runs the game engine, which is stored in a separate file, game actors (ships, projectiles, player), which are also stored into several files, one for each category, and resources (pictures, sprites...). Actually, this is exactly the same as using require and export, only with less constraints and without the time lost at typing export{a=a,b=b,c=c,d=d,e=e,f=f...}. This saves really much time, since I'm regularly making new enemy ships, and having to type shipXX=shipXX every time is just getting really annoying, especially when the file gets long and the keyboard, slow responding.

Certainly a good idea, and the fps is not bad at all, given it's a calculator.


Hehe, what else can I do? :D Here, in college, we aren't even using the calculator at all, so I can't really code any mathematical and interesting stuff (though I tried to make a primitive physics engine once and desperately failed).

Unfortunately, I have the latest CPLua version, 0.9.D in my CP, and I don't even have CPManager 3, so I can't even run your program. :(


Dang, guess I'll have to install CPManager 2 then.

#6 Hobart

Hobart

    Casio Fan

  • Members
  • PipPip
  • 34 posts
  • Gender:Male
  • Location:Germany (Saxony/Ore Mountains)

  • Calculators:
    ClassPad 300

Posted 24 September 2008 - 08:40 PM

In my case it's the same! :rolleyes: I am bored and then I begin to write a program (e.g. something like pachisi).
I want to look at your game but there aren't any other things in the *.vcp file than the empty folder main an library. :unsure:
Could you please fix it?

#7 Kilburn

Kilburn

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 491 posts
  • Gender:Male
  • Location:France
  • Interests:Blah

  • Calculators:
    FX-7500 G
    ClassPad 300

Posted 24 September 2008 - 09:11 PM

Argh, I don't have time right now, and well, the version I have on my CP isn't stable at all. I'll fix that tomorrow, and install CPManager 2 so I can provide a good old MCS file.

#8 Kilburn

Kilburn

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 491 posts
  • Gender:Male
  • Location:France
  • Interests:Blah

  • Calculators:
    FX-7500 G
    ClassPad 300

Posted 25 September 2008 - 05:21 PM

http://kilburn.ftp.f...ssPad/space.mcs

Here you go. Now it should work fine, and I added a menu and a fps control so it is playable on the emulator (though it may take some time to decrease the framerate down to 30 fps).

#9 Kilburn

Kilburn

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 491 posts
  • Gender:Male
  • Location:France
  • Interests:Blah

  • Calculators:
    FX-7500 G
    ClassPad 300

Posted 01 October 2008 - 07:30 PM

http://kilburn.ftp.f...sPad/space2.mcs

Now with better menu, primitive load/save system and upgradable weapons. Unfortunately, it's starting to get very near the limits of CPLua, so I don't know how much I will be able to continue this until the CP runs out of memory each time I run it.
I wish people could spend more time exploring the ClassPad and doing interesting stuff instead of using it for cheating at exams and asking retarded questions. Gosh, I miss those old days, when there were still lots of good coders. :(

#10 Kilburn

Kilburn

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 491 posts
  • Gender:Male
  • Location:France
  • Interests:Blah

  • Calculators:
    FX-7500 G
    ClassPad 300

Posted 02 October 2008 - 05:20 PM

http://kilburn.ftp.f...sPad/space3.mcs

Posted ImagePosted ImagePosted Image

Now, feedback please. :banghead:


EDIT: Sigh, that's when even spammers ignore your thread that you know it's completely worthless... :(

#11 2072

2072

    Casio over god

  • Admin
  • PipPipPipPipPipPipPipPip
  • 1550 posts
  • Gender:Male
  • Location:Somewherebourg
  • Interests:Cinema, Programming, Music and a lot of thing...

  • Calculators:
    AFX2 ROM 1.02, CFX-9940GT+, FX-180P-Plus

Posted 02 October 2008 - 11:02 PM

I don't have a classpad so I can't give you any feedback but you should upload it to the file sharing and put a link to this thread in the description ;)

#12 Kilburn

Kilburn

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 491 posts
  • Gender:Male
  • Location:France
  • Interests:Blah

  • Calculators:
    FX-7500 G
    ClassPad 300

Posted 03 October 2008 - 04:25 PM

Fine then, since it's right now in a pretty much advanced version, it should be okay.

EDIT: How the hell do you add pictures? Looks like the img tags are screwed up in there.

#13 Hobart

Hobart

    Casio Fan

  • Members
  • PipPip
  • 34 posts
  • Gender:Male
  • Location:Germany (Saxony/Ore Mountains)

  • Calculators:
    ClassPad 300

Posted 03 October 2008 - 07:30 PM

OK here's my feedback:
I find it very good! :nod: There are nice menus and effects.
But you said it reaches the limits of CPLua. Maybe you could program it under CPLua 0.9E so the problem with the memory would be solved. 0.9E is only a bit slower than 0.8 but uses more memory for program execution.
Also I think the first level is quite difficult. I know it's only a test, but I cannot get to the end... :o
And there should be a short instruction how to make a level...
Nevertheless I find this Game is a nice pastime once you have nothing else to do. :thumbsup:

BTW: Can you say me whether
class.func()
is the same as
class:func()
?

#14 Kilburn

Kilburn

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 491 posts
  • Gender:Male
  • Location:France
  • Interests:Blah

  • Calculators:
    FX-7500 G
    ClassPad 300

Posted 03 October 2008 - 07:44 PM

Yay, feedback! :plol:

Maybe you could program it under CPLua 0.9E so the problem with the memory would be solved. 0.9E is only a bit slower than 0.8 but uses more memory for program execution.


Well, I will get CPLua 0.9E then, though I will probably have to perform a few modifications. But I remember that CPLua 0.9D was drawing really slowly compared to 0.8.

Also I think the first level is quite difficult. I know it's only a test, but I cannot get to the end... :o


That's pretty much what I needed to know. Since I've played that level hundred of times, it seems pretty easy to me. Well, I guess I will put less enemies, or something like that. :lol:
Heh, just try to finish it a few times and buy some upgrades, now that's challenging. :P

And there should be a short instruction how to make a level...


It isn't really complicated, the level is a list of simple instructions. For example:

L={
[0]="TEST",

{40,"ship1",{x=40,y=-20}},
{60,"ship2",{x=80,y=-20}},
...
{200}
}

This will make a level named "TEST", with a "ship1" (those rockets flying straight forward at the beginning of the test level) appearing at (40,-20) at the 40th frame, and a "ship2" spawning at (80,-20) 20 frames later, and so on... You can also add other parameters to the third argument, such as spawn="coin" if you want to spawn a coin when this enemy gets destroyed.

Basically, it works like this:

L={
[0]="name of the level",

{frame,type,{parameters}},
{frame,type,{parameters}},
{frame,type,{parameters}},
...
{frame at which level ends}
}

Just take a look in the file "level1" and try to tweak some stuff, you should get it pretty quickly.

BTW: Can you say me whether

class.func()
is the same as
class:func()
?


Nope.
class:func()
is actually the same as
class.func(class)

So you can do things such as:
object={
	x=1,
	y=2,
	print=function(a)
		print(a.x,a.y)
	end
}

object:print()

As you can see, you don't need to give the object as an argument, it will do it automatically. :)

#15 2072

2072

    Casio over god

  • Admin
  • PipPipPipPipPipPipPipPip
  • 1550 posts
  • Gender:Male
  • Location:Somewherebourg
  • Interests:Cinema, Programming, Music and a lot of thing...

  • Calculators:
    AFX2 ROM 1.02, CFX-9940GT+, FX-180P-Plus

Posted 03 October 2008 - 11:52 PM

Fine then, since it's right now in a pretty much advanced version, it should be okay.

EDIT: How the hell do you add pictures? Looks like the img tags are screwed up in there.


In fact you can use html tags, you just have to use '[' and ']' instead of '<' and '>'. Just note that for image tags you have to finish them with '/]' since there is no [/img] tag.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users