Author Topic: DrillMiner  (Read 43617 times)

0 Members and 1 Guest are viewing this topic.

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: DrillMiner
« Reply #30 on: January 03, 2013, 06:49:03 pm »
Because I'm a noob that doesn't know this stuff :P
This is what I have for save and load, but the result is kinda ugly O.O


SAVE CODE

FILE * f = fopen("/documents/miner/mapdata.tns", "w+");
for(j = 0; j < 10120; j++) //the map has 10120 blocks
   fprintf(f, "%d ", map[j]);
fclose(f);


LOAD CODE

FILE *f = fopen("/documents/miner/mapdata.tns", "r");
fread(map, sizeof(int), 10120, f);
fclose(f);
« Last Edit: January 03, 2013, 06:49:42 pm by epic7 »

Offline lkj

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +58/-1
    • View Profile
Re: DrillMiner
« Reply #31 on: January 03, 2013, 06:54:44 pm »
You can also use fwrite for saving and probably have to because fprintf stores the map as text and fread reads it as ints.
« Last Edit: January 03, 2013, 06:54:56 pm by lkj »

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: DrillMiner
« Reply #32 on: January 03, 2013, 06:58:57 pm »
...
Yeah, I have no idea what I'm doing :P

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: DrillMiner
« Reply #33 on: January 03, 2013, 07:01:09 pm »
Are you using nSDL ? If so, I can provide you a getPixel routine I wrote :) else, you can find in the file utils.c of the Ndless sample "particles" a getPixel function which deals directly with the screen.

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: DrillMiner
« Reply #34 on: January 04, 2013, 10:14:56 pm »
I'm using nRGBlib. I guess I'll go check that file out, although I don't think I'll need it that much anymore.

Anyways, I've been trying to make the ore generator less crappy, and I have one now that's working a bit better. For a visual representation of the generator so far, here's a stacked graph of ore abundance:

The map was 40*600, so 24000 blocks. It seems that there's only 26 diamonds in the whole map :P
« Last Edit: January 04, 2013, 10:25:02 pm by epic7 »

Offline TheNlightenedOne

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 427
  • Rating: +16/-1
    • View Profile
Re: Re: DrillMiner
« Reply #35 on: January 04, 2013, 10:32:26 pm »
I think that more diamonds would be better, because if you only find 25 or so of the most valuable block in the whole map with no chance of getting more, it'd be kinda frustrating.
"Eris" (Ndless 3.1)
"Keto" (Ndless 3.1)
"Luna" (AMS 3.10, HW4)
"Aurora" (2.55MP)

Offline blue_bear_94

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 801
  • Rating: +25/-35
  • Touhou Enthusiast / Former Troll / 68k Programmer
    • View Profile
Re: DrillMiner
« Reply #36 on: January 04, 2013, 10:33:21 pm »
Perhaps make a way to have (almost) infinite maps?
Due to dissatisfaction, I will be inactive on Omnimaga until further notice. (?? THP hasn't been much success and there's also the CE. I might possibly be here for a while.)
If you want to implore me to come back, or otherwise contact me, I can be found on GitHub (bluebear94), Twitter (@melranosF_), Reddit (/u/Fluffy8x), or e-mail (if you know my address). As a last resort, send me a PM on Cemetech (bluebear94) or join Touhou Prono (don't be fooled by the name). I've also enabled notifications for PMs on Omnimaga, but I don't advise using that since I might be banned.
Elvyna (Sunrise) 4 5%
TI-84+SE User (2.30 2.55 MP 2.43)
TI-89 Titanium User (3.10)
Casio Prizm User? (1.02)
Bag  東方ぷろの

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: DrillMiner
« Reply #37 on: January 04, 2013, 10:38:01 pm »
I could do maps that are pretty infinite, but would the ore abundance keep changing after diamonds start spawning?

Or I could even just avoid that problem by making it only infinite in the x dimension

Offline Ranman

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1354
  • Rating: +83/-0
    • View Profile
Re: DrillMiner
« Reply #38 on: January 04, 2013, 11:07:45 pm »
...
Yeah, I have no idea what I'm doing :P
Have you tried fgetc for reading bytes? It may be confusing since it returns an int, but it's really only reading a character.

int fgetc ( FILE * stream );

Get character from stream.
« Last Edit: January 04, 2013, 11:09:09 pm by Ranman »
Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator. Download available at Ticalc.

Offline TheNlightenedOne

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 427
  • Rating: +16/-1
    • View Profile
Re: Re: DrillMiner
« Reply #39 on: January 04, 2013, 11:08:08 pm »
Or you could randomly inflate/deflate the ore spawn rate every time it generates
"Eris" (Ndless 3.1)
"Keto" (Ndless 3.1)
"Luna" (AMS 3.10, HW4)
"Aurora" (2.55MP)

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: DrillMiner
« Reply #40 on: January 04, 2013, 11:56:20 pm »
Maybe you could try to make like intersection parts, where e.g. coal and iron are all scrambled, but other than that, it's looking nice :D

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: DrillMiner
« Reply #41 on: January 11, 2013, 11:17:51 pm »
Update:

Working collisions!
It's about time!

Also, horizontal movement is now smooth.
Gravity is still linear; it's giving me more trouble than horizontal scrolling.

I think it's time for an alpha release.
Download is below, and if anyone downloads, please tell me if you find any bugs!

I think I got rid of them, but the most persistent bugs were probably the vehicle overlapping the blocks

and floating over openings


Edit: Just noticed how slow it is on the actual calculator
Framerate is still high, but just rather slow :P
I'll should fix that :P
« Last Edit: January 11, 2013, 11:21:13 pm by epic7 »

Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: DrillMiner
« Reply #42 on: January 12, 2013, 02:50:16 am »
It is very nice, but as you said: slow on calc.
 - It's kinda dark when you start it up. Maybe make the sky blue when you start for the first time?
 - some kind of animation while digging. Now I didn't know if i was actually digging or just standing still.
 - you're probably working on that: show how many items you have etc.

wonderful game, epic7 (-7), very nice job!

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: DrillMiner
« Reply #43 on: January 12, 2013, 04:51:22 pm »
I might make digging animation and/or particle effects.
I already have something that keeps track of inventory; it's just a matter of putting it on the screen.
As far daytime, I don't know how to do masking for the sprite, so that wouldn't work at the moment.

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: DrillMiner
« Reply #44 on: January 12, 2013, 05:24:58 pm »
If you know how to display a sprite, do a function that tests if for every pixel the colour is different of the mask you inputted. If so, it displays it, else it does nothing.
« Last Edit: January 12, 2013, 05:25:57 pm by Matrefeytontias »