[내일 배움 캠프 Unity 4기] W10D2 06.18 TIL

김용준·2024년 6월 18일
0

내일배움캠프

목록 보기
37/47

Goals

  • Finalize the personal project

The 'Clicker' game

Since the many other clicker game include the 'Big Integer', I have searched about how to implement the feature on my project. In the System.Numerics, the BigInteger structure exist. Just calling it to Unity script, I tried to use it.

// int count;
BigInteger count;

The advantage of Biginteger were explained in the following Q&A

Q. How can I handle integer with large capacity with C#?

A. Primitive types (such as Int32, Int64) have a finite length that it's not enough for such big number. For example:

Data type                                     Maximum positive value
Int32                                                  2,147,483,647
UInt32                                                 4,294,967,295
Int64                                      9,223,372,036,854,775,808
UInt64                                    18,446,744,073,709,551,615
Your number      305,802,052,421,002,911,840,647,389,720,929,531,201

My project, the clicker game, also faced similar problem. The player can not increase the click count up to ~ 2e+9. To solve this limitation, I revised the count variable to the Big Integer.

profile
꿈이큰개발자지망생

1개의 댓글

comment-user-thumbnail
2024년 6월 18일

훗 ㅋ 이번 TIL은 쉽네요 ^^, 이번 팀프 파이팅 하세요 용준님!ㅎㅎ

답글 달기