I’m currently working on a war game in ti basic, as the title implies I wanted to make it in a hex grid like the civ games. The biggest hurdle of this project was and will be the graphics, which were especially difficult as I wanted to be able to color certain tiles completely in order to show which team owned it. As of the moment I have that algorithm and all other rendering algorithms done I just have to optimize it slightly. What I have left to do is gameplay mechanics as well as a simple AI. I’m also going to refine some of the UI elements to make it more responsive and look better.
Sounds cool! Make sure to post source and screenshots when you can; I’m interested!
I suspect that elfprince13's previous work creating a hex grid rendering engine for his own game might be relevant and helpful.
I did something too, but it's not too remarkable.

Filling in hexagonal tiles is relatively simple, just process it as two trapezoids and a rectangle.

^im sorry if those links don't work I'm kinda bad at this
I decided that I wanted to make my own hexagon rendering engine, both because I wanted to have both "wireframe" and shaded rendering of the hexagons and I could easily base the scaling of the screen from the render. here are some of the screenshots, the game is capable of having a team capture some of the lands instead of just sitting in the corners as they are in the pictures but there are some glitches blocking it at the moment

(also i know the tiles aren't centered its bothering me just as much as its probably bothering you)
Very nice UI so far, and the hexagonal rendering looks great. How fast is it? I can't image shading those hexagons isn't quick.

Also, is this game based (or planned to be based) at all on Slay?
kg583 wrote:
Very nice UI so far, and the hexagonal rendering looks great. How fast is it? I can't image shading those hexagons isn't quick.

Also, is this game based (or planned to be based) at all on Slay?


I didn't intend for it to be so similar to slay but it's game mechanics will be very similar, also it is not fast at all and I'm working on more efficient ways of shading the hexagons
Looks pretty neat! Also, I don't know if you noticed this, but there seems to be some overlap with shading and drawing of the tiles, making that fill cleanly would make the graphics better, in my opinion. Can't wait to see the end product! Also, I like these kind of games Razz
SM84CE wrote:
Looks pretty neat! Also, I don't know if you noticed this, but there seems to be some overlap with shading and drawing of the tiles, making that fill cleanly would make the graphics better, in my opinion. Can't wait to see the end product! Also, I like these kind of games Razz


I didnt notice that! ive now cut down its render radius by a minor amount to compensate for this but some still does spill out over the edge but if i decrease it any further it wont fully fill the hexagon because the overlap is just caused by rounding in the line function



heres what it looks like now

ive implemented a rudimentary AI that seems to be running fairly well, ive also optimised the render algorithm further so now its an almost bearable render time although you can see that it caused there to be small holes in the shaded regions which i might fix later. in the screenshot above ive just set up 4 ai to fight against each other which is why no ui shows up cause there is no player to render it for.
I know a way you might be able to speed up your hexagon rendering, though this is purely speculation.

As you know, the calc runs it's own functions faster that it runs TI-BASIC programs, and I think you may be able to take advantage of this. Try using a hex code to declare the graphscreen "clean" and then draw a polar graph at the point you want your hexagon using the equation r=.01(theta+x)+y or something, but changing your rStep to pi/3. You'll have to play around with it a bit, but I think you can get the calculator to render the hexagons very quickly if pulled off well.

EDIT: I'm not sure if DrawF works for polar graphs, but if it does then use that.
Very cool stuff. The screenshots look great!

There are some people in this community who are pretty darn good at optimizing BASIC, if you could post your hexagon filling code, I'm sure someone would optimize it for speed. There are a few relatively non-trivial ways I can think of speeding it up if you are doing it only slightly incorrectly. Others are far cleverer than I am, so they'll probably see some I could only dream of. Thus is life.
_iPhoenix_ wrote:
Very cool stuff. The screenshots look great!

There are some people in this community who are pretty darn good at optimizing BASIC, if you could post your hexagon filling code, I'm sure someone would optimize it for speed. There are a few relatively non-trivial ways I can think of speeding it up if you are doing it only slightly incorrectly. Others are far cleverer than I am, so they'll probably see some I could only dream of. Thus is life.
CC23: Hexagon filling
Sam wrote:
I know a way you might be able to speed up your hexagon rendering, though this is purely speculation.

As you know, the calc runs it's own functions faster that it runs TI-BASIC programs, and I think you may be able to take advantage of this. Try using a hex code to declare the graphscreen "clean" and then draw a polar graph at the point you want your hexagon using the equation r=.01(theta+x)+y or something, but changing your rStep to pi/3. You'll have to play around with it a bit, but I think you can get the calculator to render the hexagons very quickly if pulled off well.

EDIT: I'm not sure if DrawF works for polar graphs, but if it does then use that.


As far as I can tell drawF does not work with polar functions, also after some testing it only offers a very minor improvement over the already quick line drawing method
_iPhoenix_ wrote:
Very cool stuff. The screenshots look great!

There are some people in this community who are pretty darn good at optimizing BASIC, if you could post your hexagon filling code, I'm sure someone would optimize it for speed. There are a few relatively non-trivial ways I can think of speeding it up if you are doing it only slightly incorrectly. Others are far cleverer than I am, so they'll probably see some I could only dream of. Thus is life.



Code:

“S is size, X is X, Z is Y
1→R
6→S
√3→M
(2remainder(x,2)-1)(.25√3)→C
for(k,0,180,S/1.1R
1/sin(90-(K-60int((K-30)/60)-60))→R
.85R→R
Line(1.5X+Rcos(K+210),MZ+C+Rsin(K+210),1.5X+Rcos(K+30),MZ+C+Rsin(K+30)
End

Here’s the hexagon shading code (yes I know my approach is strange) I’m not sure how to optimise it further but I’m by no means an expert on ti basic.
EDIT: some of the scaling might be off if you try and test it yourself cause it’s very fine tuned for the game itself
ive made a bunch of minor additions and tweaks to the program such as adding a loading fuction and finally centering the map in the middle of the screen. i also thought i should mention and show you the programs ability to change the map size and scale the hexagon shading accordingly although it gets a little iffy at higher sizes just due to the screen resolution limitations





so far all i have left to do should be just checking if a player has won the game and also some optimization of the ai algorithm and i should have a functioning beta that i can release
Where can I get your hex game?
Why not check for it in the "Downloads" section of the site? (Also, please do not necropost, unless you have a VERY good reason for it. Try the search bar first. Very Happy)
I never saw this post fly past in 2019, but someone should really optimize that rendering code for speed Rolling Eyes
I've tried, but I couldn't find it. I also don't know the name

[quote="TIny_Hacker"]Why not check for it in the "Downloads" section of the site? (Also, please do not necropost, unless you have a VERY good reason for it. Try the search bar first. Very Happy)[/quote]
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement