Omnimaga
Calculator Community => Casio Calculators => Topic started by: Spenceboy98 on July 08, 2014, 04:51:40 pm
-
Hello, everyone! For the past couple days I've been bored, so I decided to play around with programming (since I hadn't in a while). Cookie Clicker seemed easy enough to make, so I decided to try to port/clone it (not sure which to call it; a port or a clone?). I tried making it as accurate to the original as I possibly could. It's pretty simple for now. I plan on adding a saving/loading feature to save your data when you exit the program and to load it back up when you re-enter it later. So far I could only get the Cursors through the Time Machines to work properly in the shop. Here is a screenie to show what I've done so far:
(http://img.ourl.ca/Cookies-1.png)
(Idea and Sprites are not mine; they were created by Orteil (http://orteil.dashnet.org/))
-
Definitively the best-looking Cookie Clicker clone on calcs :D. Also, that cookie looks tasty :P
-
MMmh, you should try another font, this one is not tasty enough. :D
Oh and do you use the RTS? You could support a sort of idling system : starting the game loads the save and the timestamp and gives as CpS * time out of the addin.
-
Hey look, a Spenceboy ! :D It's been a while !
Nice looking game indeed.
Also Eiyeron I think you mean RTC right ? I can see a problem with that : people can just go and change their clock and have instant cookies. :P
-
Definitively the best-looking Cookie Clicker clone on calcs :D. Also, that cookie looks tasty :P
Thanks! It's quite tasty. :P
MMmh, you should try another font, this one is not tasty enough. :D
Oh and do you use the RTS? You could support a sort of idling system : starting the game loads the save and the timestamp and gives as CpS * time out of the addin.
I'm just using the default font that is used for the PrintMiniFix routine, but I might try another one later if I can. :P And yes, I do use the RTC (is that what you mean?). I see what you mean by the idling system and I'll keep that in mind. :P
Hey look, a Spenceboy ! :D It's been a while !
Nice looking game indeed.
Also Eiyeron I think you mean RTC right ? I can see a problem with that : people can just go and change their clock and have instant cookies. :P
I'm sure people could just do that, but if there is a saving feature, I'm sure they could also just change the number of cookies in the save file too if they wanted. :P
I have a question about RTC. I have it so that it checks if a second has passed and adds the CpS. If I did do the idling thing, how could I tell if it's been 24 hours or 0 hours (does the RTC reset to zero once it becomes midnight)? Is there a separate function for the date as well? I'll have to research this. :P
-
An RTC counts seconds since a reference (generally Epoch, January 1st, 1970, 00:00 UTC) so that's fine.
-
An RTC counts seconds since a reference (generally Epoch, January 1st, 1970, 00:00 UTC) so that's fine.
Well, according to cemetech's Prizm wiki:
Header: fxcg/rtc.h
Syscall index:
Function signature: int RTC_GetTicks(void)
Returns the number of ticks elapsed since midnight (resetting every day). The RTC ticks at 128 Hz.
I'll do some more research about getting the date as well.
-
Ah that's a very unusual RTC lol.
-
Being bored is probably the best way to come up with awesome projects.
-
I just finished the saving and opening routine for Cookie Clicker, so now it saves your current progress and loads it back up when you re-enter. I might release a demo soon (if I feel like it's worthy for the public). :P
-
By the way, if this game automatically overclocks the calc, don't, because I heard from Cemetech that it's very dangerous to overclock that calc apparently.
Other than that, nice progress. :D
-
I doesn't automatically overclock the calc. I never automatically do it, but if it's too slow, I might recommend it. Right now it doesn't seem like it needs to be, unless you want to be able to click by hand faster.
I might release something today, so...
-
... sorry for the double post in less than 24 hous but...
Update (and first release)!
I got a new font going (it's the one from the original):
(http://img.ourl.ca/Cookies1.png)
And the release is attached. :P
[SHIFT] - Click the big cookie.
[ALPHA] - Buy a store object.
[UP] - Moves the selection of the store objects up.
[DOWN] - Moves the selection of the store objects down.
Let me know if there are any issues. One issue I know of (and it's not a big issue) is that sometimes, when you buy a cursor, it doesn't add to the CpS. I ignored it one time, and later when I was buying something larger, it added the 0.1 to the CpS. Another is that sometimes it display CpS with a .0 at the end of it when it's a whole number (but that's not really a big deal).
Enjoy! :P
-
Nice, I'll install it when I get some time. i was a bit concerned at first because I thought there were only 4 items to buy, which would have made the game lifespan extremely short.
-
I'm starting to implement Golden Cookies:
(http://img.ourl.ca/Cookies2.png)
As you can see, it's tinted purple, but that's cause of the routine I'm using (not sure why it's doing that). I'm making it so that they appear above the F buttons, so that you just have to press the one that it's above to click it.
-
I'm making it so that they appear above the F buttons, so that you just have to press the one that it's above to click it.
Great idea. :)
(PS: Change your sig HTML to BBCode (http://wiki.simplemachines.org/smf/Alphabetical_list_of_all_bulletin_board_codes).)
-
Is the purple glitch due to the same problem you had with your (canceled?) Mode 7 engine? I like the custom fonts by the way :D
-
Is the purple glitch due to the same problem you had with your (canceled?) Mode 7 engine? I like the custom fonts by the way :D
Thanks. :P I didn't use the CopySpriteMaskedAlpha routine in the Mode 7 engine, so it's probably not the same problem. :P For now, until I can get a working CopySpriteMaskedAlpha routine, the Golden Cookies won't fade in/out, they'll just appear.
-
*BUMP*
Got golden cookies working (I had to fix my own alpha sprite routine).
(http://img.ourl.ca/GoldenCookies.gif)
(probably not actual speed. The values are messed up because of the screen receiver; not sure why)
They should appear every 5 to 10 minutes (I might make it shorter if requested enough).
Also the file size is smaller now because I changed the font images from 16-bit to 1-bit using SourceCoder. New version is attached. :P
-
One of the very few calc games to support translucent sprites? O.O
-
Whoa nice job on making the sprites translucent indeed. O.O
-
That looks awesome!
-
By the way I finally tried this on calc (then left it run overnight) and it works pretty well. My only gripe about it is that key detection is not very responsive so if I try to mash the cookie key or move cursor down it sometimes doesn't do anything. Could this be due to low frame rate or something?
-
Is this written in C? If so imma try porting it to Nspire :D
Edit: Aww, is this closed source? I can't find the source code. :(
-
That said, considering the nature of this game, I doubt it would be super incredibly hard to port from scratch :P (except maybe the translucent cookies)
-
Translucent cookies are relatively simple :
In : color, alpha (between 0 and 1)
Out : colorOnScreen * (1 - alpha) + color * alpha
Apply that on every pixel of the sprite and you're done.
-
That code you propose is very slow. Here is a faster way. I originally posted this at cemetech's useful function topic for the prizm but this code will work for any thing that uses rgb565 data. To port it change:
unsigned short*v=(unsigned short*)0xA8000000; to wherever the framebuffer is.
/*Note it is up to the caller to ensure that alpha is in range of 1-31
* For a value of 32 or greater just don't draw the image
* For a value of 0 use a plain mask function that does not take into account alpha
* Also make sure width is a multiple of two*/
void CopySpriteMaskedAlpha(unsigned *data,unsigned x,unsigned y,unsigned width,unsigned height,unsigned maskcolor,unsigned alpha){
unsigned short*v=(unsigned short*)0xA8000000;
unsigned* VRAM,w,alphai;
width/=2;
v += 384*y + x;
VRAM=v;
alphai=32-alpha;
maskcolor|=maskcolor<<16;/*Note I have decided to do a minor tradeoff for speed. Make sure your alpha pixels are multiple of two*/
while(height--){
w=width;
while(w--){
unsigned color1=*data++;
if(color1 != maskcolor){
/*Note this is based on the source code of Fblend's function fblend_rect_trans_16*/
unsigned rbg_source, grb_source,temp1;
/* Split up components to allow us to do operations on all of them at the same time */
rbg_source = *VRAM & 0xF81F07E0,
grb_source = *VRAM & 0x07E0F81F;
/* Multiply the source by the factor */
rbg_source = ((rbg_source >> 5) * alpha) & 0xF81F07E0;
grb_source = ((grb_source * alpha) >> 5) & 0x07E0F81F;
/* Split up RGB -> R-B and G */
temp1 = color1 & 0x7E0F81F;
color1 &= 0xF81F07E0;
/* Multiply the source by the factor */
color1 = ((((color1 >> 5) * alphai) & 0xF81F07E0) + rbg_source) & 0xF81F07E0;
temp1 = ((((temp1 * alphai) >> 5) & 0x07E0F81F) + grb_source) & 0x07E0F81F;
color1 |= temp1;
*VRAM++=color1;
}else
++VRAM;
}
VRAM += (384/2)-width;
}
}
This code will actually handle a range of 0-32. Even though this function is fast it is faster to not draw the image (value of 32). Or just draw the image using mask function that does not worry about alpha (value of 0).
It admit to getting part of this code off from Fblend an open source project as you can see in the comment I put in the code. One good thing about the code is that it does two pixels at a time. However I decided to remove the checks for non multiples of two to further increase speed given the fact that you can just fix your image if needed. Also make sure that the alpha pixels are multiples of two. Also I found an interesting article talking about a few rgb565 tricks you may want to check out http://www.cprogramdevelop.com/4562354/