[Calc Wars] Inspired.

Projects that are no longer in development anymore.

Moderator: MaxCoderz Staff

Patori
Maxcoderz Staff
Posts: 1477
Joined: Sat 18 Dec, 2004 3:51 am
Location: Toledo, Ohio, USA

[Calc Wars] Inspired.

Post by Patori »

Quite simply, I've been inspired....

Anyways, anyone wanna help, calc wars is gonna be open source... i guess... Basically I'm gonna release the code and algorithms here, I'll do my best to code, and us maxcoderz people can work together to debug and stuff, no?

Anyways.... here's my first algorithm... I asked for debugging earlier, and I ask for reaction to it now....

Code: Select all

;//Routines for tilemapping, by Patori 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Before doing anything, I think that it'd be best to plan
;ahead. hehehe. So anyways, I believe I should discuss the
;program structure, nyo? Ok:
;
;
;   char 'F','L','C','L'
;   byte width,height
;   byte DATA --------------->
;   ------------------------->
;   ------------------------->
;       End, no need for termination bytes, that'd be a waste.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; ///Anyways, the way that the tilemapper would work (or, simply put, it's Algorithm) would be as follows, in poorly written C:
;
;   Variables:
;      width = the map's width
;      height = the map's height
;      xentry = xposition to draw from
;      yentry = yposition to draw from
;      bytetostart = pointer to where to start drawing from
;      MAR = Random Access Memory (Level data)
;      tempy = temporary y value
;      function drawsprite(x pos, y pos, sprite num) = self explanitory
;
;   int tileMap(int width, int height,int xentry, int yentry)
;   {
;      //To calculate the max y.... height-4
;      int bytetostart;
;      if (yentry > (height-4))
;      {
;         tempy = height-4;
;      }
;      else
;      {
;         tempy = yentry;
;      }
;      if (yentry < 0)
;      {
;         yentry = 0;
;      }
;      if (xentry < 0)
;      {
;         bytetostart = (yentry*width);
;      }
;      if (xentry > (width-4))
;      {
;         bytetostart = (yentry*width) + (width-4);
;      }
;      if ((xentry < (width-4)) && (xentry > 0))
;      {
;         bytetostart = (yentry*width) + xentry;
;      }
;      //We are pretending that the RAM is a big array called MAR...
;      //FIX THIS
;      for (int y = 0; y < 4; y++)
;         for (int x = 0; x < 4; x++)
;            drawSprite((x*16),(y*16),MAR[bytetostart+(y*width)+x]);
;      return 0;
;   }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;


Many thanks! Oh and tr1p? That computer actually works :-P... so I got a coding machine...
Last edited by Patori on Fri 06 May, 2005 4:30 pm, edited 1 time in total.
Currently coming up with a new signature idea... since my forum avatar changer was killed by an upgrade...
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4132
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

OK, this shouldnt be a problem to code ... 16x16 tiles huh ... is this for grayscale?

And you got'sa coding machine ... sweet! :).

EDIT - OK i just read that it is for grayscale :).
Last edited by tr1p1ea on Fri 06 May, 2005 4:16 pm, edited 1 time in total.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
Patori
Maxcoderz Staff
Posts: 1477
Joined: Sat 18 Dec, 2004 3:51 am
Location: Toledo, Ohio, USA

Post by Patori »

don't worry about coding it... STOP. STOP. I SAID DON'T CODE IT <PICTURES TR1P CODING>

NONONONONONONO! I'll do the coding... I just want to know if my algoithm is ok right now.... I will defenitly have this coded by tonight.... Thanks anyways...

:D I don't like making others work hard on my project...
Currently coming up with a new signature idea... since my forum avatar changer was killed by an upgrade...
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4132
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

OK, rofl i *just* picked up by reading he other thread that you just want to make sure your algorithms work :). Luckily as i was about to start coding away.

Anyway, i know what you mean ... this is your project ... besides i dont think you need any help in the coding department anyway :).
Last edited by tr1p1ea on Fri 06 May, 2005 4:23 pm, edited 2 times in total.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
Patori
Maxcoderz Staff
Posts: 1477
Joined: Sat 18 Dec, 2004 3:51 am
Location: Toledo, Ohio, USA

Post by Patori »

Yeah... I've went a loonnnng way... anyways... I got to submit a lot or things to ticalc.org I've made.... oh well...
Currently coming up with a new signature idea... since my forum avatar changer was killed by an upgrade...
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4132
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

OK i take it that this line:

Code: Select all

bytetostart = (yentry*width) + width;

Is meant to be:

Code: Select all

bytetostart = (yentry*width) + xentry;

?

Also will the sprite routine take a pointer to the actualy tiledata itself or will it take a tilenumber from the level data and find the tile itself? (I dont see anything that refers to tiledata in there).
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
Patori
Maxcoderz Staff
Posts: 1477
Joined: Sat 18 Dec, 2004 3:51 am
Location: Toledo, Ohio, USA

Post by Patori »

Yeah, thanks tr1p... algorithm is changed...
Currently coming up with a new signature idea... since my forum avatar changer was killed by an upgrade...
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4132
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

I was just wondering about the sprite routine ... Will it take a pointer to the tiledata itself? Or just the number ... because if it only takes the number the sprite routine will have to multiply it by the amount of bytes it takes up in memory them offset the tiledata pointer by that. In this case you would need to multiply it by 16.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
Patori
Maxcoderz Staff
Posts: 1477
Joined: Sat 18 Dec, 2004 3:51 am
Location: Toledo, Ohio, USA

Post by Patori »

oh crap... my drawSprite code is at home.....

Anyways... It takes a byte, then is going to djnz through the sprites to draw it... but there are a few things that are different... Like sprite tiles... they are basically in an array of

Code: Select all

struct Units{
int army; //which army
int type; //type of unit
int hp;   //health
int xpos;
int ypos;
}


and they are scanned through and drawn through masking... :) good ol' AND[/code]
Currently coming up with a new signature idea... since my forum avatar changer was killed by an upgrade...
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4132
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Ok, cool. Man you really have put a LOT of thought into this project! That is good to know :).
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
Patori
Maxcoderz Staff
Posts: 1477
Joined: Sat 18 Dec, 2004 3:51 am
Location: Toledo, Ohio, USA

Post by Patori »

well, I'm definatly gonna finish this thing by the end of the year... I want to do other things, such as my PILM and stuff... but anyways... suggestions? Or should we just call this the "Forum that only people named Patrick visit"?
Currently coming up with a new signature idea... since my forum avatar changer was killed by an upgrade...
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4132
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

... HAHAHA That actually made me laugh out loud irl :).

Well as far as i can tell it seems to be ok. Although are you sure all of the pre-processing is necessary? You will be the only one using the routine so you might be able to leave out the error checking unless you are using it as a means of halting the scrolling?
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
Patori
Maxcoderz Staff
Posts: 1477
Joined: Sat 18 Dec, 2004 3:51 am
Location: Toledo, Ohio, USA

Post by Patori »

I am checking whether or not some one decided to scroll off the map :) That could be bad!!! :twisted: happened with my old version...
Currently coming up with a new signature idea... since my forum avatar changer was killed by an upgrade...
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4132
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Yeah, but wouldnt you check for such a thing when the user goes to scroll, rather than when the map is being drawn?
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
Patori
Maxcoderz Staff
Posts: 1477
Joined: Sat 18 Dec, 2004 3:51 am
Location: Toledo, Ohio, USA

Post by Patori »

yeah, that would probably work better... I'll come with a whole new set of algorithms on monday... :)

Yeah, checking everytime the map is drawn would be pointless... wait... isn't this drawn only... OH crap... I remember what I was thinking now....

It doesn't really matter anyways. The map is only drawn during scrolling and attacking... (the attacking is different from the arrow in the GBA versions...) and so, not much processor time would be lost..... <- talk about lazy coding...
Currently coming up with a new signature idea... since my forum avatar changer was killed by an upgrade...
Locked