Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!

Olof Hedman

Member Since 24 Aug 2011
Online Last Active Today, 05:44 AM

#5231455 Interpreter stack question

Posted by Olof Hedman on 28 May 2015 - 05:41 AM

Or is the stack not actually something like std::stack and something like a vector or just a contiguous piece of memory the VM/interpreter is managing?


Implementation-wise, yes, the stack is most probably contiguous memory, so a "peek" should be quick and easy to implement.


Note that also std::stack isn't really a container, it just wraps a container. Default is std::deque, but it could be any class that implement size, empty, back, push_back and pop_back.


For a scripting language, I would try make sure that func1() would use the variables in place, through pointers, as if they are the variables they are, and not caring that they happen to be allocated on a stack.


So the stack shouldn't be implemented like a std::stack (with the type safety, only being possible to push one type), but more like a custom linear allocator.

#5231434 Turn taking, instant or notify?

Posted by Olof Hedman on 28 May 2015 - 02:20 AM

According to our research, players cannot tell the difference between playing against a live player or a recorded session of one.


That should be highly dependent on the actual game, and in particular, the level of interaction between the two players.

Sure, two people playing parallel match 3 or a racing game (without, or with simplified, collisions), recorded sessions could be sufficient, but try that with a game of chess...

#5229790 Free to wait games, how can the wait or pay mechanic be used.

Posted by Olof Hedman on 19 May 2015 - 05:41 AM

I think it _could_ work, but it will almost always be mostly benefitting the developer, and not the game unfortunately.



The second part is a bit more tricky, as people don't want unnecessary responsibility.
There are games that could benefit from obligation, like god games.
Just think about it, if you where the god of a small village and raised the people on it from the moment of birth, feeding them, sheltering them even teaching them. If every thing you did for them took real time or money, could you sacrifice them for power?


I believe this is what Peter Molyneux thought too, but it is really hard to sell that idea... Probably would have been easier if he didn't do a kickstarter project out of it though...




 thy [...] thy [...] thy [...] thy


But why do you hate the letter e? sad.png

(your usage of "thy" is very confusing. Obviously you mean "they" but "thy" is also an english word (though archaic) with a different meaning from "they", so I kind of stumble in my mind each time I come across it in your texts, since I have to re-map its meaning...)

#5229785 what Motor/ Cognitive skills are required in this game?

Posted by Olof Hedman on 19 May 2015 - 04:23 AM

Even though all games could be said to need motor skill in some way, there definitely is a big difference how much of the game relies on motor skill and how much on other cognitive functions.


You can easily check the distribution by imagining your game being played by someone with severe neurological damage (like a broken neck), and thus having severely limited motor response.

That usually means at best being able to select and click something on a screen, perhaps dragging a little with bad precision.


How well will he/she do?


(Side note: There is currently at least one "game" being played by monkeys using nothing but neural interface directly into the brain, that does though hook into the motor cortex, and the monkey needs to learn to use it like any other limb. So I'd say even that needs motor skill)

#5227763 Game artist(s) who is / are able to make graphics like NARUTO SHIPPUDEN!

Posted by Olof Hedman on 07 May 2015 - 08:39 AM

If you want to please take a look at the fighting scene I've posted, it is 2D but it looks 3D because it's just designed very well.


It is actually the other way around.

It is 3D, but it looks 2D because it is designed very well.

Then there are some quick interstitials with actual 2D drawings to make the illusion complete.


This technique has been used for a long time to produce action scenes in animated TV shows like Naruto, but recently devices are powerful enough to do it really well in realtime.

(Zelda wind waker is half way there, but doesn't look as good as an animated TV show. Also the Naruto game has some ways to go, but it is indeed looking really good)

#5226815 Learning programming well

Posted by Olof Hedman on 02 May 2015 - 03:19 AM

I didnt know that once, and I used if...then...else with more than 15 options...
If I just code and code and code I cant really learn new commands?! Why should I think of using a select case command if I know if then else?


Don't worry about it :)

No-one knows everything, and you are just starting out.


Write code, get stuck, look for solutions, read others code, write some more code, throw everything away and start from scratch because the code sucked, write more code, ,google, write code, read a book, write code, read on forums, write more code, and then write some code.


Its the normal way of programming.

Before you know it, you know everything you need to know.

#5226080 Random Number Generation

Posted by Olof Hedman on 28 April 2015 - 09:10 AM

How can it be cryptographically secure if iy's only pseudo-random?  That doesn't sound secure at all!



#5226065 Is it necessary to license your game?

Posted by Olof Hedman on 28 April 2015 - 08:17 AM

The main confusion here comes from that you use "licence" incorrectly.


What your composer asks you to do is not to "license your game" (well he might, but then he too isn't using the word correctly), but he ask you to "licence the music (for your game)"


Licensing immaterial goods like music and software means getting permission to use it.

#5225845 Why Does Everyone Tell Newbies To Make Games?

Posted by Olof Hedman on 27 April 2015 - 08:22 AM

The whole point of giving a task, of reasonable size, is that it is easier to focus your learning if you have a task that needs to be fulfilled.


It's the basis of "Problem Based Learning".


Pong is about as simple as you can get, but still have something that classifies as a fully interactive graphical game.

You can also build upon it pretty far, to learn even more. (make it an arkanoid clone)


I would say it can be excellent to do in Unity, to learn the ropes of what is existing in the Unity framework. or Unreal. or any other engine.

You'll just learn other things then if you do it in SDL or SFML.

#5225822 Android game resolutions

Posted by Olof Hedman on 27 April 2015 - 06:44 AM

Welcome to developing for mobile devices smile.png

Unfortunately it doesn't have a universal solution, specially if you try think about all devices (there are even devices with square screens!)


Stretching never looks good, so no-one uses that (I hope)

I think the most common way is your no2, show more of the world, just as you say, make sure to show parts that doesn't affect the gameplay. (too much)

Some games, rather then letterboxing, adds "decoration" outside. I think this works best with puzzle style games.


As for what base to use, I'd recommend using an aspect ratio around 16:9 as a base, since many of the most popular phones use that.

#5225192 box2d pixels per meter scaling

Posted by Olof Hedman on 24 April 2015 - 03:01 AM

Moving Box2D objects should be about 0.1 - 10 meters big in order to run a stable simulation. Hence, their FAQ strongly discourages 1:1 pixel to meter conversions so I would not recommend defining 100x100 sprites as 100x100 meter objects.


Also, apart from stability, If you want your simulation to look natural, you should define your objects size to match their real world counterparts

A 100mx100m object behaves very differently from a 1x1m object.

The amount of pixels you use to draw them should be totally irrelevant when deciding how big you define your objects in your physics simulation.

Only what you try to simulate should matter (is it a soda can, a truck, or a planet?)


Box 2D is optimised to simulate things in the size range of soda cans to trucks.

#5224851 C++ Ternary operator ?: surprising conversion rules.

Posted by Olof Hedman on 22 April 2015 - 08:30 AM

I thought I knew how the ?: operator worked, but today someone surprised me by telling me this code does not compile:

class A {
class B : public A {
class C : public A {
A* example1(bool condition) {
  return condition?new B():new C();

LLVM says "Incompatible operand types (B* and C*)"




Doing this works fine:

A* example2(bool condition) {
  return condition?new A():new C();

Searching a bit tells me that the second operand must be convertible into the third, or vice versa, which B and C obviously isn't.


But what is the logic behind this?

Why is it not "enough" that they can be converted to a common base type?

Why do they need to be converted into each other anyhow, isn't it enough to convert the result, if needed?


I'm sure all this has a very logical explanation, anyone who wants to enlighten me? smile.png

#5224667 FastCall Is Alll

Posted by Olof Hedman on 21 April 2015 - 05:44 AM

On some keyboard layouts some of those characters are still hard to type and can hurt the hands in the long term



On the swedish mac layout, both {} and [] is some kind of hand breaking 3-key combination, I tried to code using it for about 10 minutes, before I decided to just switch to english layout while coding.

That was an awesome decision I have never regretted, all of the "special" characters are so much easier to type.

I'm sure it even helped my productivity, not mainly because of typing speed, but less cognitive overload.

#5224496 Write ToLower As Efficient, Portable As Possible

Posted by Olof Hedman on 20 April 2015 - 08:48 AM

Others have said it with more words, but I think it should be underlined a few times:

If you want to support more languages then simple 7bit ascii, you simply do not want to write this yourself, it is way to complicated for any single dev that has no intention of becoming a full time unicode AND language expert. Use a library.


Then the next question, why the lowercasing?

If it is to search for keys, and you want to support more then simple english 7bit ascii, just lowercasing is not enough.

You also need to handle language dependant rules of what characters match with others.

A unicode library will provide also this for you, by creating a "folded" version of the string.

#5223919 get string value from x-plane

Posted by Olof Hedman on 17 April 2015 - 04:36 AM

It would have been easier to help if you specify what "errors" you get, and if you try to understand them, you might be able to fix the problem yourself.


In this case, I'm guessing this line is your problem:


string Nfms1 = XPLMGetDataf (fms1);


since the manual says that GetDataf returns a float, not a string.


I think you need to use XPLMGetDatab to get bytes, since the manual says "sim/cockpit2/radios/indicators/gps_nav_id" is an array of bytes.


Maybe this will work?


char buff[256];


XPLMDrawString(color, PanelLeft1 + 70, PanelTop1 - 40, buff, NULL, xplmFont_Proportional);