Jump to content
  • Advertisement

All Activity

This stream auto-updates     

  1. Past hour
  2. There are a couple things in your post that aren't quite clear to me, but based on what you posted, the first thing that comes to mind is to make the score an argument to assignValue(), and then pass 'this.inputScore' to that function. (You may already know this, but the value of 'this' within a function depends on the circumstances, and in assignValue(), 'this' likely doesn't have the value you want, depending on how that function is called.)
  3. Gnollrunner

    Java's Weaknesses in Game Creation

    As someone heavily into Procedural Generation, I personally think it's just slow. I used to hate Java when it first came out. This was mainly because some managers where I worked tried to force us to use it for things it wasn't suited for. Since then I've mellowed on Java a bit and I've seen some pretty good benchmarks for it. However.... benchmarks aside whenever I actually try to write some high performance code in Java it ends up being a lot slower. I generally program in C++ these days and I'm someone that likes to pull out all the stops. This means things like designing heaps and memory management, reference counting systems, yada, yada . I use all sorts of tricks that just aren't available in Java......Bottom line is at the end of the day Java tends to crawl for me. I know there are a lot of successful applications including certain types of games written in Java. I guess it just comes down to what your needs are. If most of the performance sensitive code comes from external libraries perhaps Java is OK. However if you end up having to code it yourself, IMO using Java is way sub-optimal.
  4. Today
  5. Hello everyone, in the game code below (written using the Phaser framework) I am trying to pass the variable this.inputScore to the global function assignValue. How can I do this? The assignValue function is being read by an external Index.html file on game over and I need this.inputScore to be passed to the Index.html file. I would greatly appreciate any help - new to programming. Thank you. //GLOBAL FUNCTION function assignValue() { document.getElementById("inputScore").value = this.inputScore; //how can I get this.inputScore from the game code below? }; //GAME CODE var CrystalRunner = CrystalRunner || {}; CrystalRunner.GameState = { init: function() { //...code here }, create: function() { //...code here }, update: function() { //..code here //check if the player needs to die if(this.player.top >= this.game.world.height) { this.gameOver(); } }, gameOver: function(){ //..code here this.updateHighscore(); //..code here }, updateHighscore: function(){ this.highScore = +localStorage.getItem('highScore'); if(this.highScore < this.myScore){ this.highScore = this.myScore; this.inputScore = this.highScore; //I need this.inputScore to be passed into the assignValue function this.submitScoreButton = this.game.add.sprite(this.game.world.centerX-135, this.game.world.centerY+100, 'submitScoreButton'); this.submitScoreButton.events.onInputUp.add(function() { window.location.href = "index1.php"; //Index1.php will have a form input value into which this.inputScore will be passed }, this); } localStorage.setItem('highScore', this.highScore); }, };
  6. Very nice, definitely relaxing and captures the coldness as well as the serenity. I liked the use of arpeggiation a lot to bring out some variety and motion, and the register change near the end closes it out nicely. I would wander a snowy forest to this (especially if some story or lore just got hinted at recently... it has just enough tension for that kind of thing, I feel). Edit: I also like the softness of the instruments, almost as if they themselves are dampened by snow.
  7. I haven't, but I am curious about them, and what they can do (I could RTFM, but I'm still crawling through Cubase's 1200 page .pdf - fortunately it's mostly familiar things in occasionally unfamiliar places so far). Nuendo seems a big bonus to Cubase for professional sound design, but it is an expensive upgrade to bite before I could say I realistically know what I am doing with game audio, beyond designing sound fx or possibly writing music.
  8. I find this question interesting as an electronic musician interested in working with game audio in sound design, audio engineering, and scoring. Things like adaptive soundtracks are fascinating to me, but I am simply not a programmer - and I know a lot of those things (as well as engines I hope to work with in the future like KYMA, but I digress) require at least a fair bit of scripting knowledge. Like right now I use Cubase, which is a great DAW, can sync to video, but then there's Nuendo which has all kinds of other scripting options and integration with video game engines. I'm really interested in the process by which sound is incorporated into games, so I guess I'm kind of piggy-backing this thread for replies which I'd find relevant too. I know a lot can be done in terms of scoring and sound design just in a DAW or modular environment, and sent off to the programmers as raw audio, but I know that especially nowadays that has limitations. I still want to learn more about programming, as well, but am mostly curious how much a "serious" freelance sound designer "ought" to know, before one can consider oneself remotely serious.
  9. slayemin

    Shipped a pilot

    (Warning: Rambling ahead!) I met a new client in the beginning of November through a friend. The client asked my friend if he knew how to use Leap Motion. He said, "No, I don't, but I know the just guy who does! Eric is probably one of the best Leap Motion developers in the country.", and a referral was sent my way! I need to remember to buy my friend a nice dinner as a show of thanks. Anyways, this project was interesting for a variety of reasons. First off, the bulk of development was being outsourced to Ukraine. The outsourcing of work meant that the project owner needed to work late into the night to coordinate efforts with his Ukraine team. They were having some problems with the wrist joint causing the mesh to twist (candy wrapper effect) and nobody was making much headway. So, I was brought into the project. I downloaded the full project, tried it out to see where they were at, saw the problems, and then I started looking at the implementation. Pardon my unprofessional trash talk here, but the implementation looked like it was being held together with bubblegum and duct tape. I told them that I was going to redo the project. It was such a simple project that it took me about two days to rebuild. I was able to simplify, condense and cut about 75% of whatever those Ukrainian guys did, and it was a "correct" implementation which was maintainable. It was valuable as a throw away prototype, but for production work, it needed to be redone. I told them, "If you can't tell the difference between what I did and the original, it means I did my job right." This is always a tough sell for non-technical people, but you see the real value as the project progresses. When everything is done right from the very beginning, you skip over lots of problems you would have otherwise had (which costs time, energy and money). As far as project implementation goes, this was a super easy project (for me) because I had already done several similar projects and had built out a template library to use. The hardest problem was actually dealing with the wrist and elbow joints with leap motion. So, I'll describe some of that pain here: The initial problem was that when you rotate your wrist (roll along arm axis), the wrist bone rotates but you start to get some pretty bad deformation of the arm mesh, to the point where the wrist gets pinched to look like a candy wrapper. The problem was a combination of technical implementation, incorrect rigging, incorrect mesh weighting, and a bit of fighting the leap motion plugin. Fixing the problem can be sort of described as trying to straighten wet spaghetti noodles, because so many different factors contributed to the problem. There was no single silver bullet fix that magically fixed it all. My greatest secret weapon was my strong debugging skills and approach to debugging. Although my client liked to call other experts with industry experience, they could only do vague hand waving and guess work at the causes of the problem. The true, best way to figure out what's going on is to dig into the problem, get deep into the weeds, add a ton of debug scaffolding code and visualization helpers, and really spend the time and effort to look at what's going on. A slow, methodological, scientific approach is tried and true for me and far more illuminating than the guesswork of experts unfamiliar with the project. As far as skeletal rigging goes, I ended up downloading a freely available Paragon character with exposed arms with rotating animations. I looked at the bone setup. To fix the candy wrapper effect, you need two twist joints in the arm, parented off of the elbow joint. The wrist twist joint needs to be about 1cm away from the wrist. You also need a forearm twist joint in the middle of the arm. When you apply roll rotation to the wrist, you only apply roll to the wrist twist joint but yaw and pitch are handled at the wrist joint itself. You also need to take about 50% of the wrist roll and apply that to the forearm twist joint as well. Otherwise, you start to get bad mesh deformation and loss of volume. You also need to be very robust with your mesh weighting on each of the bones. It's good to use a working reference model to get an approximation on the best vertex weights. There were also some challenges with the out of the box leap motion plugin as well. The problem is that you get the wrist transform, but the rotation values are for the wrist joint itself, not for arm twist joint roll values. I discovered that I needed to derive my own arm aligned wrist rotation, relative to the elbow position. The rotational value needs to be independent of wrist pitch and yaw. Anyways, I won't get into the vector math required to do that, but I ended up having to derive these rotational values myself. It's important to note that the wrist joint is being driven by the user (via IK) and the elbow is an intermediate joint, with transforms being set by the IK solver. The user can put their arm into any position and contortion, and the virtual arm you present needs to match as closely as possible with the physical arm location. This is really hard to get right because the animations need to support *anything* the user does -- any popping or glitches are obvious and break immersion. Doing good elbow placement with limited data has been one of the harder challenges facing most VR developers, so it hasn't been a well solved problem. Most VR developers will skip it all together and just show people a pair of disembodied hands at the motion controller locations, but if you are trying to use a full body avatar for the player character, it's a problem you eventually need to solve. I think I did a pretty good job on the elbows. I also made a discovery about the hardware capabilities of leap motion: Though this shouldn't be a surprise, the leap motion has great trouble finding elbow placement when people are wearing coats or sleeves. If you want reliable elbow tracking, you need to take off your coat and roll up your sleeves. You also need to be very aware of bright light sources in your environment because those light sources will interfere with leap motion. Keep in mind, the leap motion uses an IR camera to to track hand gestures, and the HTC Vive uses two laser base stations which emit IR lasers, so there is a slim chance that you can get laser base station interference, depending on placement and what direction you're looking. And... if it's not obvious, sunlight causes bad tracking environments for leap motion. Anyways, I nailed it on this project. You can pretty much do anything with your arms and the digital avatar will do the same thing. I'd show a video of the result, but I think the NDA restricts me from showing that. I don't think I'm the "best" leap motion developer in the country, but I'm firmly in the top 10%. My bigger worry about Leap Motion right now is the health of the company and what that might mean for their product. Are they going to be in business two years from now? Who knows. But, the library of content built for their hardware platform is slowly growing. On a VR production side note, I made an amazing discovery in this project. If you setup an Oculus to work from your chair, you can develop in VR using the built-in desktop virtualization app. As long as you can type without looking at the keyboard, you can develop in VR. Instead of having a 17 inch monitor, you can have a 5 foot screen in VR. And if you want, you can drag out windows and surround yourself with as many screens as you want. This taxes the GPU a little bit, but who cares? The beauty about this is that if you're developing VR content, you don't have to keep on putting the headset on and off between development iterations. Since you're already in VR, switching between your IDE and your VR app is reduced to a single button press. I worked like this for several days to see how I liked it and if it was feasible. I thought I'd get sweaty face, eye strain, or have some other related draw back issue. Aside from not being able to see my keyboard, it was pretty solid! There are small preference issues I'd like to change. I prefer to listen to music on youtube while I work, and when I work in VR, I am stuck with the ambient music in the oculus home environment, and switching between IDE and project switches the audio (this should be a preference). What's extra magical about working in VR is that it has a pair of headphones and a microphone embedded into the hardware, so if you wanted to do a VoIP call over Google Chat and do screen sharing, you can do it all in VR without taking off the headset! I truly believe this is going to eventually become the future of how people work and interact with computers and each other. I feel like I'm on the bleeding edge here and I saw a glimpse of the future, and damn, it looks awesome! In closing, this project was relatively small and simple. I was instrumental in shipping it. I feel that I have a fantastic relationship with my client, they are extremely happy and impressed with the work I did, and I will be their go to guy for future VR work. This is how you get repeat business and build a financially self sustained company. Now, if only I knew how to market myself... There's another potential upcoming VR project with a much bigger budget that I am extremely excited about. I can't go into details, but I will say... if we get this and pull it off, it's going to create a new industry and there will be lots of magazine articles written about what we did. My experimental research work in AI will not be wasted. Spellbound: As far as Spellbound work is concerned, I still work on it on the side, between projects. Since this is going to be mostly a story driven VR game, I've been focusing a lot on the story writing. It feels weird to open up a google doc for my game story and say I'm going "game development". It's creative story writing, not code writing. And... it's just as hard. I've gone through probably 10 different iterations of the story so far and scrapped most of them. I'm finding that the story writing for VR is extra hard and takes a LOT of time. You need to write it like a movie manuscript, but you also need to think about presentation and the fact that the story is not consumed linearly. If you're an indie on a budget (like me), then you need to consider that every word costs money and player patience, so if you're excessively verbose, it's going to be expensive and nobody wants to sit through long, boring performances. You also have to consider the localization angle: If your scripts have lots of sophisticated word play and language based puns, you are going to hate yourself when you need to localize for different audiences. Short, simple, sweet, to the point, well worded. A story isn't about how flowery and eloquently you can write your sentences, it's about retelling a sequence of emotional events which leaves an impact on your audience... I recently realized that the story writing doesn't need to be done from an omniscient point of view where you tell every important detail, it can be done from the point of view of the story writer (an in-game historians perspective, if you will) who has a limited point of view. This let's me skip details up front, hide them a bit, and do a big reveal later on in the plot as a twist in the story. With this style, you can experience the story twice and see the plot structure and make new sense of various setup clues (similiar to how you can watch the movie "The Sixth Sense" twice and get two completely different viewing experiences). Here is the dressed down storybook intro for Episode 1 in Spellbound: [This is the story book intro. It is presented as a series of illustrated pages in a book and is read by a narrator. We have accompanying voice over lines and sound effects to go along with the story, so that it feels almost like a cinematic.] Page 1: Thousands of years ago, evil wizards and witches opened the gates to hell. Swarms of demon spawn entered into the mortal realms, lead by the arch demon Asmodeus. Page 2: No army could stand against the demon spawn. Cities were reduced to rubble and ash, tens of thousands of people fell to their blades like wheat to a scythe... Page 3: When all seemed hopelessly lost to darkness, the eastern horizon erupted in a blinding glow of shimmering light. Asmodeus was no more, and his leaderless demon spawn retreated to hell. Page 4: Nobody quite knew what happened or how they won, but one thing the remaining kings agreed upon was the outlaw of magic and the execution of all its practitioners. Page 5: People were finally safe again... all but for wizards and witches. For thousands of years, those who even *looked* like they could be magical, were hunted down and killed in every kingdom. (Short pause / transition break for establishing shot) Page 6: On the edge of the Blackwood Forest, in a small hamlet named Halfordshire, a humble pair of farmers welcomed a new boy into the world. After seeing his fire red hair, Father named him "Rupert". Page 7: Rupert grew up, as all young boys do, and trouble followed naturally, as it does with all young boys. Page 8: But the natural troubles of boyhood soon turned into supernatural troubles which seemed to haunt Rupert everywhere he went. In a freak magical accident, his home was utterly incinerated. Only Rupert survived. Page 9: As he stumbled out of the smouldering cinders of his former home, the villagers could see that not even one red hair on Rupert was burned. Was it a miracle? Page 10: As the initial shock wore off, villagers began to shout that he was a witch. Fearing for his life, Rupert ran, and he ran, and he ran, deep into the Black Forest. As day turned to dusk, the village hunters abandoned the hunt. Page 11: Rupert survived through the night, wandering through the forest for days, getting hungrier and hungrier. He stumbled upon an old tower of crumbling stone, and made it his new home and lived off of whatever edible bark, berries and mushrooms he could find in the forest. Page 12: Rupert lived in the crumbling stone tower for years, completely alone. Whatever was haunting him, seemed to follow him everywhere he went. What he didn't realize is that the next morning, his life would be changed forever...
  10. HunterGaming

    Unreal Engine 4: Level Streaming Demystified

    Little update I just found out. It wasn't spawning the player because I didn't set the game mode overrides for the persistent level. However the player character still doesn't seem to be placed at the player start. I still have to move it to there.
  11. I am curious, if anyone would be interested in an RPG Adventure in a visual novel art style? I loved Doki Doki and if I could create something in an RPG element, that would be THE BEST. I am a complete noob however, that is the thing. Like I just started adventuring into coding two weeks ago. I love it so far. I think I may be addicted. oof. Which is why I want to create something I have that itch. lol. Basically if anyone who wants to pitch in for free, or not I'd be glad to include them in the credits section. Also, I'd love to get the community involved in this, to create more fun RPG-esk things if that makes sense. Where would I go for that?
  12. blesseddisciple

    Java's Weaknesses in Game Creation

    I am moderately experienced with Java and I love the language, it is the most popular (arguably) language in the world, has rigid but proper and effective structure, great support and libraries, and honestly the speed thing is a non-issue for 95% of applications. If you are using heavy 3d rendering or very heavy sprite movement densities, you might have some slow downs but even still, tests have shown Java to be very close to C++ in most performance situations. It's true C++ is faster, but honestly, the difference isn't affecting much. I myself am just going back to Java for games after having left HTML5/JavaScript browser development. I find returning to Java to be refreshing as the language is structured in such a way that it almost forces me to program well, and quickly tells me when I don't! Instead of some other languages making me debug for 9 hours over a missed parenthesis. Let me know how your development goes if you decide to stay with Java and I will help where I can.
  13. Mapet

    Game code architecture

    Hello again after long break. Job stopped me from diving into my project, but I have come back . I read articles about ECS and it looks promising, but i have several questions about it. I think that i catch the idea of ECS, but few implementation aspects are unclean to me. In first place in a few sentences I will say how I understand ECS: 1) Each game object is an ECS entity. The Entity have just ID and a list of components. 2) The Components are just sets of data containing selected pieces of information (for example PositionComponent will have just float x,y,z position, RotationComponent - float rad/deg/quaternion etc.) 3) Systems are logical units that process all Entities which contain selected components (for example RenderingSystem will require TransformComponent and TextureComponent). So there are not really another classes for each game object like enemy or spawn point, but I have to just add required components to new Entity. I can "save" entity as prefab, so I can quickly reproduce game objects without adding new components manually. Now my questions. I have some ideas, of course, but it would be great to read your recommendations. 1) If im correct, I need something like EntityManager class that contains all entities, allows to create new ones, destroying unwanted and so on. 2) I think, i cannot check in each system every entity in terms of containing specific components. How should I do it correctly? Maybe should I create lists for each type of components and keep references / entity id / component id? It is even possible to automatize? I mean i could write it like that, but then if I add another component I have to remember to create list corresponding to it. This can be in my opinion optimized, but I dont know how at this moment. 3) Where logic of selecting entities for computations in specific system should be? In each system seperately? Somehow select entity that have required components -> processing -> do it while there still are entities or Create a SystemManager where systems are registered and loop over all entities and process them in required systems? This looks nice, but I have feeling that I should process each system one by one, not all systems for each entity (but thats just feeling). 4) Specific systems and components should be part of my ECS Module? I mean lets suppose im writting two different games using my ECS Module. First game is 3D game, second 2D. In first game TransformComponent will have float x, y, z fields, in second - float x, y. I know that "perfect is the enemy of good" but I'm wondering, how could I go around this? 5) How systems are communicating? Is it even required? For example i have InputComponent in which I have list of pressed keyboard keys. How should I change its values? In InputSystem which reading keyboard and updating list od pressedKeys? But then I need good order of executing systems mentioned before (input have to be processed before anything other or I will get 1 frame delay which can be annoying in for example hardcore platforming game). Thats all my ideas, questions and thoughts. Tommorow i will start writting something, but I am looking forward to your advice.
  14. blesseddisciple

    Shooting a ball in java

    Honestly, for a basic 2d game, there is no need for an engine. You just need to use some critical thinking and some programming skills and you can easily hand code your formula for a bullet trajectory. Basically how a bullet works is that it is fired at max force and min. gravity effect. As the shot line (let's say coordinate x) increases, the the fall line (say coordinate y) increases. The trick is that with each increment, the x velocity slows down more sharply, and the y velocity increases more sharply. Many ways to code this, just get creative and think about what needs to happen at the beginning, end , and each step of the bullet life. The biggest factor is how far you want the bullet to travel at max distance, use that to figure out your algorithm for controlling velocity and bullet drop. Regarding 2d games, you didn't say whether it is FPS, top down, side scroller.. But, regardless, you can easily do almost anything you need by simply using the AWT library. Drawn graphics, sprites, etc.
  15. So I have a decent amount of JavaScript experience now and decided I was gonna lower my head and start cranking out some 2d games, partly to learn, partly to have fun. Afterall, HTML5 canvas is such an easy and enticing medium. I love the JavaScript implementation of it. But after literally struggling for a week to get basic game functionality working I have had enough of the little stupid bugs that pop up with JavaScript. Don't get me wrong, I still love the language for scripting. I'm just not going to spend 20 mins coding and 5 hours debugging just because the language is crap. I've decided to return to my previous endeavor, Java. I like Java a lot and the only reason I haven't pursued more in the way of game development is just for the fact that Java is limited to mobile or PC apps that may never see the light of day unless it's hosted on some obscure Java game hosting website that is populated with 2,000 half developed games that no one will ever care about. BUT, still, I enjoy hand coding and I know C# but don't feel like using Visual studio and I really don't wanna hand code C# on the .Net or whatever. I use Visual Studio for business apps (ASP.NET) but I don't wanna build a game with it. So, does anyone have any points to share about why moving to Java for game development is not smart? Besides the whole, "Java is slow" thing. I mean things that might make it harder in JAva to make games vs. in other languages. Please share your thoughts.
  16. If so, I think the problem is with the contents of isSlotTaken.
  17. This is what I thought as well, I have done some tests and I also think this is how it works.. but I copied the code from stack exchange, so I do not really understand why it works. I think that there is just a problem in my logic not setting true after completing, so in some it is resolving false when I think it should be true. No not really. I have only been coding for about a week, and learning from a book called "The C# Players Guide". I am using the free visual studio and if I press f5 and there is an error I can see some issues in the log thing. I do not know about breakpoints and stuff though or how to "watch" variables or w/e. I assume the book just hasn't gotten to that stuff yet. This looks like it also works.. I did a test but I do prefer the simple format of the other way, now I know it actually functions as I thought it would. I've edited the OP Title to include that I am, indeed, talking about C#
  18. Yesterday
  19. Hey there, I've finished a new project and wanted to post it here as I think it's the best thing I've ever done, thanks so much for your time
  20. babaliaris

    Textures, some work and some doesn't???

    Forcing stb_load to use 4 channels solved the problem but why the code below does not work? What I'm doing is checking if division by 4 is an integer. If it's not an integer the do alignment by 1 else do alignment by 4. Texture::Texture(std::string path, bool trans, int unit) { //Reverse the pixels. stbi_set_flip_vertically_on_load(1); //Try to load the image. unsigned char *data = stbi_load(path.c_str(), &m_width, &m_height, &m_channels, 0); //If the size of each row is not divideable by 4 // then use alignment of 1. float check = (m_width*m_channels) / 4.0f; if (check != ceilf(check)) { std::cout << "working" << std::endl; glPixelStorei(GL_UNPACK_ALIGNMENT, 1); } //If it is divideable by 4, use alignment of 4. else glPixelStorei(GL_UNPACK_ALIGNMENT, 4); //Image loaded successfully. if (data) { //Generate the texture and bind it. GLCall(glGenTextures(1, &m_id)); GLCall(glActiveTexture(GL_TEXTURE0 + unit)); GLCall(glBindTexture(GL_TEXTURE_2D, m_id)); //Not Transparent texture. if (m_channels == 3) { GLCall(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, m_width, m_height, 0, GL_RGB, GL_UNSIGNED_BYTE, data)); } //Transparent texture. else if (m_channels == 4) { GLCall(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_width, m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data)); } else { throw EngineError("UNSUPPORTEWD"); } //Texture Filters. GLCall(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)); GLCall(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)); GLCall(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST)); GLCall(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); //Generate mipmaps. GLCall(glGenerateMipmap(GL_TEXTURE_2D)); } //Loading Failed. else throw EngineError("The was an error loading image: " + path); //Unbind the texture. GLCall(glBindTexture(GL_TEXTURE_2D, 0)); //Free the image data. stbi_image_free(data); }
  21. babaliaris

    Texture mapping acts weird on some images.

    @Cararasu please take a look on this thread too. Lets have a conversation there as well. I just solved it by forcing 4 channels to be used but I would like to ask you something else too. I'm going to post right now in that thread.
  22. Cararasu

    Texture mapping acts weird on some images.

    Well if you use 4 channels then the size of one row is always divisible by 4 so there can be no issue because of weird line-sizes. An issue might appear if the data pointer returned by "stbi_load" is not divisible by 4. I do not know if stb guarantees a certain alignment, but I would be very surprised if you ever get a pointer that is not at least divisible by 4. So yeah you should be safe when always using 4 channels. Additionally, I think most hardware does not store RGB images tightly. They will leave space for a fourth value because of (surprise surprise) 4-byte alignment. That means you do not lose anything in terms of GPU-memory when using RGBA over RBG. I am not 100% certain about this, so if there is anyone who has more in-depth knowledge feel free to enlighten me😉
  23. You should probably mention the progamming language used somewhere in the post. It looks like it's C#, so I'll assume that. With the given example, I think draw will be true if every element of isSlotTaken is a bool with the value true. This sounds like a problem you should look into using a debugger -- are you familiar with debugging techniques? Breakpoints, etc.
  24. babaliaris

    Texture mapping acts weird on some images.

    Thank you so much! That was the issue! Just from curiosity, instead of glPixelStorei(GL_UNPACK_ALIGNMENT, 1) if I always force stb image to use 4 channels (no matter how many channels the source file might have) because RGBA is 4 bytes, will this ever be problematic? In my case now it's working and I can see the image being rendered just fine.
  25. If you want to cycle through an array it's pretty easy, you can use for loops, or foreach. For example, if you need to check all values in the array to be true then you would do something like this: bool allValuesTrue = true; for (int a = 0; a < array.length; a++) { if (array[a].status == false) { allValuesTrue = false; // Code to exit loop } } The second something isn't true there is zero point in checking the rest if you need all to be true, and you can safely exit out. Also when posting code questions, please indicate the language you're using.
  26. Cararasu

    Texture mapping acts weird on some images.

    No that's not OpenGL ES. I just looked it up and it seems that the 4-byte alignment rule also affects normal OpenGL even though it is not mentioned directly in the description of glTexImage2D. The problem seems to be a common one. They even put it inside the common mistakes section of the OpenGL-wiki: https://www.khronos.org/opengl/wiki/Common_Mistakes#Texture_upload_and_pixel_reads To fix the issue either make sure that the alignment of each row is always 4 bytes. or call glPixelStorei(GL_UNPACK_ALIGNMENT, 1) before glTexImage2D. The problem with changing the alignment rules is that uploading the texture can be slower than if the alignment is not 4-bytes.
  27. Hi there... I am having a issue in C# with checking if all the values in a array are True... I'm getting strange behaviour... so I wanted to ask to make sure this code is correct.. or if there is a deeper problem with my logic after this test happens... // Check for Draw bool draw = isSlotTaken.All(x => x); if (draw) { rungame = false; winner = "Draw"; } Will that IF STATEMENT resolve is every single value in the bool isSlotTaken is set to true? Thanks!
  28. babaliaris

    Texture mapping acts weird on some images.

    glGetString(GL_VERSION) reports: 3.3.13541 Core Profile Context 24.20.13019.1008 How can I see if it is OpenGL ES? Does the above information says that I'm using regular openGL?
  1. Load more activity
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!