Sign in to follow this  
Tojiro67445

Unity Tutorials and Unicode

Recommended Posts

I've been working on a series of C++ programming tutorials lately (doesn't really matter what about for this context) and I've come across an issue that I can't decide which way to go on, so I thought I'd ask the community that the tutorials will be targeted to: How should I approach unicode? A little bit of relevant background - The tutorials are of such a nature that they don't require unicode to operate. They also aren't aimed at absolute beginners but instead at people who are familiar with C++ and want to learn more about the subject. The tutorials are Windows centric (at the moment) but the Windows specific code is mostly hidden away in, and I have no real interest in teaching Windows only techniques. I'm trying to push some good programming practices in the tutorials, such as a clean class structure, namespace usage, and use of the standard C++ libraries where applicable (std::string should be your friend!). I personally would think that ensuring unicode compatibility is one of those "good programming practices", but I don't think everyone shares that opinion. So the question, once again, is how to approach unicode in the tutorials. I can see a few approaches at the moment: a) Ignore Unicode. It's a pain to use, won't benefit many users, and I don't want to deal with it when trying to learn about a different subject. b) Post an ASCII and Unicode version of all the tutorials. It's a royal pain, but gives users the option to use only what they want. c) Allow each tutorial to compile in both ASCII and Unicode. It will clutter the code somewhat, but allows the best of both worlds. (Although to tell the truth I'm not even sure if this approach is practical. Are macros like _T() cross-compiler/platform?) d) Go Unicode only. Unicode is a necessity for a flexible and long-lived code base and it will benefit the users to learn it now if they haven't. So what's your opinion? I know it probably seems like I'm obsessing over something that doesn't really matter, but fact is if I had my way I would do everything Unicode only and I don't want that to scare anyone away if it's going to be viewed as a big determent. Thanks for the input!

Share this post


Link to post
Share on other sites
Unicode isn't relevant, unless it's the focus of the article, in the same way portable code isn't relevant unless it's the focus.

Portable/I18n compliant code is verbose, complex and even the often misses the mark, since the devil is in the details.

Tutorial teaches one single focused topic. Otherwise it becomes more than tutorial.

A car driving tutorial isn't about controlling skid on moist road at 3 degrees with certain tires. It's 1) Rotating the steering wheel, 2) pushing the pedals and 3) shifting gears. Anything else is a distraction for tutorial and becomes advanced driving guide for people who have over 10,000 miles already - or they won't benefit anything without having good grasp of basics.

Additional problem comes since you're targetting C++, which, while it does support unicode, doesn't have adequate solutions for important I18n issues.

Share this post


Link to post
Share on other sites
Quote:
Original post by Tojiro67445
c) Allow each tutorial to compile in both ASCII and Unicode. It will clutter the code somewhat, but allows the best of both worlds. (Although to tell the truth I'm not even sure if this approach is practical. Are macros like _T() cross-compiler/platform?)


I believe mbstowcs() is the most portable function to convert to unicode, with wcstombs() the way to turn back, they are from stdlib.h. They accept input from cstrings.

On Windows you can WideCharToMultiByte() for Unicode to ANSI, MultiByteToWideChar() for the other way both can be used from just including windows.h.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Forum Statistics

    • Total Topics
      627697
    • Total Posts
      2978680
  • Similar Content

    • By Pixelated_Nate
      Hi all!
      We are looking for a C# programmer for our 2D Action RPG titled Adavia, made in Unity.
      The game itself is akin to Legend of Zelda: Link to the Past, though we're also adding in traditional RPG elements such as Character Creation.
      This is more of a hobby than anything commercial, if it somehow does manage to go commercially, all revenue will be split equally among the team.
      If you're interested, we ask that you be comfortable with:
      Coding A.I's for enemies and NPCs. Working with GUI's. Communicating regularly with the team via Skype (text only). If you have any questions or would like to apply, please contact me at nathan.jenkins1012@gmail.com
       
    • By ilovegames
      You are the commander of a special forces squadron. You were given a task that appeared simple at first glance - to check for suspicious activity in the building of an abandoned psychiatric hospital. But you could not even imagine what you will actually have to face.
      Download https://falcoware.com/HospitalSurvival.php



    • By ilovegames
      You find yourself in an abandoned place full of mutants in the dead of night, and have to kill waves of monsters with a different kind of weapon. The main goal is to survive through the night.
      Controls:
      WASD – Walk
      Shift – Run
      Mouse1 - Attack
      Space - Jump
      Scroll Down – Change weapon
      Esc - Exit, pause
      Download https://falcoware.com/NightSurvival.php



    • By ilovegames
      "Lost Signal" agency investigates paranormal events from all around the world. You are one of the agents who participates in the research of various artifacts. Investigate paranormal activities in this 3D game which has great action and elaborate 3D graphics.
      Interesting quests and creepy monsters await you!
      Download https://falcoware.com/TheLostSignalSCP.php



    • By trjh2k2
      I've never really been a "Unity guy", since all of my game-dev learning happened in C++, and in other engines, but I recently discovered the "complete projects" section in the asset store.  It's full up on projects you can buy that are billed as "ready to customize and release", with full ad integration.  Some of them claim to be for educational purposes, but why would you include a complete, polished, full featured game with ads as an educational example?
      This leads me to the question of why this goes by unchallenged?  Does Unity and the environment of the Unity Store actively encourage this style of game development?  Is the problem of asset flipping our own fault?  I don't mean this as a "we should make Unity shut this down" kind of thread, but rather just to examine whether or not the environment of being able to just buy whole games or pieces of games is something that damages the industry.  I get why Unity would allow it, and I'm sure it's a working business model for some people- and maybe some people DO actually just use these to learn from, but I'm not that naive as to think that there aren't people who recognize this as one of the shortest paths to putting a game on the market so they can cash in.
      Thoughts?
  • Popular Now